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

@Sjekke1

For now you can use scenes to do this but it is on the list.

Blacky :smiley:

@JkJ076

Looks like it is because you are using scenes with the ambient light with ā€œAmbient Light Sensor - Site Conditionsā€ is yes and it need to see an entity state. It cant see a scene state. Can you please put one entity in ā€œLights - Switches - Scenes - Scriptsā€ and test it for us.

Let us know how you go.

Blacky :smiley:

It should handle a HA restart already built in. Let us know if you find a bug.

Your welcome and thanks for your kind words.

Blacky :smiley:

This has been fixed, please try again.

Blacky :smiley:

Hi all, everything is back up and running, please try again.

Thanks for your patience.

Blacky :smiley:

1 Like

@rlems

Sometimes when we have 2 or more triggers (motion sensors) we need to group them to make it work better. Click Here to see how we set up groups.

We can set up The Automation Link in the bathroom blueprint and the by-pass in this blueprint. Please follow these steps Click Here

Nice one and thanks for your kind words.

Blacky :smiley:

1 Like

Ikea tradfri Motion sensors no longer trigger this automation since the 2023.12.2 or .3 Update from HA anymore, no matter if i use ZHA or Z2M, ive reinstalled HA and changed the language to english, still nothing. Got any idea why? When i create a automation via drag and drop it works.

Just installed the newest HA Update, works again :slight_smile:

Hi Blacky,

Will night-lights also work when you have Dynamic lighting enableā€™d?
Or does the dynamic lighting makes night-lights not work?

@Asmod4n

Nice one, thanks for the update.

Blacky :smiley:

@A-Little-late

Night lights will work but Dynamic lighting will not work in night lights. The reason I set it up like this as at night we know it is always dark. If you would like some lighting control in night lights then select this in the ā€œNight Lights - Use The Light Control Optionsā€.

Dynamic lighting should not effect night lights and it should work.

Blacky :smiley:

1 Like

Hi, thanks for the automation, it is great!!
I have the opposite problem
I use automation in several situations, for example in bathroom lights. Sometimes I need more time with the lights on and I have a by-pass, I use mode ā€œ3 - Enable the By-pass - Keep the lights current stateā€ to keep the lights on until I leave the bathroom.
The problem occurs that when I turn off the lights and turn off the by-pass (the by-pass turns off automatically when I turn off the lights since it is more convenient), the automation runs again and turns the lights back on since the sensor movement is on.
Is there any chance the automation works only the first time it detects motion? Or does it not run when you deactivate the by-pass until it detects new movement?

I think I have found the solution, commented the following text in blueprint:

#- platform: state
#  id: t8_stop
#  entity_id: !input motion_bypass_lights_stop
#  from: 'on'
#  to: 'off'

I donā€™t know if it could have any execution problems but it seems to work

ā€¦so then how do you specify a different Color Temperature when using Dynamic Lighting , for example when the sun goes below the horizon in the evening?

Great blueprint. Thanks for the efforts.

I am moving my node red automations back in to HASS, and this is one of them. I have everything covered other than:

Being able to turn a light on or off in a motion location (eg a bathroom/hall) from my dashboard (so toggling the light on/off entity) and it still following the automation, still coming on at different brightness day/night for a certain duration as per the blueprint. I guess I need to make the ā€˜light turning onā€™ become one of the triggers?

How might I do that without setting up a different automation for that? Am I missing something?

Hi,

Thank you for your continued effort on this automation @Blacky. Things are running well here except for a couple of LED strips with Warm White/Cold White (temperature) control. The light entity is working perfect when controlling it manually - but neither the brightness value or temperature value is controlled by the automation. I have it set to have one brightness/temperature during daytime (100%, 3500K) and one brightness/temperature during nighttime (10%, 2700K).

The LED strip is turned on/off as expected but as mentioned the brightness/temperature is not adjusted. Any hints would be greatly appreciated.

Hereā€™s the config for the light entity (combines a CW and a WW strip into 1 light entity with temperature/brightness control):

ledstrip_bad2e_tak:
  friendly_name: "LED Stripe CCT Bad 2e Tak"
  value_template: >-
    {{ ( state_attr('light.dmx_1_61_1_bad2etg_tak_ww', 'brightness') | int(0) +
        state_attr('light.dmx_1_61_2_bad2etg_tak_cw', 'brightness') | int(0) ) > 0 }}
  level_template: "{{  states('input_number.led_bad2e_tak_brightness')  | int(0)   }}"
  temperature_template: "{{  states('input_number.led_bad2e_tak_temp') | int(500) }}"
  set_level:
    - service: input_number.set_value
      target:
        entity_id: input_number.led_bad2e_tak_brightness
      data:
        value: "{{ brightness | int(0) }}"
    - if:
        - condition: numeric_state
          entity_id: input_number.led_bad2e_tak_brightness
          above: 128
      then:
        - variables:
            perc_above_mid: "{{ ((states('input_number.led_bad2e_tak_brightness') | int(0) - 128) / 127) | float(0) }}"
        - if:
            - condition: numeric_state
              entity_id: input_number.led_bad2e_tak_temp
              above: 327
          then:
            - variables:
                warmest: "{{ (500 - (perc_above_mid * 173)) | int(500) }}"
            - if:
                - condition: numeric_state
                  entity_id: input_number.led_bad2e_tak_temp
                  above: 0
                  value_template: "{{ (float(state.state) - warmest) | int(0) }}"
              then:
                - service: input_number.set_value
                  target:
                    entity_id: input_number.led_bad2e_tak_temp
                  data:
                    value: "{{ warmest | int(500) }}"
        - if:
            - condition: numeric_state
              entity_id: input_number.led_bad2e_tak_temp
              below: 327
          then:
            - variables:
                coldest: "{{ (153 + (perc_above_mid * 174)) | int(153) }}"
            - if:
                - condition: numeric_state
                  entity_id: input_number.led_bad2e_tak_temp
                  below: 0
                  value_template: "{{ (float(state.state) - coldest) | int(0) }}"
              then:
                - service: input_number.set_value
                  target:
                    entity_id: input_number.led_bad2e_tak_temp
                  data:
                    value: "{{ coldest | int(153) }}"
    - service: light.turn_on
      target:
        entity_id: light.ledstrip_bad2e_tak
  set_temperature:
    - service: input_number.set_value
      target:
        entity_id: input_number.led_bad2e_tak_temp
      data:
        value: "{{ color_temp | int(500) }}"
    - if:
        - condition: numeric_state
          entity_id: input_number.led_bad2e_tak_brightness
          above: 128
      then:
        - variables:
            delta_perc_mean_temp: "{{ (((( (states('input_number.led_bad2e_tak_temp') | int(500) - 152) / 348) - 0.5) | abs ) * 2) | float(0) }}"
            max_brightness: "{{ ( (1 - delta_perc_mean_temp) * 127 + 128 ) | int(0) }}"
        - if:
            - condition: numeric_state
              entity_id: input_number.led_bad2e_tak_brightness
              above: 0
              value_template: "{{ (float(state.state) - max_brightness) | int(0) }}"
          then:
            - service: input_number.set_value
              target:
                entity_id: input_number.led_bad2e_tak_brightness
              data:
                value: "{{ max_brightness | int(0) }}"
    - service: light.turn_on
      target:
        entity_id: light.ledstrip_bad2e_tak
  turn_on:
    - variables:
        ww_ratio: "{{ ((   states('input_number.led_bad2e_tak_temp') | int(500) - 152 ) / 348 ) | float(0) }}"
    - service: light.turn_on
      target:
        entity_id: light.dmx_1_61_1_bad2etg_tak_ww
      data:
        brightness: "{{ (2 * states('input_number.led_bad2e_tak_brightness') | int(0) * ww_ratio)        | int(0) }}"
    - service: light.turn_on
      target:
        entity_id: light.dmx_1_61_2_bad2etg_tak_cw
      data:
        brightness: "{{ (2 * states('input_number.led_bad2e_tak_brightness') | int(0) * (1 - ww_ratio) ) | int(0) }}"
  turn_off:
    - service: light.turn_off
      target:
        entity_id: light.dmx_1_61_1_bad2etg_tak_ww
    - service: light.turn_off
      target:
        entity_id: light.dmx_1_61_2_bad2etg_tak_cw

Hereā€™s a couple of screenshots from the automation:


That got it. Thank You so much! I appreciate your help!

@jccf07

Yes this is how the automation is designed. When you turn OFF a bypass it will analyse the site conditions and react to them. I tried to think of every option depending on whatever you select, and there are a few option. If we donā€™t do this the light will never come ON again until the motion is cleared and triggered again. That was a problem we had when developing it especially if you have presence sensors that stay ON detecting presence very well.

You can do this but it will not work correctly. The best way would to swap out your switch on the wall and make it toggle the bypass and set option 1 turn ON. This way when you turn on the wall switch the light will come ON and stay ON. You could set the auto off so if you forget to turn it OFF it will do it for you. The problem we see is when you turn the bypass OFF and motion is detected the light still remain ON as that is what we are asking the automation to do (turn light ON when Motion is ON). It will however turn the light OFF once motion is cleared and the time delay has passed but I get it, it messes with our heads because we are expecting it to turn OFF when we turn it OFF.

Anyway if it works for you then that is all that matters.

Blacky :smiley:

@ObraDinn

Currently you canā€™tā€¦ but no spoil alerts.

Blacky :smiley:

1 Like

@richsimpson

You canā€™t do that it will not work correctly. Canā€™ have a trigger turn on a light and also have that light as a trigger because every motion event turns the light ON and then the light triggers the automation again, because the light is the trigger it need to go OFF but it just stays ON never turning the light OFF :thinking: :disappointed:

If you do it through your dashboard you could make a helper toggle add it to bypass 1. Have bypass auto OFF turn your helper toggle OFF automaticity in X amount of time like your time delay time or what ever you like. When when the bypass goes OFF and motion is detected the light will stay ON if no motion is detected the light will turn OFF.

Hope this helps

Blacky :smiley: