Problems with Toggle

Hey guys-

I have an MQTT switch that I use to trigger a light toggle event…but the problem is when the event triggers HASS seems to trigger the automation 2 times - BUT only when the light is already on. So the light is on, then I click the switch and the light toggles off… 1s passes and the lights goes back on. The mqtt broker only sees the event 1 time. When the light is already off, it turns on properly. Its really strange. Its almost as if 2 automations exist with the same name (but there isnt… I checked)


- id: '1608734054368'
  alias: Mudroom Toggle
  description: ''
  trigger:
  - platform: mqtt
    topic: Relay/buttons/0/click/1
  condition: []
  action:
  - service: light.toggle
    data: {}
    entity_id: light.mudroom_light
  mode: single

I have tried using the device instead of the entity but I have the same issue.

Is it possible that the trigger topic has different payloads on click and release?
Maybe try the payload option for the trigger.
But this will not explain why it works if the light is off. :thinking:

As far as I can see - there is only 1 payload that is delivered - which is “state=on”. I could try adding that to be safe

I just tried… didnt change anything… And what is strange that i should have posted is that it only seems to happen 1 time per ~5-10s. What I mean is when the bulb is on, I press the switch and it turns off, waits ~1s, turns on. Then I press the trigger again and it turns off properly and stays off.

That’s odd.

To be sure that the automation not triggers multiple times, try to cool it down.

What happens if you toggle the light in Dev tools/services?
Auswahl_420

Thanks. Yes, awesome call with trying to do it through the Services pane. I get the exact same result. I dont know why I didnt test that earlier… BUT I realized that I also get the same reaction by calling light.turn_on and then light.turn_off. SO it must be an issue w/ esphome on this bulb and the logger mis-attributing the event - or rather trying to over-compensate. ANYWAYS, I have had a number of issues w/ esphome - including crashes on these Globe bulbs. i think I will end up having to move them to Tasmota :frowning: