I created a room temperature control automation system project based on people's presence using Azure Custom Vision and Raspberry Pi. I have successfully sent DHT11 temperature sensor data, camera sensors for the number of people in the image to Azure IoT Hub. The next step is how to get data from Azure IoT Hub into Azure Functions and add data to the local database. After that, you can also perform on/off actions on the device being monitored.
My expectation is that after the data can be received by Azure IoT Hub with proof of data in the telemetry message, the data can also be received by Azure Functions, the data can be added to the local database, and with this data Azure Functions can perform actions in the form of on/off to the device monitored.
I have created an event hub, event in azure-iot-hub and i've also created a function from local vscode so that the values from the tool can be entered into the my local database. My problem was when doing the create an Azure Functions project step and in point number 4. Run the following command to create a Functions app in this folder. Link reference: https://github.com/microsoft/IoT-For-Beginners/tree/main/2-farm/lessons/5-migrate-application-to-the-cloud#create-a-serverless-application
My program has an error that can't run as shown in the following image. error azure function still error like this. error azure function 2
With Event Hub trigger, we can obtain data from the Azure IoT Hub. This function triggers a response to an event sent to an Event Hub event stream.
Create an Azure Event Hubs trigger for Azure Functions using Visual Studio Code with the steps below:
local.settings.json
in the AzureWebJobsStorage Value.Code with local MySQL:
Function Logs:
MySQL:
Another method: