The MQTT autodiscovery is fantastic. But, I am struggling with adding json_attributes to the sensors. The configuration I have looks like this:
name: “Office Temperature”,
state_topic: “tb/office/sensor”,
value_template: “{{ value_json.Temperature }}”,
availability_topic: “tb/office/status”,
payload_available: “Online”,
payload_not_available: “Offline”,
device_class: temperature,
unit_of_measurement: “°C”,
json_attributes:
- “Reboot count”
- “Packet count”
- “Uptime”
- “Gateway”
- “Localtime”
- “Address”
- “Voltage”
- “Humidity”
- “Software version”
The question is how do I jsonify the json_attributes? Tried the following and many variants:
{
“name”: “Office Temperature”,
“state_topic”: “tb/office/sensor”,
“value_template”: “{{ value_json.Temperature }}”,
“availability_topic”: “tb/office/status”,
“payload_available”: “Online”,
“payload_not_available”: “Offline”,
“device_class”: “temperature”,
“unit_of_measurement”: “°C”,
“json_attributes”: “- Humidity - Voltage”
}
Does anyone have the answer for how to format the json_attributes?
I have tried to build a mqtt discovery topic for a sensor which sends mqtt data in json and values can be accessed by jsonpath. I tried to follow the instructions here, but failed.
I added this to the configuration.yaml and restarted the docker container
You aren’t creating a device, you’re creating a single entity. Check developer tools → states page for your entity. Which should be named sensor.wp_control_target_high