šŸ”† Smart Light - Entity - Sun Elevation - Ambient & Time Triggers

Transition is the time it takes to go from OFF to ON and from NO to OFF.

You can only choose one colourā€¦ one for normal lights and another one for night lights.

Blacky :smiley:

Sorry for the confusion! :slight_smile: Let me rephrase. The light should turn on and get its brightness changed based on the illuminance sensor (which is part of my Hue motion sensor). Also when Iā€™m home and when a sensor Awake=on. (Which gets set automatically every day when I get into the living room and gets turned off when I go to sleep at night) Motion is not relevant as Iā€™m often sitting still in the living room.

If I use the Sensor Light blueprint, I need to specify a binary sensor as the trigger sensor which I donā€™t think is relevant because it just needs to use the illumination sensor. And when I use the Smart Light blueprint, itā€™s not turning on my light when illuminance is below the threshold.

Does that make sense? Thanks!

@TheAutomator

So the Smart Light blueprint will do it for you but you will need to create a template binary sensor to use in the bypass. This template binary sensor should be configured as follow

  1. Awake = ON and you are home = Binary sensor OFF

    else binary sensor ON

Then you use this in the bypass option 2 and set up you ambient.

Blacky :smiley:

1 Like

Thanks! Have made the binary sensor and will test with this soon! :slight_smile:

1 Like

Aaah I think I see it. I used the dev tools to play with the inputs. Letā€™s say I set low lux value to 20. When my motion sensor reports 0 or 5, the automation doesnā€™t trigger while I was expecting it to. It needs to cross from 21 to 19 to be effective. Is there a reason the blueprint works like that instead of just always triggering and checking if the value < 20? There is probably a good reason you implemented it like that. Thanks! :slight_smile:

Also another interesting scenario I noticed is when I switch back from night light to normal light mode that the brightness goes from 50 % (the night light value I set - good) to 54 % instead of 100 % which is what the dynamic lightning should control. If I then go and force the lux value of the illuminance sensor to e.g. 0, it goes back to 100 % (which is in line with my dynamic lightning setting). If I disable dynamic lighting and enable the option ā€œUse Brightnessā€ under Light Control, it goes to 100 %, so this looks like an issue with dynamic lighting.

switch.light_living_room_night_light_scene is a simple switch that turns on when my Apple TV is playing and off when it pauses. Any idea what that could be? Here is my current config:

alias: Light - Living Room
description: ""
use_blueprint:
  path: Blackshome/smart-light.yaml
  input:
    light_switch:
      entity_id: light.living_room
    include_ambient:
      - ambient_low
      - ambient_high
    ambient_light_sensor: sensor.living_room_window_illuminance
    dynamic_lighting_boolean: input_boolean.toggle_helper_automations_light_living_room
    include_dynamic_lighting: enable_lux_controled_brightness
    dynamic_lighting_lux_sensor: sensor.living_room_window_illuminance
    include_bypass:
      - bypass_enabled_turn_off
    bypass_lights_off:
      - binary_sensor.light_living_room_bypass_sensor
    night_lights_entity_state:
      - switch.light_living_room_night_light_scene
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - entity_state_enabled
    night_lights:
      entity_id: light.living_room
    include_night_light_control:
      - use_brightness
      - if_lights_are_on_adjust_when_crossing_over
    night_light_brightness: 50
    include_light_control: []

I have a light entity which supports RGB, e.g. light.ok_to_wake_light. I see the ability to set one RGB value along with a schedule, but in my case I want the following different colors:

7pm - blue (0, 0, 255)
8:30pm - red (255, 0, 0)
6:30am - green ( 0, 255, 0)
9am - off (0, 0, 0)

How can I have a schedule like this? My apologies Iā€™d love to not have to ask, but I couldnā€™t figure it out on my own.

Thank you! I super love this blueprint.

@TheAutomator

This is how automations work, they have a trigger point.

You will notice your dynamic lighting step value is 4% so that is why it is 54% to slowly go to the brightness. Then at ever heartbeat your light will change 4% untill it gets to its value.

Have you got another automation?

Blacky :smiley:

@bmbouter

You will need to create a script with a choose. Below is your YAML for a script. Just create a new script, edit in YAML and paste this in. Then edit in visual editor and expand out the 4 actions and replace / change your light entity. Save and then add this into lights. Make sur you create another scene or script with the light OFF and add it into Scenes - Scripts To Turn OFF then also add a toggle helper into Scenes & Scripts - Toggle Helper.

alias: OK To Wake Light
sequence:
  - choose:
      - conditions:
          - condition: time
            after: "19:00:00"
            before: "20:30:00"
        sequence:
          - action: light.turn_on
            metadata: {}
            data:
              rgb_color:
                - 0
                - 0
                - 255
            target:
              entity_id: light.your_light_here
      - conditions:
          - condition: time
            after: "20:30:00"
            before: "06:30:00"
        sequence:
          - action: light.turn_on
            metadata: {}
            data:
              rgb_color:
                - 255
                - 0
                - 0
            target:
              entity_id: light.your_light_here
      - conditions:
          - condition: time
            after: "06:30:00"
            before: "09:00:00"
        sequence:
          - action: light.turn_on
            metadata: {}
            data:
              rgb_color:
                - 0
                - 255
                - 0
            target:
              entity_id: light.your_light_here
    default:
      - target:
          entity_id: light.your_light_here
        action: light.turn_off
        data: {}

The YAML below is if you schedule is ON it will check every 30 min and change the light colour

alias: OK To Wake Light
sequence:
  - repeat:
      while:
        - condition: state
          entity_id: schedule.your_schedule_here
          state: "on"
      sequence:
        - choose:
            - conditions:
                - condition: time
                  after: "19:00:00"
                  before: "20:30:00"
              sequence:
                - metadata: {}
                  data:
                    rgb_color:
                      - 0
                      - 0
                      - 255
                  target:
                    entity_id: light.your_light_here
                  action: light.turn_on
            - conditions:
                - condition: time
                  after: "20:30:00"
                  before: "06:30:00"
              sequence:
                - metadata: {}
                  data:
                    rgb_color:
                      - 255
                      - 0
                      - 0
                  target:
                    entity_id: light.your_light_here
                  action: light.turn_on
            - conditions:
                - condition: time
                  after: "06:30:00"
                  before: "09:00:00"
              sequence:
                - metadata: {}
                  data:
                    rgb_color:
                      - 0
                      - 255
                      - 0
                  target:
                    entity_id: light.your_light_here
                  action: light.turn_on
        - delay:
            hours: 0
            minutes: 30
            seconds: 0
            milliseconds: 0

Blacky :smiley:

I am trying to trigger a device (a wall wifi switch connected to a dehumidifier) using your automation when the humidity goes above a certain percentage (humidity sensor). I have created an automation that links to your automation. However it is not working. I would also like to have the switch to go off when the humidity sensor goes below a certain percentage and then shut off the dehumidifier. Here is the YAML. Or can I do all of this just using your automation? Can you help me with this? Thanks1

alias: Crawl space wall plugin ON when humidity >56%
description: Crawl space plugin ON when humidity >56%
triggers:
  - type: humidity
    device_id: 3977a68e58081ca5f6101781f3712f4c
    entity_id: bb0e6d16f7bb87a7c99eea670a3386a3
    domain: sensor
    trigger: device
    above: 56
conditions: []
actions:
  - action: automation.turn_on
    data: {}
    target:
      entity_id:
        - automation.crawl_space_dehumidifier_1_front_on_off
mode: single

@dsim

Sorry, please donā€™t post your questions about your automation here. This post is for this blueprint only. Please create a separate topic and ask the questionā€¦ there are many community members willing to hep you.

Blacky :smiley:

1st of all: awesome work :beers:

Quick question as Iā€™m willing to debug myself: how to trace this automation? I even cant scroll to the end, trace is cutted of.

I have here an Hue Light 9290012573A

I wonder if it works with that color_mode xy
refering to zigbee2mqtt it should also accept RGB: Philips 9290012573A control via MQTT | Zigbee2MQTT

{
    "brightness": 87,
    "color_mode": "xy",
    "last_seen": "2024-10-23T23:49:08+02:00",
    "linkquality": 48,
    "power_on_behavior": "off",
    "state": "ON",
    "update": {
        "installed_version": 16787456,
        "latest_version": 16787456,
        "state": "idle"
    },
    "color": {
        "h": 5,
        "hue": 5,
        "s": 91,
        "saturation": 91,
        "x": 0.589,
        "y": 0.329
    },
    "color_temp": 439,
    "update_available": null
}

But even with minimum trigger and simply condition, this or other light wont turn on.

With a on/off switch it gets triggered. So now I just wanna trigger it by the Sun Elevation. No luck so far.

@TylonHH

That is the end you just need to move to the right to see the trace. It is a big one with a lot going on.

Could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on ā€œ</>ā€ and paste code in there.

Blacky :smiley:

No needed anymore. The automation works like charme, since it was triggered by the ā€œsunā€. I thought while setting up or testing it, it would run because the sun was down.

Awesome work. Saved me alot of headacheā€¦ ā†’ donation
grafik

Sorry for my late reply - have been traveling. Understood, thanks so much! It indeed slowly recovers from the night light to get to the full light again with the step values. :+1: I ā€˜misuseā€™ the night light mode to dim the lights when my TV is on so itā€™s great when it fast transitions from dynamic lighting to night light as it does now. Is there also a possibility to bypass the step value when it goes from night light back to dynamic lighting? Thanks!

I have this working great in a hallway using a presence sensor to trigger the lights. I have dynamic lighting based on sun elevation to set the appropriate brightness.

However, is it possible to have an AND clause in the trigger, such that if the illuminance sensor has a lux above a threshold it would not trigger (or trigger presence triggered and lux below threshold).?

It doesnā€™t and I guess the work around would be to use dynamic lighting?

@TylonHH

Thanks for letting us know, your kind words and for you support :heart:

Glad it hear it working and saved you some time.

Blacky :smiley:

@TheAutomator

You can increase the step value to a higher value like 50% or even 100% then in Light Control increase your transition time so it smooths out the light for you.

Hope this helps

Blacky :smiley:

1 Like

@alexkoon

If you are using a presence sensor to trigger the automation you better off using my :bulb: Sensor Light blueprint. In this blueprint you will then have the ability to use a LUX sensor so if the light levels are below your setting the automation will run.

This is how I do this and is what you are after.

Blacky :smiley:

Hello @Blacky - very smart things you do!
Please do you have a clue how to use this blueprint to turn light xx minutes before sunset and let them ON for XX minutes (after OFF) and again ON XX minutes before sunrise? Thank you.