Hello everyone,
I’m new on ESPHome and I’m trying to replace a physical toggle button logic with a SonOff T3.
In my living room I’ve six spotlights that are managed with a physical relay that change the number of them by pressing the toggle switch multiple times.
I can rapresent the 4 states in this way:
0 → All Spotlights are off
1 → All Six Spotlights are on
2 → 4 of 6 Spotlights are on
3 → 2 of 6 Spotlights are on
I’ve just configured ESPhome to turn automatically off the button 250ms after the pression of the physical button but I’d like to have a virtual object on HA where, selecting the “number of Spotlights”, it knows how many times the button should be pressed for reach the goal or, if I press the button X times, HA knows in wich state the lights are and, if I turn off the light object via HA, it knows how many steps it should do for reach the 0 state.
These are two good start point! Thank you.
Maybe the Select component is the more appropriate to my needs but, as I have described before, my problem is that is not a “logic” selector: everytime I change the option on the dropdown(?), the relay has to act with a specific ON->OFF order.
In other words:
If I start from OFF state, and I want to have four spotlights ON, the relay has to turn two times. Same if I want to shut down all of them.
If I want to have all the six spotlights turned ON, and I’m on 4 spotlight state, the relay has to turn 3 times.
That’s because the states that I’ve previously described, are cyclic and at every click on the switch (or relay cycle) the spotlights react as the table below:
0 → All Spotlights are off
(One click on the switch)
1 → All Six Spotlights are on
(One click on the switch)
2 → 4 of 6 Spotlights are on
(One click on the switch)
3 → 2 of 6 Spotlights are on
(One click on the switch)
0 → All Spotlights are off
[…]
Hope I was more clear than before!
Thanx in advance.
Danny