0

I'd like to know if this is possible more than anything - then maybe steps on how to accomplish it.

I have a Pi with a camera, this should take a picture and upload to a blobContainer using azure iot hub

I want to be able to process that image, but also send a message back to the device. i.e - I need to know the DeviceId then send a message back to the device (Pi). I want to achieve this step using an Azure Function... I was previously able to send messages D2C, process in azure functions then (C2D) send back a message to the device in question like in this link

http://www.10thmagnitude.com/tech-blog/step-step-guide-creating-functions-within-azures-iot-hub/

I need to be able to know the device an image came from - can this be done?

7
  • Not sure what exactly you are asking, since you said you were able to send messages both directions. Do you know how to make it work without Azure Functions? Is your Device ID in EventData that you receive? Commented Mar 14, 2017 at 12:56
  • @Mikhail, the goal is to know the deviceID for a device that uploaded the image (then an event hub triggered Azure Function can use uploadedImage and the device Id and send a message back)... i got it working with sending string Messages - as per the second link Commented Mar 14, 2017 at 13:50
  • If that's the only thing, you can substitute string type to EventData in your function argument (step 5) to get message metadata Commented Mar 14, 2017 at 14:03
  • @Mikhail, basically, using the upload in the first link can this trigger an eventhub trigger function? - i know i could use blobtrigger function but then I will lose device id... Commented Mar 14, 2017 at 15:05
  • You can use Event as input trigger and Blob input binding to retrieve the related file. File path can be determined based on the properties of the event, if event is an instance of a strongly typed class. Commented Mar 14, 2017 at 15:14

1 Answer 1

2

In the tutorial you refer to Upload files from your simulated device to the cloud with IoT Hub, there is a simple console application that receives the file upload notifications (you are planning to replace this with an Azure Function if I understand you correctly). The console application retrieves the blob name using:

fileUploadNotification.BlobName

The FileNotification object also has a DeviceId property that gives you the device id you need.

If your Azure Function is reading from the /messages/servicebound/fileuploadnotifications endpoint, it receives a message with the deviceid of the device that uploaded the blob. See File upload notifications. Can your Function use blob trigger function and then read from the /messages/servicebound/fileuploadnotifications endpoint, or even just run on a timer and periodically check the endpoint?

Sign up to request clarification or add additional context in comments.

1 Comment

I don't think a timer task is what i want - ideally if fileuploadnotifications could trigger an azure function, that would work for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.