Detail pages
Tagged pages
MQTT
Parameters
| Server | : | mqtt.pv-log.net |
| Port | : | 1883 (default) |
| Topic | : | live/data/<API key>/<Channel key> |
| Message | : | JSON, see below |
The required keys for the topic can you find in your data channels overview.
Message
The message must be in JSON and can have these paramters:
| value | : | Channel data | float |
required |
| timestamp | : | UNIX timestamp | integer |
optional, use server time if not given |
{"value":"..."}
{"value":"...","timestamp":"..."}
Example
Send with a shell script and package
mosquitto-clients
installed.
#!/bin/sh
# Your API keys
APIkey=... # required
channel=... # required
# Collect your data
value=... # required
timestamp=... # optional
# Build full JSON message
message=$(printf '{"timestamp":"%d","value":"%s"}' $timestamp $value)
# Build minimum JSON message
# message=$(printf '{"value":"%s"}' $value)
# Send message, QOS 1 is recommended
mosquitto_pub \
-h mqtt.pv-log.net -p 1883 -i $HOSTNAME-publisher \
-V mqttv311 -q 1 \
-t live/data/$APIkey/$channel -m "'$message'"
Changed: February 27, 2021 18:57