The following was copied directly from automations.yaml. Note that this automation was entered via the HA interface, but even though I did that, I clicked on Automations under ‘YAML configuration reloading’ on the Developer Tools page.
Legit question: was is the sensor value? I went to the sensor’s tab on the ESPHome page and clicked Logs. Here is some data:
INFO Reading configuration /config/esphome/luxsensor.yaml...
[23:57:11][C][bh1750.sensor:118]: BH1750 'Light Level'
[23:57:11][C][bh1750.sensor:118]: Device Class: 'illuminance'
[23:57:11][C][bh1750.sensor:118]: State Class: 'measurement'
[23:57:11][C][bh1750.sensor:118]: Unit of Measurement: 'lx'
[23:57:11][C][bh1750.sensor:118]: Accuracy Decimals: 1
[23:57:11][C][bh1750.sensor:119]: Address: 0x23
[23:57:11][C][bh1750.sensor:124]: Update Interval: 90.0s
[23:57:53][D][bh1750.sensor:159]: 'Light Level': Got illuminance=5.8lx
[23:57:53][D][sensor:124]: 'Light Level': Sending state 5.77264 lx with 1 decimals of accuracy
[23:59:23][D][bh1750.sensor:159]: 'Light Level': Got illuminance=5.2lx
[23:59:23][D][sensor:124]: 'Light Level': Sending state 5.20669 lx with 1 decimals of accuracy
I know that switch.testdev_basement_switch works as expected because I created an automation to turn the switch on after a specified time and that worked as expected.
Keep in mind that the light level has to transition from above 10 to below 10 for the automation to trigger. e.g It will not trigger when going from 9 to 8.
I waited until after 2:55 pm and until I saw the value for sensor.light_level change in the log, at which point I darkened the sensor. I saw the value change in the log, but the switch never turned on. Now what am I doing wrong???
That worked - thanks!
So that I can stop annoying this helpful community with silly questions: Can you point me to some ‘document’ that describes automatons, etc. in detail so that I can try to learn this stuff myself?
Once you understand that, automations are a matter of thinking through the trigger and conditions in a logical way. There will always be quirks and I find most of my solutions in old posts on the forum.