Hey all, I have an automation I designed but need some advice.
I flashed a Sonoff S31 with ESPHome and have it connected to my dishwasher to monitor power. The automation triggers 2 minutes after the power setting returns to zero (the delay is because during certain wash cycles, the power drops to zero momentarily, which triggered the automation while the dishwasher was still actually running). The automation turns a green light on, signaling that the dishes are clean. With the use of a door sensor, the automation then turns the green light off after the door has been open for 2 minutes (due to the placement of the dishwasher, it is not really possible to leave the door open and still get around it, so my thinking that if the door is open for 2 minutes, it is because someone is emptying the dishwasher). The delay prevents the light from turning off in the event someone opens the dishwasher to get one item out, then closes it again right after, not actually having emptied it.
Overall, it seems to work pretty well. It usually triggers only after the dishwasher has completed its cycle and only turns off after the door has been left open.
SO, my question is, can I make this more foolproof? I don’t think there is much I can do regarding triggering the light to turn on, unless I’m thinking about this wrong, but I would especially love a way to better signal when the dishwasher has been emptied. I was thinking maybe a pressure switch, but that is all new to me.
Lastly, I noticed that when ESPHome is updated, it causes the automation to run and turns the light on. How can I prevent the state of the light from changing after a HA reboot or an update? Meaning, if the light is on after a cycle, and HA reboots, I want the light to return to its state.
Thank you!!!