First time post and i’ve been using HA for about 2 months and had alot of fun with it so far, quite impressed so far.
Something i cant figure out though is I need a stateless button and that can cause a transition in another thing. What im trying to do is just have a single momentary push button connected to an ESP8266 which just fires a single message to mqtt to state that the button was pressed.
When HA sees that event i want it then to transition something else (testing with a light at the moment). The idea being you press the button once, the light turns on, press it again, light turns off - but also you could have multiple buttons and pressing any of them changes the light state.
So far i’ve sort of got it to work by making the esp alternate between sending “on” and “off” each time the button is pressed, but that doesnt work very well with multiple buttons. Not sure if i’ve missed something blindingly obvious here though. I’ve seen hints that such a thing should be quite easy, but so far i’ve not managed to get anything to work that doesn’t assume a state for the button in some way?
I have been using the Amazon Dash buttons for single purpose switches / toggles. They can often be had on sale at Amazon for 99 cents (Black Friday for instance). They are not instant since they need to wake up and then be detected on the network. It could take 3 or 4 seconds for a light to turn on or off.
The problem isnt the buttons, theres quite a few options out there. What i cant figure out is how you make them trigger a state change in something else without assuming that they have a state to begin with?
I’d like it to be mqtt, but doesn’t have to be i guess
Now I see what your doing… not what im after but it does give me what i was after, i wasn’t aware there was a “light.toggle” (which is quite obvious in hind sight).
Thanks for that!
Just FYI if anyone comes looking, this is my config:
Takigama and zarthan you are likley going to solve my problems…
I would like to use a sonoff to controll a step relay that control one light (from 3 different points). I would like to use the sonoff as a button, so it could give a pulse to the relay and toggling the state of the light from ON to OFF or from OFF to ON.
I’m going to add external button to the sonoff. When you push the button the sonoff goes to on to off and this excites the relay. how to syncronize the status of the light in HA? mayebe the light.toggle is the right option to use?