That will only trigger the first time the light drops below 12 and the alarm is off. If the light level is already below 12 and the alarm is then disarmed, that won’t trigger.
You could either add another automation which triggers when the alarm is disabled and the light level is below 12, or you could run a script every X minutes that only runs if the lights are off, the alarm is disabled and the light level is below 12.
Ah, I think I understand why now, the alarm shuts off at 5 am and probably the light level is below 12 at that time, I assumed that when the light level went above 12 it would trigger again when the level fell below 12. I will try your suggestions. Thanks Callifo.
Hey Trevor1, for clarity you are suggesting using the alarm state as the trigger e.g. when it changes to “disarmed” and the condition is light level?
Sounds worth a try! But the change in state of the alarm is only once per day, whereas the light level could be multiple times a day, particularly here in the UK!!!
Doesn’t your Aqara motion/light sensor have two entities to it? one binary sensor for motion and one light level sensor? Mine do. I use the binary sensor to check the room for motion, and the lightlevel to check if it is dark enough to want the light turned on. I would then leave the alarm condition as is.
Ah yes, sorry I misunderstood. I have not figured out the motion sensor. So far I think the motion sensor is only triggered when someone moves around, so if you are sitting watching a movie it won’t necessarily sense your presence. My preference is for the light to come on when the room gets dark irrespective if someone is in the room but I don’t want the light to come on if we are out of the house.
Okay another way you could do this, and maybe the easiest is like this:
- alias: Lights on after dark
trigger:
- entity_id: sensor.lightlevel_lounge
platform: state
condition:
- condition: state
entity_id: alarm_control_panel.alarm
state: 'disarmed'
- condition: state
entity_id: sensor.lightlevel_lounge
below: 12
action:
service: homeassistant.turn_on
entity_id: light.lounge_group
Doing it in this fashion, any state change in the light level sensor (ie. lightlevel numeric change) will trigger the automation, and then it will check the numeric condition of the light level itself.
Actually you should probably add a third condition to this. only if the lights are off.
thanks Trevor, it looks good. I have modified my automation yaml and it did not trigger when the light level dropped below 12. I think its something to do with my formatting, VScode is not reporting any errors and nothing in the logs so I am assuming its not even triggering.
it fires now, thanks Trevor, it did not help that the after we sorted the trigger I found that the action did not work. My light.lounge.group was a group created in hive, this does not appear to work in HA.
When I changed it to a group I created in HA yaml config it triggered like a dream. Will investigate further. Thanks for your assistance. I love this community!