Hi.
I’m a newbie to Home Assistant and automations, so apologies if this is a simple question.
I’m trying to set up an automation that switches off all lights on a long press of a switch. The switch device is a sonoff mini. When I do the long press on the switch, the MQTT message sent, which I can see in the console in Tasmota is:
stat/tasmota_EA268D/RESULT = {"Switch1":{"Action":"HOLD"}}
My automation code looks like this:
- id: '1624024642008'
alias: Turn off all lights
description: ''
trigger:
- platform: mqtt
topic: "stat/tasmota_EA268D/RESULT"
condition:
condition: template
value_template: "{{ trigger.payload_json['Switch1']['ACTION'] == HOLD }}"
action:
- service: light.turn_off
target:
entity_id: light.little_house_lights
mode: single
However, the automation is running even on the short presses of the switch as well as the long, so clearly my condition is not being evaluated correctly.
Please can anyone see what’s wrong with it?
Thanks.