Cloud2Device Messages
In order to verify that the device and the cloud connector can successfully receive messages sent by the cloud backend, we will send a dummy message to the device.
Pre-Requisites
- Device is up and running, e.g by running in qemu
- Eclipse Leda has successfully booted
- The device has been provisioned and configured, see Device Provisioning
Validating configuration
First, let’s check that the cloud connection is active.
-
Login as
root
-
Run sdv-health and check for the SDV Connectivity section:
sdv-health
-
Start watching the output of the cloud connector:
kantui
-
Select the
cloud-connector
container and pressL
to watch the logsNote: When an unknown type of message is received, the cloud connector will log an error:
2022/04/13 16:04:41.911727 [agent] ERROR Handler returned error err="cannot deserialize cloud message: invalid character 'H' looking for beginning of value
-
Start watching on the MQTT message broker:
mosquitto_sub -h localhost -t '#' --pretty -v
Note: When a known type of message is received, the cloud connector will forward the message to the MQTT broker into the corresponding topic
$appId/$cmdName
Sending a Device Message
- Go to the Web Console of Azure IoT Hub
- Select the device
- Click on “Send Message”
- Enter a C2D payload and click “Send”
Alternatively, on command line, use the Azure CLI client. Replace DeviceId
and IotHubName
with the appropriate names of your IoT Hub and device.
az iot device c2d-message send \
--device-id ${DeviceID} \
--hub-name ${IotHubName} \
--data 'Hello World'
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.