Please could somebody look at this automation for me, it used to work until recently. Uses presence detection with a xiaomi door sensor. Something must have changed that has stopped it from working. If I manually change the states it fires as expected. Many thanks.
- alias: Door alerts
trigger:
platform: state
entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_25ff2e02_on_off
condition:
condition: and
conditions:
- condition: template
value_template: '{{ trigger.from_state.state == ''on'' or trigger.from_state.state
== ''off'' or trigger.from_state.state == ''open'' or trigger.from_state.state
== ''closed'' }}'
action:
- service: tts.google_translate_say
data_template:
entity_id: media_player.living_room_home_mini, media_player.dining_room_home_mini
message: "{% if (trigger.entity_id == 'binary_sensor.lumi_lumi_sensor_magnet_aq2_25ff2e02_on_off')\
\ and trigger.from_state.state == 'on' and trigger.to_state.state == 'off'\
\ %}\n {% for state in states.person if (state.state == 'home' and ((as_timestamp(now())\
\ - as_timestamp(state.last_changed)) / 60) < 5) %}\n {%- if loop.first\
\ %}{{ [ \"Hello, welcome back,\",\"Great to see you again, \", \"We missed\
\ you,\",\"Back so soon,\",\"Nice of you to drop by,\",\"Watts that smell.\
\ It must be,\",\"Oh no.It's,\",\"Hooray! It's \",\"Watts that coming over\
\ the hill. Is it a monster. Is it,\",\"Is it a bird, is it a plane, it’s\
\ super,\"] | random }}\n {% elif loop.last %} and\n {% else %},\n\
\ {% endif -%}\n {{ state.name }}\n {%- endfor %}\n{% endif %}\n"