but when I press it while the light is on, it toggles off and on again.
I don’t want this to happen, and rather maintain the state without any flashes.
that would also invert the problem, so when the light is off, it will flash on,
besides the fact that my hardware skills aren’t good enough.
That makes sense to me, but not being in control would mean it should remain the status is has. Now it’s actively turned off by ESPHome(I think).
At least if I compare with Tasmota(I know, I do this a lot), those devices I can reboot/update/modify and none of the relay statuses gets changed.
At that point I’m able to update them without my wife complaining about the flashes.
ok,
I did some tests between tasmota and esphome
esphome devices flash on a reboot, off/on
tasmota devices do not.
For both count, pulling the pcb from the actual switch means the switch turns off.
but when putting this back, the tasmota device immediately remembers the state and turns on the switch.
where ESPHome restores to default.
Which leads me to the conclusion that Tasmota remembers the state after a powerloss(probably saves the state on flash) where ESPHome doesn’t.
This might has something to do with my issue of else this is a different one I’m facing.
It could also be that tasmota reboots faster, or does not fully reboot so it can maintain the switch statuses.
And I don’t know the difference, I assume it’s the same.
But adding restore_from_flash: true doesn’t make any difference in behavior
I would assume I need to apply some setting like persistent: true to a switch or outlet,
but can’t find that in the documentation.
Ok,
I did some tests and found what I need thanks to the suggestions above.
first of all early_pin_init does not seem to apply to light component, only to switch, so changing to switch does the trick for me,
Maybe this could be improved in ESPHome but for now switches are ok for me. Also I like the direct pin assignment of switches
Regarding restore_from_flash this actually works, but I needed to take the 1 minute interval into a count.
this is something I didn’t do during testing. Maybe I will disable this feature later, I think tasmota doesn’t have this one, so that’s why it always immediately restores to the previous version.