šŸ’” Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

@rbhun

That is good news, glad you got it working.

Thanks for your inputā€¦ I understand there is just so many options and there is a lot to take in. I try not to make it too long but I am always open to feedback and will take it onboard.

Blacky :smiley:

@radokristof

Normally, lights are designed to restore their previous state automatically after being turned off by automation. This behavior is typically managed by the light device itself and doesnā€™t usually require any additional configuration within the blueprint or automation.

Can you explain what is happening in the blueprint?

Blacky :smiley:

Thanks for the reply. I was trying to troubleshoot why the blueprint was not working. The EP1 has an Occupancy sensor is a combination of the mmWave and PIR sensor. If either the mmWave or PIR sensor detects motion, Occupancy will be ā€œOnā€ or ā€œDetectedā€. Both the mmWave and PIR sensors must be clear before Occupancy changes to the ā€œOffā€ or ā€œClearā€ state.

Here is what Iā€™m seeing in the trace.

{
  "trace": {
    "last_step": null,
    "run_id": "ee1ea2492d0d84c9130d273f7eec87ae",
    "state": "stopped",
    "script_execution": null,
    "timestamp": {
      "start": "2024-08-27T14:26:02.879568+00:00",
      "finish": "2024-08-27T14:26:02.881328+00:00"
    },
    "domain": "automation",
    "item_id": "1724644793748",
    "error": "UndefinedError: 'dict object' has no attribute 'entity_id'",
    "trigger": null,
    "trace": {},
    "config": {
      "mode": "restart",
      "max_exceeded": "silent",
      "variables": {
        "motion_trigger": [
          "binary_sensor.living_room_ep1_sensor_occupancy"
        ],
        "light_switch": {
          "device_id": "8bb0f514c8fcd150398845b32e31def7"
        },

Good morning, I love your plans. Do you have something I can use for Tapo plugs that would allow me to easily set a timer for XX minutes and then turn off the plug? Thank you very much.

@skynetAI

Looks like the Everything Presence One has it built in alreadyā€¦ nice.

You are using a device in lights. Please see this link click hereā€¦ it shows you how to expand down to entities as devices are not supported in this blueprint.

Blacky :smiley:

1 Like

@Mallorcaredes

Welcome to the community.

Yes I do but it depends on what you are trying to do.

  1. Push a button runs for x then turns OFF.
  2. Timer, runs everyday for x and turns OFF.
  3. If your turn it ON runs for x then turns OFF.

If it is option 1 then :stopwatch: Trigger - Run ON Timer

If it is option 2 then :high_brightness: Smart Light - Entity - Sun Elevation - Ambient & Time Triggers or :timer_clock: Timer
If it is option 3 then :hourglass_flowing_sand: Entity - Run ON Timer

Hope this helps you.

Blacky :smiley:

I am the ultimate bad customer, I always have ideas about improvement :smiley: I also have a bad habit of finding bugs. And I dont have the time to do it myself, just like to ask for themā€¦

That said, if I am allowed, some things would be fantastic to add to this light scene, that is indeed becoming very complex.
Maybe these are achievable with the current setup somehow,

1, home/away state: before you even turn on any light, check if the house (helper) is set to away. This way, I can achieve several things:
-not turn lights on from sensors seeing dogs, curtains, HVAC units etc, saving energy
-I can use this as an automation to kill all lights as I leave the house

2, dynamic lights: color offset only: I like some lights to have a certain color/hue. For example, I designed my kitchen counter lights to also light the glasses in the cupboard. I set them for a pale blue color. When I enable dynamic color, even if I try to use Kelvin, they always go red, making them look like Draculaā€™s pharmacy. Iā€™d like to set a color, and have the dynamic setting offset it to either way by a given amount.

3, more modes: currently we have day mode, night mode, and with the addon, movie mode. Iā€™d love to have more modes, work, party, vacation (random lights), music, etc

4, I know this would be probably impossible, but separate settings for lights (or light groups) in each mode. So have the rgb strip at 60% pale red but the ceiling light at 80% white.

Still it is a very very good blueprint, thank you very much for your work for the community!
Balazs

@Blacky Since installing HA 2024.09.0b1 (maybe 0b0 too) I canā€™t see the Dynamic Lighting Options selector. The documentation is there but not the actual selector.

Wait! Now it has reappeared! I think maybe I needed to restart my HA front-end (app) even though I already did that when told that a new version of the frontend was available.

Yeah, sometimes all your need to do is pull down by scrolling to the top and then pull down. It will then reload it when using the HA app.

Blacky :smiley:

Thanks for getting back to me. I set it to 6 for testing to be fair. I normally use 8, but right now the lights have again turned on in my living room. The sunā€™s out and itā€™s bright enough in the room. I set the maximum to 70 lux and the reported light level is way above that, as you can see in the below screenshot. Why do the lights turn on anyway, I think I am misunderstanding the configuration still?

Any chance you can add a feature for multiple ā€œTime Optionsā€ based on the day? I would like the automation on for different times on the weekends vs weekdays.

Just create two automations?

1 Like

@korlaar

Hi Max,

I have looked at your YAML again and I have tested it here. All works perfectly on option 8. With your settings at a brightness of 140 (above 70 lux) lux the light would not come ON. When I decreased it to below 70lux the light came ON and at < 20 lux the light is 100%.

The thing I noticed in your YAML is you have a light (etc). That is not an entity and you will need to remove it. I did test it with the (etc) and it still worked. Below is your new YAML.

alias: "Lights "
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.aanwezigheid_woonkamer
    light_switch:
      entity_id:
        - light.led_raam_achter_l
        - light.hue_white_lamp_1
        - light.led_raam_achter_r
        - light.led_raam_voor_l
        - light.led_raam_voor_r
    time_delay: 2
    include_light_control:
      - use_transition
    light_transition_on: 5
    light_transition_off: 30
    include_dynamic_lighting: enable_sun_elevation_colour_lux_brightness
    dynamic_lighting_lux_sensor: sensor.hue_motion_sensor_2_licht
    dynamic_lighting_min_lux: 40
    dynamic_lighting_min_colour_temp: 2000
    dynamic_lighting_max_lux: 100
    motion_bypass_lights_on: []
    night_lights_conditions: []
    dynamic_lighting_dead_zone: 5
    dynamic_lighting_boolean: input_boolean.woonkamer_dynamic_lightning_toggle_helper
    dynamic_lighting_heartbeat: 0.25
    dynamic_lighting_max_brightness: 100
    dynamic_lighting_step_value: 1

Not sure why your automation is not working. Maybe try and update the blueprint again to see if that fixes it.

Blacky :smiley:

@dmrosen77

As @fbloemhof suggested it best to make 2 automations. Once you have your automation set up in Automatons 3 dots next to the automation on right, then click duplicate. Readjust your times.

Blacky :smiley:

Hm, weird. I did update the blueprint before coming here. You can ignore the etc, thatā€™s my bad ā€“ I felt like shortening my YAML, it just stands for et cetera. Hereā€™s the full YAML (note I changed the lux sensor to a different one, but that doesnā€™t help):

alias: Living room lights
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.aanwezigheid_woonkamer
    light_switch:
      entity_id:
        - light.led_raam_achter_l
        - light.hue_white_lamp_1
        - light.led_raam_achter_r
        - light.led_raam_voor_l
        - light.led_raam_voor_r
        - light.led_voor_inbouwkast
        - light.led_voor_zijraam
        - light.led_zijkant_l_2
        - light.led_zijkant_m
        - light.led_zijkant_r
        - light.led_lamp_10
        - light.tradfri_bulb_11
        - light.hue_white_lamp_1_3
    time_delay: 2
    include_light_control:
      - use_transition
    light_transition_on: 5
    light_transition_off: 30
    include_dynamic_lighting: enable_sun_elevation_colour_lux_brightness
    dynamic_lighting_lux_sensor: sensor.hue_motion_sensor_3_licht
    dynamic_lighting_min_lux: 30
    dynamic_lighting_min_colour_temp: 2000
    dynamic_lighting_max_lux: 130
    motion_bypass_lights_on: []
    night_lights_conditions: []
    dynamic_lighting_dead_zone: 5
    dynamic_lighting_boolean: input_boolean.woonkamer_dynamic_lightning_toggle_helper
    dynamic_lighting_heartbeat: 0.25
    dynamic_lighting_max_brightness: 100
    dynamic_lighting_step_value: 1

Is there a way I can better debug this? The trace is huge. Iā€™m a developer but this is giving me a headache haha. I can see in the trace that the lights are being turned on. Iā€™ve also found the step in which the brightness is calculated, but unfortunately Home Assistant doesnā€™t seem to log the individual variables used in this template.

@korlaar

Hi Max,

This can be frustratingā€¦ sorry to hear you having trouble with it :pensive: The trace will only show you the Iteration stepsā€¦ what brightness and transition is being applied on each heartbeat.

I used your YAML you provided (current one). The only things I changed are the trigger, lights (added 3 lights in), LUX sensor and the toggle helper. It all worked perfectly. So lets say your settings are all good.

Lets try a few things to work out what it may be!

  1. The automation is being triggered so we know that works but if you like create another toggle helper and add that entity to your trigger (copy paste the entity ID in). That way you can easily run the automation. You will know when you toggle it ON it is ON.

  2. Try One light you know that works and know that brightness can be changed in home assistant. Edit: You can also try not using dynamic lighting (disable it) and turn you light ON and OFF with the automation changing the brightness value each time in the Light Control. Check you lights are responding to your set points.

  3. This is where I think it may beā€¦ your lux sensorā€¦ you tried another one but do you have a temperature sensor? It is numeric state so it will work with temperature sensor or any sensor that has a number value. If you got one copy and paste the entity ID into the input. You may have to adjust your LUX settings to suit the temp sensor.

  4. The Dynamic Lighting - Toggle Helper this should be all good but make sure you are only using it in this blueprint and nothing else.

Hopefully you will find what is the problem.

Blacky :smiley:

Hello everyone,

Iā€™ve had a problem with the lighting control in my childrenā€™s room for some time now, which I canā€™t solve despite intensive troubleshooting. Perhaps someone from the community can help me or give me some hints as to what the problem might be.

Problem:

The light in the childrenā€™s room switches on unintentionally every night at 0:33 am. Sometimes at 0:45 even though there has definitely been no movement. I canā€™t see any logic behind these times, nor do I have any other automations that include these times. However, I can see in the log that it is often these two times when the light comes on unintentionally.

Setup:
Hardware: Identical sensors (Philips Hue) and lamps (Ikea) in several rooms, but the problem only occurs in the childrenā€™s room.

Troubleshooting steps so far:
Automations checked: Automations have been checked multiple times and configured the same for all rooms.
Light sensors tested: The sensors measure correct values and there is no obvious reason for the light to turn on.
Debugging: system_log.write has been integrated into the automations, but the logs show no clear indication of the problem.
Other rooms tested: Everything works as desired in other rooms with identical configuration.
I rule out a hardware defect on the part of the light bulb because I was able to use the light bulb reliably in scenarios with the Ikea gateway for a long time before I switched to Home Assistant.

Here is the affected automation for the childrenā€™s room:



alias: Sensor Light Kinderzimmer
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.motion_sensor_kinderzimmer_belegung
    light_switch:
      entity_id:
        - light.deckenlicht_kinderzimmer_licht
    include_dynamic_lighting: enable_sun_elevation_colour_brightness
    dynamic_lighting_min_colour_temp: 2200
    dynamic_lighting_max_colour_temp: 3500
    bypass_auto_off_delay: 1
    ambient_light_sensor: sensor.motion_sensor_kinderzimmer_beleuchtungsstarke
    dynamic_lighting_lux_sensor: sensor.motion_sensor_kinderzimmer_beleuchtungsstarke
    time_delay: 10
    include_sun: sun_disabled
    include_ambient: ambient_enabled
    ambient_light_options: ambient_light_option_disabled
    include_night_lights: night_lights_disabled
    include_night_light_control:
      - use_colour_temperature
    night_light_colour_temperature: 2000
    night_light_transition_on: 2
    night_light_transition_off: 10
    night_lights_conditions: []
    dynamic_lighting_min_brightness: 20
    dynamic_lighting_heartbeat: 0.5
    dynamic_lighting_min_lux: 20
    include_bypass: []
    motion_bypass_lights_stop: []
    motion_bypass_lights_on: []
    night_time_delay: 2
    light_colour_temperature: 3500
    include_light_control: []
    dynamic_lighting_step_value: 8
    dynamic_lighting_dead_zone: 14
    include_time: time_enabled
    after_time: "07:30:00"
    before_time: "20:00:00"
    night_lights_entity_state: []
    dynamic_lighting_sun_elevation_start_falling: 30
    ambient_light_high_value: 50
    ambient_light_value: 20
    additional_actions:
      - service: system_log.write
        data:
          message: Sensor Light Kinderzimmer automation triggered
          level: debug
    dynamic_lighting_boolean: input_boolean.toggle_helper_dynamic_lighting_kinderzimmer
    include_night_light_colour_control: use_colour_temperature

Questions:

Why is the childrenā€™s light turning on unintentionally even though the automation is configured correctly?
Are there specific logs or debugging tools that I should enable to better diagnose the problem?
Are there any known issues or bugs with Home Assistant that could cause such behavior?
Has anyone had similar issues and can provide tips on how to resolve this?

I would appreciate any help or advice as the problem is getting very frustrating.

Many thanks in advance!

I see the lux value in the blue print to turn the lights on and off based on the brightness of the room but is there an option to skip the turning the light on if the room is already bright enough?

@8lub

Thank you for taking the initiative to try and resolve it on your own before reaching out for assistance.

It seems like youā€™ve already tried several solutions, so letā€™s go through them one by one.

It works in the other rooms but not in the childrenā€™s room. Since all automations are based on the same blueprint, and youā€™re using the same settings, we know the blueprint is functioning properly and isnā€™t the issue. Iā€™ve also checked your YAML, and itā€™s set to run only between 7:30 am and 8 pm.

So, we can rule out the blueprint and automation settings as the cause.

Good point, but since you have time restrictions set, it canā€™t run at 0:33 am or 0:45 am. So, itā€™s not the lux sensor causing the issue.

Do you have a trace line at 0:33 am or 0:45 am when the light turns on, showing the trace line actually triggering the light? I wouldnā€™t expect to see one, but check this the next time it happens.

Great, this confirms again that the blueprint is working correctly and the setup is identical across rooms.

:thinking: Just because it worked before doesnā€™t entirely rule out the possibility. Was something else triggering it back then? Is this light bulb connected to anything else? If you swap it to another room with the same blueprint, does it still turn on at 0:33 am or 0:45 am? Maybe Home Assistant isnā€™t fully controlling it? Ikea gateway? It could just be that light bulb is faulty now. Can you factory reset it?

I would focus on the actual light bulb. There could be other factors at play, such as hidden triggers or overlapping automations. It might be worth reviewing all related automations and integrations.

Also, check the Logbook to see what triggered the light. You can use the Trace feature in automations to follow the exact flow and see what caused the light to turn on.

If the same brand of light works correctly in other rooms, it might not be an issue with Home Assistant. Check if the problematic bulb is running the same firmware version as the others, if possible.

I havenā€™t encountered this specific issue before, but itā€™s possible someone else has.


Hopefully, this helps you resolve the issue. Let us know what you find out.

Blacky :smiley: