I have a ESP8266-based sensor. It seems to gather data properly, but it was suggested that I have it go into a deep sleep to make the battery last longer. Following is a part of the sensor’s yaml file:
I have this sensor on the homepage of Home Assistant and when I click on it, I see a chart of data. When I zoomed way in, I noticed that data points are two minutes apart, which strongly suggests I have something wrong in the yaml. Any ideas?
I have no idea why this is updating every second. Also, no idea where the system is getting the device class or unit of measurement. Perhaps there is a file that defines the BH1750 someplace? Perhaps that file is setting the update time to 1 sec and my yaml is not over-riding that?
(Note: This Raspberry Pi is running hassio) I did not see the file sensor.py, so I cd’ed to the root directory and did a ‘find . -name “sensor.py” -print’ and nothing was returned. I looked in the folder /root/config/esphome/.esphome/build and a see a folder named luxsensor. However, almost all of the files in this folder are source code.A quick glance at main.cpp shows the IP address, but nothing else jumped out. I cannot find a folder named esphome/components. I then tried ‘grep -rnw . -e “UNIT_LUX”’ and that too returned nothing. Now what?
Also, I am quite certain that the code was compiled and uploaded because from the device name on the ESP page, I selected (three dots)->Install->Wirelessly, watched it build and upload the code…
Is it updating home assistant every second, or is that just the internal workings of the esp C++ code. It is conceivable that the esp gets a value every second, but only passes it on to HA every 60 or 90s.
I have no idea how to adjust the C++ code to reset the time - no idea which parameter to change or if such a change would impact every ESP device.
More importantly, when I go to the ESPHome UI page and click luxsensor->Logs, I see it updating the value every second. As such, I suspect that it is sending data every second.
I removed the deep_sleep stuff from the yaml file, changed the update_interval to 90s, and watching the log, only one data point was sent every 90 seconds. This issue seems to be resolved. Now, if I could just figure out how to use the sensor value as a trigger, or condition, in an automation…
I wasn’t even aware of the fact that there are two kinds of automatons! However, I suspect that this needs to be a HA automation because the switch to be controlled is not an ESP device.