Use this Topic to Suscribe to a Variable’s last value
Replace the <device_label> and <variable_label> with the unique label of the device and the variable to subscribe for retrieving values update. If the specified Device or Variable do not exist, you will not able to establish the subscription with it.
Topic
Subscribe to Last Value: `/v1.6/devices/{DEVICE_LABEL}/{VARIABLE_LABEL}/lv`
Field | Value | Required |
---|---|---|
Host | www.connectedwater.ca | Yes |
Port | 1883/8883 (Non-TLS/TLS) | Yes |
Username | Your Auth Token | Yes |
Password | Any character or leave blank | No |
Quality of Service | 0 or 1 | No |
You can reference the device’s variable labels in the following links:
- Water Sniffer: https://connectedsensors.com/docs/leak-device-variables/
- Water Monkey: https://connectedsensors.com/docs/saya-values-variables/
Example
Note: The bash example from this section makes use of the Eclipse Mosquitto library
Subscribe to a Variable’s Last Value
Constantly obtain a Variable’s Last Value:
$mosquitto_sub \
-h “www.connectedwater.ca”\
-t “/v1.6/devices/weather-station/temperature/lv” \
-u “BBFF-Rfcgaxns6HlVb155WA0RhSY85xNDmB” \
-p 1883 \
-q 1
Subscription Response
24.0