I have an IFTTT applet with webhooks service that turn on or off a light (sadly not supported by HA), IFTTT is integrated in HA and it works fine, tested with dev-service… now I would like a switch to turn that light from lovelace, this is the code I wrote in configuration.yaml:
# Trigger IFTTT
- platform: template
switches:
ifttt_switch:
value_template: "{% if is_state('sensor.ifttt_switch', 'on') %}on{% else %}off{% endif %}"
turn_on:
- service: ifttt.trigger
data:
event: lampada_studio_on
turn_off:
- service: ifttt.trigger
data:
event: lampada_studio_off
When I click on the switch the light turns on but the switch (the icon) immediatly change its state to off and I can’t turn off the light… if I call the service from dev-service it works fine so I think the problem is in the above code, maybe the value_template?