🔆 Smart Light - Entity - Sun Elevation - Ambient & Time Triggers

@sgrobertson

Are you on the latest version 2.8? If not please update. Just push the import button again at the top and it will update it for you. All your settings / automation will be okay.

Blacky :smiley:

Thanks. I’ve done that. Should it now just magically work with 2.8, or is there a new setting I need to use?

Thanks
Stephen

@sgrobertson

I made some changes in a previous update, but let me know if it still not working and if so I will fix it.

Blacky :smiley:

1 Like

@Blacky Sorry, still doesn’t seem to be working still with the latest version. Any other info I can provide to help?

@Blacky found either a non-supported situation or a bug, not sure…

Wanting to turn on/off an RGB LED strip when a regular Light (using a Dimmer) goes on or off. On works fine but the RGB never turns Off.

I’ve included the non-working Smart Light YAML, and a working YAML I made from scratch.

Smart Light YAML (not working)…

alias: Office - Smart Light
description: ""
use_blueprint:
  path: Blackshome/smart-light.yaml
  input:
    include_entity_state:
      - entity_on
      - entity_off
    entity_input: light.double_switch_14
    light_switch:
      entity_id: light.office
    include_light_colour_control: use_rgb_colour
    light_colour_temperature: 6500
    include_light_control:
      - use_brightness
    include_bypass:
      - bypass_enabled_stop
    bypass_lights_on: []
    bypass_lights_stop:
      - switch.double_switch_14

Made from Scratch (works)…

alias: "Office : Light Sync"
description: ""
triggers:
  - trigger: state
    entity_id:
      - light.double_switch_14
conditions: []
actions:
  - if:
      - condition: state
        entity_id: light.double_switch_14
        state: "on"
    then:
      - action: light.turn_on
        metadata: {}
        data:
          rgb_color:
            - 255
            - 255
            - 255
          brightness_pct: 100
        target:
          entity_id: light.office
  - if:
      - condition: state
        entity_id: light.double_switch_14
        state: "off"
    then:
      - action: light.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: light.office
mode: single

Hello

Im not sure what im doing wrong here,
i want the lights to turn on during Sun elavation aka when sun is down. and from 6:45-8:00am i would like the lights to be on with 20% when occupancy is detected.

when I add Sun elevation the lights are turning on even during the day.

description: ""
use_blueprint:
  path: Blackshome/smart-light.yaml
  input:
    light_switch:
      entity_id:
        - light.kitchen_cabinets
        - light.kitchen_island
    include_entity_state:
      - entity_on
      - entity_off
    entity_input: binary_sensor.epl_kitchen_zone_1_occupancy
    include_sun:
      - sun_falling
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - time_enabled
    night_lights_entity_state: []
    night_lights_after_time: "06:45:00"
    night_lights_before_time: "08:00:00"
    include_night_light_control:
      - use_brightness
      - if_lights_are_on_adjust_when_crossing_over
    night_light_brightness: 15
    include_light_control:
      - use_brightness
    light_brightness: 69
    include_time: []
    after_time: "00:00:00"
    before_time: "00:00:00"
    sun_elevation: -1.5
    include_light_colour_control: use_colour_temperature
    light_rgb_colour:
      - 255
      - 255
      - 255
    include_night_light_colour_control: use_rgbw_colour
    night_light_rgb_colour:
      - 217
      - 211
      - 48
    night_lights_sun_elevation: -1
    night_lights:
      entity_id: light.kitchen_cabinets

type or paste code here

@Blacky i’m missing an option to set a time threshold for the ambient environment. It would be very nice to get the option that the light must be for a defined time under the minimal lux.

I have a couple of lux sensors outdoor and the show nice graphs:

Right now if the sensors reaches the minimal or high value the lights switch directly but i would it to be dark for, lets say, 2 minutes before the lights turn on (or off).

Can this be made possible?

Hello @Blacky,

First of all, thanks for your great work. I have a question, I use your Blueprint so that when my PS5 turns on, the lights on my wall also turn on. Works perfectly. I would like that when I am playing and the light goes below 30 lux, they turn on automatically and when they go above 80 lux they turn off. How can I do this? Considering I only want it to work when the PS5 is on. Thanks

@sgrobertson

Thanks for the info, I will look into it here as I would prefer it to just work.

Thanks

Blacky :grinning:

@Ltek

I Have tested it here and it is working perfectly. You own automation is not the same as the blueprint. I suspect that your bypass switch.double_switch_14 is turning ON when the light is ON and then it will never turn OFF until the bypass is OFF.

Blacky :grinning:

@dmob69

I think you using the wrong blueprint and should be using my Sensor Light blueprint. I will move this post to the sensor light blueprint and then provide your YAML for it.

Blacky :grinning:

@EvertJob

This is why we have both a Low and a High threshold, to prevent the light from turning ON and OFF too frequently.

The Low threshold turns the light ON, while the High threshold acts as a buffer to keep it ON until brightness rises above it. For example, if your Low is set to 20 lux, the light will turn ON at 20 lux. If your High is set to 80 lux, the light will remain ON until brightness exceeds 80 lux.

Looking at your graphs, the brightness seems to increase and decrease smoothly. Try increasing the buffer (the gap between Low and High) to ensure the light transitions more naturally.

Blacky :grinning:

@cediqqu

Use my :bulb: Sensor Light blueprint and set your PS5 as the trigger (assuming it has an ON/OFF state).

While you won’t be able to select it directly as a trigger, you can manually copy and paste your PS5 entity ID into the trigger input, it will work. Then, configure your lights as needed.

Use the Ambient condition and set your Low level to around 30 lux and your High to 90 lux (or adjust to your preference).

Blacky :grinning:

It works!!! Thanks man!!! Your Blueprints are great!!! :sunglasses:

1 Like

I’ve built an automation like that myself but after some days i notice that it still “bounce” to much so i edit the automation and add a time threshold for 3 minutes so that when the lux value has reached it’s wait for 3 minutes before executing the script.

My “on” threshold is 20 and the “off” threshold is 240 so there is plenty of room beteen them.

Offcourse i will give it a try:)

1 Like

@Blacky

Don’t know why, maybe i do something wrong but why are the lights are turning on but not off when the lux value has come above 80?

description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.bh1750_illuminance
    light_switch:
      entity_id: scene.ik_ben_thuis
    motion_trigger:
      - schedule.verlichting
    end_scenes:
      - scene.alle_lampen_uit

The schedule contains a value for today and from 00:00 till 23:59 so the whole day it should be on.

I dont want anything fancy but only: If lux is < 20 then turn lights on elseif lux is > 80 turn lights off.

@EvertJob

So your asking the same questions on 2 different blueprints.

What one are you using? The YAML you provided is for the sensor light blueprint.

If your going to use this blueprint (Smart Light) then you don’t need your schedule and just use the ambient options and select weekdays if needed.

Blacky :grinning:

Lol. Yup used the wrong blueprint. Changed it and works fine. Now just need to check the lux values…

My outdoor sensor is facing north and then 80 lux is to low for dusk

@EvertJob

Nice one…

Enjoy

Blacky :grinning:

@Blacky my wife is complaining about the automation. She would like to have a function that make it possible to turn on (or off) the light with a input boolean and after the ambiant trigger has reached the threshold the boolean schools be turned off and keep the lights on.

Is this possible?