This is my automation, it announced when zmeventnotification detects something or someone.
- id: '1603752449417'
alias: Zoneminder Advertises
description: ''
trigger:
- platform: mqtt
topic: zoneminder/1
condition: []
action:
- service: tts.google_translate_say
entity_id: media_player.cozinha
data:
message: Frontal camera detected {{trigger.payload_json.detection.0.label}}
mode: queued
max: 10
the mqtt message is something like this
'{"name":"Frontal:(1584) [a] detected:person:52% Motion Entrada","hookvalue":"0","state":"alarm","detection":[{"confidence":"99.11%","box":[6,226,316,456],"label":"car","type":"object"},{"type":"object","label":"person","box":[265,565,427,677],"confidence":"52.37%"}],"monitor":"1","eventtype":"event_start","eventid":"1584"}'
Note that trigger.payload_json.detection is an array. At my automation, I am only announcing the first object. How can I iterate over the array to announce all the objects?