💡 Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

Thanks! Yes it would be cool to have the granularity on the lux timing as I quite like having the Time Delay as low as possible so the lights are on as little as possible if everyone leaves the room.

That said if you add much more complexity to this blueprint it’ll become Turing-complete :slight_smile:

Is there a way to use a helper entity to set what scene is activated by the blueprint?

I have a couple of lighting scenes in my office depending on whether I’m working, gaming etc, but there’s no set times or days when I might be doing any given thing.

I’m wondering if I can get the blueprint to reference a helper entity to decide which scene it activates on motion. Then I can set the helper entity based on various other factors.

1 Like

I’m interested in this too as I want to have different scenes for outside lighting for certain days of the year. So most of the year it would use scene.front_motion_normal but around Halloween it would use scene.front_motion_halloween scene (this is just one of a number of occasion related scenes).

I’d go further and say I’d also like the ability to change the “idle” turn off scene too to allow me to have ambient lighting when motion isn’t detected but only between certain times. So I could have an automation set the scene helper to scene.front_lightsoff_normal or scene.front_ambient_normal depending on the time of day but then on Halloween I may wish to use scene.front_ambient_halloween instead.

I had considered having automations adjusting the content of the scenes rather than switching between scenes but this feels really kludgy.

1 Like

Yes, as long as you are on Version 4.3 and above. The blueprint has 2 different light settings. I call them “Light” or “Normal Lights” and “Night Lights”. Just because they are called “Night Light” doesn’t mean we have to use them for night time. They could be used for your “gaming”. So you could have “normal lights” for “working” and then use the “Night Lights Conditions” + “Enable entity state option (your helper)” for gaming and select a different scene for your gaming ( = night lights in the blueprint). If you would like more than 2 different light selections then you would need to have 2 + automations and use the by-pass and make sure the helper also toggles the by-passes ON and OFF so you will switch (disable / enable) the automations to your requirements.

Hope this helps

Blacky :smiley:

1 Like

This would be very similar to the my post above but your helper for night lights would be triggered on a calendar event.

I will put this on the list of suggestions.

Having 2 set of lights “Normal Lights” and “Night Lights” with all the different options is a lot of code. On the areas we need more than 2 set of lights I suggest to have 2 different automations. You can set “The Time Options” for this or you can use the by-pass.

1 Like

Hi! Thank you for this awesome blueprint. I have some troubles using it with my combined motion and presence sensor. Im using template like this

template:
  - trigger:
      - platform: state
        entity_id: binary_sensor.motion_sensor_1fe6 #PIR Motion Sensor
      - platform: state
        entity_id: binary_sensor.0x54ef4410006dcdbb_presence #Aqara FP1 Main Presence Entity
    binary_sensor:
      - name: Bathroom Human Presence
        device_class: occupancy
        delay_off:
          seconds: 5
        icon: >
          {% if is_state("binary_sensor.bathroom_human_presence", "on") %}
            mdi:motion-sensor
          {% else %}
            mdi:motion-sensor-off
          {% endif %}
        state: >
          {% if is_state('binary_sensor.motion_sensor_1fe6','on') %}
            on
          {% else %}
            {% if is_state('binary_sensor.0x54ef4410006dcdbb_presence','off') %}
              off
            {% else %}
              {{ states('binary_sensor.0x54ef4410006dcdbb_presence') and states('binary_sensor.bathroom_human_presence') }}
            {% endif %}
          {% endif %}

for which I can’t apply unique id. So automation didn’t work and I gave this error down here

Error rendering variables: UndefinedError: 'dict object' has no attribute 'entity_id'

Could you please explain me how I can make it work with this type of sensor? Thank you!

@und3f1ned

Firstly welcome to the community :+1:

Try it this way by adding your motion and presence sensor into a helper group. It is a cleaner way.

How to set up group sensors please Click Here

Let us know how you go.

Blacky :smiley:

Thanks @Blacky - great ideas to go with your great blueprint. I’m always amazed at how responsive and engaged you are. A real shining light in the community.

I already use night mode as well atop for it original purpose, also there are about 4-5 different occasions during the year where I want themed lighting.

However I’ve had a eureka moment after slept on it and thinking about your comments regarding minimising complexity within the blueprint (which I think is absolutely the right call),. What if the blueprint allowed scripts to be selected as well in places where it currently allows scenes to be specified?

If a scene is specified it would be activated as usual, whereas if a script is specified, the script would be invoked. Any complexity about selecting scenes could be handled as user serviceable elements in the “roll your own” scripts.

Really nice blueprint, thank you for the work and time.
I made my own automation like this with the addition to loop while water is consumed.
This is so the light don’t turn off when showering.

Just passing the thought if someone’s looking to expand the blueprint :wink:
Code I used:

  - if:
      - condition: numeric_state
        entity_id: sensor.water_meter_current_usage
        above: 1
    then:
      - delay:
          hours: 0
          minutes: 10
          seconds: 0
          milliseconds: 0
      - repeat:
          count: "3"
          sequence:
            - service: light.turn_off
              data: {}
              target:
                area_id: bathroom

That is unbelievable.

@Adec

Hi Adrian

Thanks for your kind words :blush:

Are these themes for things like Xmas, Halloween etc were you would like a timed schedule? Example Xmas = Between 1st Dec to 26 Dec you would like the lights to be ON from 6pm to 11:30pm with Xmas theme.

I am working on something at the moment, it is not scripts but you may like it. It is realy for the HA enthusiast.

Thanks, @Blacky!

Unfortunately the newly created group sensor cause the same error. So I decided to delete automation and blueprint and reimport blueprint again. Then restarted HA. But this does not work ether.

I’ve got the same error again and again

Logger: homeassistant.components.automation.hallway_light_on_presence
Source: components/automation/__init__.py:608 
Integration: Automation (documentation, issues) 
First occurred: 10:38:29 (1 occurrences) 
Last logged: 10:38:29

Error rendering variables: UndefinedError: 'dict object' has no attribute 'entity_id'

All newly created automations with this blueprint cause the same error. Even with a simple motion sensor added. That’s very strange behaviour, because all earlier added automations was working.

I’m on a latest stable HA version.

@und3f1ned

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.

That for newly created group of lights

alias: "HALLWAY: LIGHT on presence"
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.hallway_presence
    light_switch:
      area_id: koridor

That with only one simple sensor

alias: "GUESTROOM: LIGHT on presence"
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.0x54ef4410005a9a43_occupancy
    light_switch:
      area_id: gostinaia

All area ID’s are correct and using with other automations.

@und3f1ned

You can’t use and “Area” or “Devices” in "Lights - Switches - Scenes " and or “Night Lights”

Click Here to see how to expand down under the heading :bulb: Lights - Switches – Scenes :wink:

Let us know how you go.

Blacky :smiley:

ouch, pardon me, I’m so dumb that I missed it in the faq
Thank you!

@und3f1ned

All good, I am glad it was an easy fix :wink: thanks for asking the question and for getting back to us.

Hope you like the blueprint!

Enjoy

Blacky :smiley:

Yes, that’s exactly it. You’ve really peaked my interest with the thing that you’re currently working on. Can’t wait to hear more.

As an aside, I used to have a lighting automation which took a theme name from a helper as well as text helpers for base names of “ambient”, “motion” and “idle” scenes. If the theme helper was blank - scenes were triggered whose names were in the text helpers. If the theme helper wasn’t blank, the scene names was derived as follows _ - if this scene existed it would be activated, if it didn’t exist just the base scene name would be used.

E.g.

Base scenes:
Idle: scene.porch_off
Ambient: scene.porch_ambient
Motion: scene.porch_motion

At halloween, the theme helper may contain “halloween”. In addition to the normal scenes, I also had scene.porch_motion_halloween defined. In the evening when it got dark, the usual scene.porch_ambient was activated to give warm low-level light (as there’s no theme variant of the scene defined). When motion was detected, scene.porch_motion_halloween was activated to turn all the lights green.

At Christmas, the theme helper may contain “christmas”. In this instance I have only defined an override scene scene.porch_ambient_christmas to give nice christmassy illumination when not triggered but then activates the normal scene.porch_motion when motion was detected.

I had different lighting automations for different areas of the house which all reacted to the house theme and by selectively creating scenes with the appropriate names I could define overrides or not as needed for each area.

1 Like

I have stair lights that I turn on very low at night, and then a motion sensor that raises the brightness when it detects motion, dimming it back to the low level after a certain amount of time. Is there a way to have the “off” state instead be different to enable this use case?

@redmumba I am not sure what your asking for with the “off” state.