I have set up a motion automation with my Aqara P2 motion sensor, which had been working ok.
It comes on 30 minutes before and 30 minutes after sunset/sunrise.
What I have now found out is that sometimes it is dark in the afternoon before the automation activates, so I set up another automation based on the LUX, which also works ok.
What I am thinking is to combine the 2 automations into one, but cannot figure out where to place the LUX automation into the motion one.
Motion Automation
alias: Kitchen Motion
description: ""
conditions:
- condition: or
conditions:
- condition: sun
before: sunrise
before_offset: "+00:30:00"
- condition: sun
after: sunset
after_offset: "-00:30:00"
use_blueprint:
path: homeassistant/motion_light.yaml
input:
motion_entity: binary_sensor.kitchen_motion_occupancy
light_target:
entity_id:
- light.kitchen_lights
no_motion_wait: 120
LUX automation.
alias: Kitchen Lights LUX
description: Turns on the light if the lux level drops below 70
triggers:
- type: occupied
device_id: 159de816fa433257a55a37c2eca2e537
entity_id: 953fbcaa968a55d310597d2fdc52e70e
domain: binary_sensor
trigger: device
conditions:
- type: is_illuminance
condition: device
device_id: 159de816fa433257a55a37c2eca2e537
entity_id: 3268dac5b19789072b9b82c95817a827
domain: sensor
below: 70
actions:
- action: light.turn_on
data: {}
target:
entity_id: light.kitchen_lights
mode: single
I was thinking that it would be neater just having one automation.
I think that the Conditions from the LUX automation needs to go after the sunrise/sunset condition in the motion automation.