I admit i’m not a programmer and only know the basics of yaml, so i’m hoping this will be a real easy one for someone to help me with.
i have an automation currently that works really well i have two philips pirs in a group one at one end of the kitchen and the other at the other end by the door entry, these currently activate a scene (for colours) and turn on some led strips in the kitchen, they only work after sunset and not after sunrise which as i say works perfectly. i want to be able for them to also turn on the scene and the led strips when the light level drops below a certain level. here is the current code:
alias: Kitchen Hue Motion Turn On Lights
description: Detect Motion Activate All Kitchen lights
trigger:
- platform: state
entity_id: group.kitchen
to: 'on'
condition:
- condition: not
conditions:
- condition: sun
before: sunset
after: sunrise
action:
- scene: scene.kitchen_bright
- scene: scene.kitchen_floor_kitchen_bottom
- type: turn_on
device_id: e575bacfe2627d940a27caabd2006011
entity_id: light.calex_led_strip
domain: light
mode: single
It’s not clear from your question if you want the automation to trigger if it gets dim, or if motion is detected and it is dim. If the latter, delete the numeric state trigger:
alias: Kitchen Hue Motion Turn On Lights
description: Detect Motion Activate All Kitchen lights
trigger:
- platform: state
entity_id: group.kitchen
to: 'on'
- platform: numeric_state
entity_id: sensor.your_light_sensor_here
below: 12 # change to the light level you want
condition:
- condition: or # from sunset until sunrise or if dim
- condition: state
entity_id: sun.sun
state: "below_horizon"
- condition: numeric_state
entity_id: sensor.your_light_sensor_here
below: 12 # change to the light level you want
action:
- scene: scene.kitchen_bright
- scene: scene.kitchen_floor_kitchen_bottom
- type: turn_on
device_id: e575bacfe2627d940a27caabd2006011
entity_id: light.calex_led_strip
domain: light
mode: single
thanks for that speedy reply Tom and apologies for not explaining my requirement, i want the automation to use the pir group to either:
turn on the lights when the light level gets dimmer than a set level even during the day
turn the lights on after sunset till sunrise
at the moment the lights dont come on during the day at all regardless how dark it might get in the kitchen, hopefully this will then allow them to come on during the day if needed.
Hi Toby, you the bomb! that worked first time, you little coding genius!! Thank a bunch for this, coding is not my thing at all, i can follow the code but cant understand its structure. Thanks again!