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

Never understood why with the emphasis on the visual editor and making the interface more friedly, users (novices) like me have to go into configuration.yaml to set so many things. Things like binary sensors, home radius, etc. etc.

I have tried to keep it so it works for everyone. Currently to use only binary sensor works well if and when we need to have a group for the trigger. So sometimes changing one sensor is better than changing the code because then you can upgrade with ease.

There are just so many options in HA.

Hope you understand.

Blacky :smiley:

I wasn’t commenting on your automation. I was commenting on how many things need to be manually put in that master config file as opposed to developers having a function to create a binary sensor, ask the right questions and do the work for you.

O ok thanks Harry :+1:

Thank you very much, it worked now I understand better of templates :slight_smile:

1 Like

Thank you for the reply. This is a common issue with Ikea lighting (confirmed in HA Discord) and people use the same solution in custom motion sensor light automations (setting up on/off status reporting in MQTT and periodically turn off lights when input boolean off)

@daniellwdb

Hi Daniell

No problem. :smiley:

Input Boolean

If your not sure how to do this :thinking:, below is an example.

First we need to create a “input boolean”. To do this follow these steps.

  1. First go to Settings / Devices & Services / click on the “Helpers” tab / click “+ CREATE HELPER” and select “Toggle”.
  2. In the name area, enter a name that best suits you. For this example we will put “Ikea Light Helper”. Then click save.

Now you will have and “input boolean” helper called “Ikea Light Helper” with an entity id of “input_boolean.ikea_light_helper” :+1:

Switch Template

To toggle this ON and OFF in the sensor light automation we will need to create a switch that controls the Ikea Light Helper( “input boolean”) that mimic it. To do this we can create a switch template. You will need to put the code below in your “configuration.yaml” file.

switch:
  - platform: template
    switches:
      ikea_light_switch_helper:
        friendly_name: "Ikea Light Switch Helper"
        icon_template: mdi:light-switch
        turn_on:
          service: homeassistant.turn_on
          target:
            entity_id: input_boolean.ikea_light_helper
        turn_off:
          service: homeassistant.turn_off
          target:
            entity_id: input_boolean.ikea_light_helper

In the above code:

  • The "ikea_light_switch_helper” change to your liking. (this is the entity id name it will create)
  • The Icon change or remove if you like.
  • The "friendly_name: “Ikea Light Switch Helper” change to your liking.
  • You will need to replace the “input_boolean.ikea_light_helper” to the “input boolean” entity id you created above (you name may be different so you need to check this).

Once done you will then need to restart HA for the switch to take affect. Then add your new switch (“Ikea Light Switch Helper”) into “Lights - Switches - Scenes” and if using night lights into “Night Lights” :tada:

Now you can use your “input boolean” helper called “Ikea Light Helper” above to “(setting up on/off status reporting in MQTT and periodically turn off lights when input boolean off)” as it will turn ON and OFF (act as a light should) and be 100% accurate not like your Ikea lights. :wink: :partying_face:

Hope this help, and if you have any question please ask.

Blacky :smiley:

1 Like

I make both at the same time, so i dont know :slight_smile: Thanks for this great work

1 Like

Ok thanks for letting us know.

is it possible to incorporate an condition like an input boolean of binary sensor, with state selection.

the last room I have to incorporate this blueprint is my bedroom but I have a sensor that let’s me know if there is someone in bed and if that’s the case then the light should not come on.

and would love a turn off trigger so when there is no motion anymore that it will turn of instead of a timer.

@edi023

Maybe try using the bypass with your bed sensor, then in the bypass select “2 - Enable the By-pass - Turn lights OFF”, then select “Trigger Sensor By-pass - Time Delay” and set it to “0”.

When you do the bypass with your bed sensor make sure you have an OFF delay so if you get out of bed the light stays OFF for X amount of time. Maybe enough time to go to the bathroom and back + some.

I think the best way in the bedroom is to use a button next to your bed or if you put your phone on “do not disturb” (In a iPhone it is “Focus” state “ON”) the bypass comes ON. Then you don’t need a bed sensor. Just throwing it out there.

Hey. Thanks for your Blueprint!!
Looks pretty useful. Im fairly new to HomeAssistant. I have a ConBeeII Zigbee stick and have connected a Tradfri Motion sensor.
Now i want to use your blueprint to execute a configured scene. The scene itself works without any problems when i trigger them manually.
The configured blueprint looks like this:

alias: FaucetLight
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.kitchenmotion_motion
    end_scenes:
      - scene.faucetoff
    time_delay: 0.5
    include_light_control:
      - use_brightness
    include_sun: sun_disabled
    include_ambient: ambient_disabled
    ambient_light_sensor: sensor.lumi_lumi_sensor_motion_aq2_illuminance
    light_switch:
      entity_id: scene.faucet100
    light_transition_on: 2
    light_transition_off: 2
    include_bypass: bypass_enabled_turn_on
    ambient_light_options: ambient_light_option_disabled
    include_night_lights: night_lights_disabled

But this does not work. I thinks this a just a really basic example without any special configurations.
Any idea whats going wrong?

@jigl

Hi David, firstly welcome to the community :+1:

Thanks for your question and providing your YAML of the automation :smiley: It makes it easy for me to see what is going on.

It looks like the problem is within the by-pass. You have selected to enable the by-pass but you haven’t entered in a switch for the by-pass. So you have 3 options you can do.

  1. Enter a switch for the by-pass.
  2. If you don’t have a switch you can create one and enter it in. See the FAQ on how to do this.
  3. Disable the by-pass.

Hopefully this will resolve your automation :crossed_fingers:

On another note. Looks like you would like to use transition as you selected 2 seconds. In your light control you have selected to use brightness. When using scenes, brightness is normally done within the scene as you can select different brightness for every light. I would suggests you control the brightness in the scene and untick to use brightness. If you would like to use transition then you would select to use transition.

Hope this helps, and let us know how you go.

Blacky :smiley:

I’m getting the following error when transition is disabled:

Transition value 0 is not valid.

Is it a known issue? Why does it try to use the transition when it’s disabled? It started to occur after I updated from 2.8 to 4.2 blueprint version.

If I enable the transition option and set the delay to 0.1, it works fine again.

@JetSerge

Hi, thanks for letting us know :+1:

Yes I am aware of it, you are probably using zigbee2mqtt. This is one think I have on my list to fix and will probably be done in the next release.

For now enable the transition option and set the delay to 0.1 and stay tuned for the bug fix.

Thanks again.

Blacky :smiley:

1 Like

Hey Blacky. Thank you for your support. You were absolutely right.
Now it works!
Thanks!

1 Like

Hello
Would it be possible that “Trigger Sensor” is extended that also a light can be used as trigger.

Background:
The light on my toilet can be activated via:

  • Contact sensor
  • Motion Sensor
  • HomeKit
  • Shelly Web Page
  • Button click

Contact and Motion is not a problem, but if someone turns on the light directly via e.g. Shelly Page, it will not go off automatically anymore.

I was able to build an automation for myself where that works, but this one is significantly better.

That is my blueprint

PS: Also, an option for the alarm panel would be cool :slight_smile:

@TheBigNeo

Hi

Firstly some house keeping. In this post we would like to stay on topic and not have everyone post their blueprints. I hope you can understand. I know this was not your intent but would you be so kind to remove you blueprint code :wink:. If you would like help on it you can create your own post, or you can always private message me. I do help a lot of people privately. Thank you.

To your questions.

In your toilet, could you confirm what sensors are you using to turn a light ON and do you have a toilet exhaust fan? Sensors may be;

  • Motion.
  • Contact.
  • etc

HomeKit, shelly web page and button click I am assuming this is just turning the light ON manually.

From knowing that I will be able to assist further.

I have also released and new blueprint that can work as an add on to this blueprint. Using this will allow you to have an alarm option. It can take a snapshot of your lights when a alarm has be activated, disable automations, turn lights ON or OFF and return it back to it’s original state once the alarm is cleared. It can also do so many other things. It all depends on what you are trying to achieve. If it is to just disable this automation when a alarm is in a particular state then this can be done through the by-pass. If you can let us know what you would like to achieve I can also help you here.

Blacky :smiley:

I been using your blueprint for awhile and it works great, but I have recently been getting these errors

Logger: homeassistant.components.homeassistant.triggers.numeric_state
Source: components/homeassistant/triggers/numeric_state.py:185 
Integration: Home Assistant Core Integration (documentation, issues) 
First occurred: 11:24:02 (16 occurrences) 
Last logged: 11:24:02

Error in 'Kitchen Motion Light' trigger: In 'numeric_state' condition: no entity specified
Error in 'Hall Motion' trigger: In 'numeric_state' condition: no entity specified
Error in 'Landing Motion' trigger: In 'numeric_state' condition: no entity specified
Error in 'Back Garden Sensor Light' trigger: In 'numeric_state' condition: no entity specified

any ideas whats wrong?

here is one of my automations

alias: Kitchen Motion Light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.kitchen_motion_sensor_occupancy
    include_light_control: dont_use_brightness
    include_sun: sun_enabled
    time_delay: 1.5
    end_scenes:
      - scene.kitchen_motion_light_off
    include_night_lights: night_lights_disabled
    light_switch:
      entity_id: scene.kitchen_motion_light_on
    sun_elevation: 0
    include_bypass: bypass_enabled_stop
    motion_bypass: light.kitchen_lights
    light_transition_on: 0.5
1 Like

@andyblac

Hi Andy, thanks for letting us know :+1:

Let me have a look at this.