Azure IoT Hub - Interested in hearing ideas


#1

Hi,
Full disclosure - I work for Microsoft (on SharePoint) and I know nothing about the underlying technology of the ST hub. I bought into ST because of the versatility and open development platform but haven’t found time to actually start writing any code.

I saw an announcement today on Azure IoT Hub going GA and I was wondering if the technology is similar to the ST infrastructure.
Are there any opportunities for Azure IoT augmenting the ST hub?

Just a random thought and interested in hearing ideas/opinions…

Thanks,
Kerry


(Joshua Lyon (SharpTools.io Dashboard)) #2

I played a bit with Azure Event Hubs and Stream Analytics before Azure IoT Hub came out and the integration was fairly straight forward. My goal was to get the data into Azure for long-term storage/archival and the ability to feed the data into Azure Machine Learning and other tools.

The integration was fairly straightforward: I took the webhooks SmartApp by @harper and adjusted it to post the data to my Event Hubs endpoint which is automatically made available by Azure. Once the data hit Event Hubs, I used Stream Analytics to transfer the data into Azure Table storage and then built a simple web Azure Web App to visualize and trend the data.


After doing all that, I was questioning why I was using Azure Event Hubs for this since it seems really overkill for a small proof of concept. Keep in mind Event Hubs can log millions of events per second and I was doing this for just my house.

Since Event Hubs are a bit expensive for what I was getting out them, I was curious if there were other tools which might work for my particular application. I ended up changing over to Azure Queues which still support 2000 events per second and are super cheap (basically the dirt cheap storage costs). There are a lot of tradeoffs going this route which probably don’t make sense for many event driven applications, but it worked fine for my application which was mostly archival purposes.


(Alan) #3

I’m not sure if relevant, but I’m about to pursue a path of using the Rest API to record the events in an Azure Table for later desktop display and analysis in a .Net app.

Although Azure IoT services are “Free” at a householder type event volume (<8000 /day),I am avoiding the Azure IoT services because reading between the lines I feel that this facility is more intended for companies to experiment with, but ultimately leading to an “industrial” level requirement and not for home owners. Because of this I am not prepared to invest time into the Azure IoT service. However, the Azure storage table services look highly applicable - I just wish there was an off the shelf Groovy example for it.

Regards
Alan


(Joshua Lyon (SharpTools.io Dashboard)) #4

Most of the Azure services have a REST API for them. My experience was most of the hard work is wrapping your head around the Azure REST API and the requirements for things like authentication (Shared Key/Shared Key Lite) and specific headers (continuation/pagination).

For example, here is the Azure Table Storage REST API:
https://msdn.microsoft.com/en-us/library/azure/dd179423.aspx

Once you get that figured out, the SmartApp methods httpGet, httpPost, httpPut, etc are fairly straightforward to use.

PS. I posted an article on using Shared Access Signatures with Azure Queues which may be of interest to you if you go down the Azure services path:
http://boshdirect.com/tech/azure-queue-via-shared-access-signature-and-rest

PPS. I would also recommend testing all of your REST API calls in something like Postman. Once you get your API calls figured out, then look at moving things into SmartThings. :slight_smile:


(Nick Taylor) #5

@joshua_lyon I’m attempting to get data from ST via webhooks up into an Azure Event Hub like you have mentioned you were able to do by modifying the webhooks SmartApp. I was hoping if you had a moment if you could point me in the correct direction on what you had to change to get events flowing? Thanks in advance if you can assist!


(Joshua Lyon (SharpTools.io Dashboard)) #6

Nick-
Mainly the things in the post right before yours - using the native Azure REST APIs and getting the Shared Access Signatures properly setup:

Azure IoT Hub - Interested in hearing ideas


(Andreas) #7

I am very interested in hearing peoples ideas too.

I have just managed to get all my events pushed out to the Iot Hub by modifying Sam Cogans code (https://github.com/sam-cogan/st-event-hub) a little bit. I didnt want to use event hubs cause those cost money, but Iot Hub is free up to a certain threshold…

Im thinking of creating some sort of dashboard for my house for visualization purposes. Perhaps at a later stage implementing two way communcation from Azure Iot hub to ST hub…