Distribute Sensor Observations to Azure IoT Hub and to Azure Data Explorer.
Sensor observations are imported from eg. Metasys using the RealEstate CloudConnector
See the official Azure IoT Hub documentation for details.
See the official Azure Create Device documentation for details. From the Device's config page copy the "Primary connection string". This string need to be copied to the local_override.properties in CloudConnector, "distribution.azure.connectionString="
Startup the CloudConnector and verify that observations are distributed to Azure IoT Hub.
- In the logfile (logs/metasys..log) you should see something like this:
Establishing and verifying connection to Azure.
- CloudConnector Health on http://:/cloudconnector/health/pretty - look for:
"AzureObservationDistributionClient-isConnected: ": "true",
"AzureObservationDistributionClient-numberofMessagesObserved: ": "1",
In the IoT Hub, select the "Metrics" menu item. Create a new chart with the following settings:
Sum Routing: telemetry messages delivered for <your IoT Hub>
See the official Azure Data Explorer documentation for details.
In the "Overview" of the Azure Data Explorer database, select the "IoT Hub" button, under "Data connections". See the official Azure Data Explorer documentation for details.
See JsonMapping input from IoTHub to ADX for details. "Name": JsonTelemetryMapping, "Kind": Json, "Mapping":
[{
"column": "messageId",
"path": "$.messageId",
"datatype": "",
"transform": null
}, {
"column": "sensorId",
"path": "$.sensorId",
"datatype": "",
"transform": null
}, {
"column": "tfm",
"path": "$.tfm",
"datatype": "",
"transform": null
}, {
"column": "realEstate",
"path": "$.realEstate",
"datatype": "",
"transform": null
}, {
"column": "building",
"path": "$.building",
....
See JsonTelemetryMapping for the full mapping.
In Azure Data Explorer, select "Dashboard" and create a new dashboard. Query for CO2 observations in all rooms, for a single floor:
RealestateTelemetry
| project placementRoom,building,floor,realEstate,sensorType, observationTime, value
| where realEstate == "511" and building == "511" and floor in ("1", "01")
| where sensorType == "CO2"
| where observationTime between (['_startTime'] .. ['_endTime'])
"RealestateTelemetry" is the name of the table created above.
mvn clean install
Run AzureDeviceClientmanualTest from your IDE.