And also make sure everything is properly quoted.
Here’s an example I’m testing with, which is working fine:
{
"measure_battery": {
"capability": "measure_battery",
"stateTopic": "test/state",
"setTopic": "test/set",
"valueTemplate": "$.value",
"outputTemplate": "{\"xxx\":{{value}}}",
"displayName": "Battery"
}
}
Pushing a value:
$ mqtt_pub -vh 192.168.23.2 'test/state' '{"value":80}'
Output (on the test/set
topic):
{"xxx":80}