Hi there. I want to learn to make PCBs and therefore I realised a closet light which is controlled by a esp.
Is it possible for esphome to read values from an home assistant instance? I want to put the esp into deep sleep on day and turn it on when the sun sets. This data I could provide from home assistant.
Let me clarify: I want to use the sun rise and set data to put the esp into deep sleep. Sun rise will determine when and sun set for how long. According to the documentation there is sleep_duration.
My problem is that I don’t understand how to the esp could read the data from home assistant.
Is ESP wired to HA?
You may try to give a pulse to ESP to wake up. Perhaps the simplest wiring to try to sense a serial input. Any character is starting with a start bit, which i normally from high to low transition.
It is a little circuit that controls a mosfet based on a distance sensor: if the door is open light will turn on and if the closet door is closed it will turn off. In addition to that I would like to put the esp into deep sleep when there is daylight. I could go for static times but then you have different lighting conditions in winter and summer. I thought that I might use the sun data from home assistant but I’m missing how I can utilize it on the esp.
I would use this you only need the time from another source, like home assistant, but that is super easy.
I’ll use the on_sunrise event to go to sleep, then you’ll have to write a lambda to convert the value returned by next sun set into time and feed that to the deep sleep.
Is your esp battery powered? Is the light battery powered?
You may get a NTP server time, too, whether your ESP is connected to a router and then to internet. Otherwise there might be a NTP server on the HA system.