I am trying to send data to IOT Hub and store it in blob storage as well as Power BI streaming dataset using Azure Stream Analytics service.
For sending data, I used Microsoft's Python SDK application (link given below):
https://github.com/Azure/azure-iot-sdk-python/blob/main/samples/async-hub-scenarios/send_message.py
This script successfully sends data to Azure IOT Hub and I am able to visualize it in Azure IOT explorer but does not create a blob storage file or Power BI streaming dataset. Whereas in Stream Analytics, in the input section it gives the below error:
ERROR : "Could not deserialize the input event(s) from resource 'Partition: [1], Offset: [8591414904], SequenceNumber: [3081], DeviceId: [test001]' as Json. Some possible reasons: 1) Malformed events 2) Input source configured with incorrect serialization format"
The output I received on Azure IOT explorer is as follows which is a perfect json string:
{
"body": "test wind speed 10",
"enqueuedTime": "Tue Nov 07 2023 23:49:29 GMT+0530 (India Standard Time)",
"properties": {
"tornado-warning": "yes"
}
}
WHEREAS for the same IOT Hub and Stream Analytics connections, if I use the Microsoft's Javascript SDK application (link given below):
https://github.com/Azure/azure-iot-sdk-node/blob/main/device/samples/javascript/simple_sample_device.js
I am able to send data to IOT Hub as well as create a blob storage and streaming dataset on Power BI.
The output received on IOT explorer after running Javascript script.
{
"body": {
"deviceId": "myFirstDevice",
"windSpeed": 10.487688712678684,
"temperature": 23.702052411822482,
"humidity": 79.27664927491016
},
"enqueuedTime": "Tue Nov 07 2023 23:02:30 GMT+0530 (India Standard Time)",
"properties": {
"temperatureAlert": "false"
}
}
The Javascript application runs absolutely fine but not the python script.
Can anyone please point out what exactly I am doing wrong with Python script?