Hello, I’m looking for a little bit of help. I have zoneminder set up to publish MQTT messages to a mosquito broker. Home Assistant subscribes to the zoneminder topic. When I have Home Assistant configured to output {{ value_json.name }} to a sensor, it works. It displays the full line "Front Door Halo:(19328) [s] detected:person:97% Door Step”. But I would like to get the label value of “person” to display. I’ve tried different value template configurations with different results. Below I have the MQTT output from zoneminder, Home Assistant platform configuration, and the different values I’ve tried so far and the associated results. I’ve been trying to use the Processing JSON Home Assistant document, but my programming skills are novice at best. Any help you can provide is appreciated. Also as a side not, I’ve verified that Home Assistant receives the topic information by using the MQTT Developer Tool as well has using MQTT Explorer.
Zoneminder MQTT Output
{
“state”: “alarm”,
“eventid”: “19328”,
“hookvalue”: “0”,
“name”: “Front Door Camera:(19328) [s] detected:person:97% Door Step”,
“monitor”: “1”,
“detection”: [
{
“label”: “person”,
“type”: “object”,
“confidence”: “97.47%”,
“box”: [
1,
93,
259,
725
]
}
],
“eventtype”: “event_start”
}
Home Assistant Platform Configuration
- platform: mqtt
state_topic: “zoneminder/1”
name: Front Door Camera Messages
#value_template: “{{ value_json.name }}”
value_template: “{{ value_json[‘detection’][‘label’] }}”
Results:
Works but returns blank value
value_template: "{{ value_json.detection.label }}"
Doesn’t change value in Home Assistant it stays showing Unknown
value_template: "{{ value_json[detection].label }}"
value_template: "{{ value_json[detection]['label'] }}"
value_template: "{{ value_json[detection].label }}"