You can and you donāt need a script. You can use a scene or a script or just your light entities with no scene or script. It is totally up to you. But if you would like to use a scene or a script it is recommended to add a helper because scenes and scripts have no stateā¦ so in order for the automation to know if the lights are ON it looks at the helper to ensure the smooth operation of the automation.
Hue motion badrum Motion - this is the motions sensor
Aqara Door Sensor Badrum - this is the door sensor
Badrumsensor Grupp - this is the group
Badrumsensor Template - and this is the template sensor
you can see in the video that the door is closed then when I open the door the motions sensor gets triggered and the door sensor closes. The group sensor is on until the motion clear then It changes to off and last the template sensor is always clear.
There is no delay for the door sensor as you can see inte the video.
I set upp the template sensor inte the UI because in the configuration.yaml I get errors when I add it and it dosent work.
Managed to make the template work by changing the code from - platform: state to - trigger: state and it seems to be working now but I still have a problem, the lights still turn off when someone is in the room and the lights wonāt turn off when exiting the room.
I have a problem with your template. In my kitchen i have it turn on 2 different lights, when motion is detected. However, the LED strip under my kitchen cabinets slowly turn on for about .2-.5 seconds and then turn completely off, while the ceiling light turns on as it should. Do you have any idea why that happens?
Sunds very promising with the Bee in the hive automation! Iāve read about it and tried implementing it, but i canāt seem to figure out where to input the code?
Is it a helper? An automation? Should i put it into configuration.yaml, under sensors?
- trigger:
- platform: state
entity_id: binary_sensor.badevaerelse_sensor_dor_aqara_contact
to: "on"
- platform: state
entity_id: binary_sensor.badevaerelse_sensor_dor_aqara_contact
to: "off"
for:
seconds: 10
- platform: state
entity_id: binary_sensor.badevaerelse_sensor_bevaegelse_aqara_occupancy
to: "on"
binary_sensor:
- name: "BadevƦrelse Optaget Sensor"
device_class: occupancy
icon: mdi:account-box-outline
state: >
{{ is_state('binary_sensor.your_door_sensor_here', 'off') and is_state('binary_sensor.your_motion_sensor_here', 'on') }}
I have a radar motion sensor which reports how far movement is awayā¦
It is reported in ālargeā, āmediumā and āsmallā
Is it possible to just use for example the state āsmallā as a trigger, so the lamp only goes on when i am in a small radius?
How could i achieve this?
Thanks!
Iāve been porting over all of my custom AppDaemon automations to this blueprint, and so far Iāve been able to make everything work well. Thank you!
Apologies if this has already been discussed. It appears this topic has so many replies that the site search is kind of broken for it!
I had this set up with my AppDaemon automation for my front motion lights. The requirement was that if the lights were manually turned on at the switch, they stay on bypassing the motion light automation. I was able to do this by:
Creating a toggle helper called āFront Lights Motion is Activeā.
Creating a script that is called as the light turn on action. The script first checks to see if the lights are off, or if the Active helper is set. If it passes, it sets that flag:
alias: Turn On Front Light Motion
sequence:
- if:
- condition: or
conditions:
- condition: state
entity_id: light.front_lights
state: "off"
- condition: state
entity_id: input_boolean.front_lights_motion_is_active
state: "on"
then:
- action: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.front_lights
- action: input_boolean.turn_on
target:
entity_id: input_boolean.front_lights_motion_is_active
data: {}
else:
- stop: Lights are manually controlled
description: Used by motion light automation
Adding a corresponding script to handle turning things off and resetting the flag:
alias: Turn Off Front Light Motion
sequence:
- if:
- condition: state
entity_id: input_boolean.front_lights_motion_is_active
state: "on"
then:
- action: light.turn_off
target:
entity_id:
- light.front_lights
data: {}
- action: input_boolean.turn_off
target:
entity_id:
- input_boolean.front_lights_motion_is_active
data: {}
description: Used by motion light automation
The only downside is that if the light was turned on by motion, and you want to keep it on using only the physical switch, you need to turn it off and on again. But, thatās how it worked in the AppDaemon automation and so far thereās been no complaints.
hey guys, i use a motionsensor in my bedroom, that triggers a light to turn on in my hallway using this blueprint. in some situations the hallway light is manualy turned on by me. if i get motion in my bedroom the light in the hallway turns off after 30 secons cause of the blueprint settings.
is there a way to let the blueprint check if the light is already turned on and if so to not run the automation to turn it off?
In your group you should only have your motion sensor and your bee in the hive sensor. Donāt add the door sensor. Then the group should be the only entity in the trigger input in the blueprint.
This is strange as your ceiling light stays ON. Maybe it is the LED controller with the blueprints light control. Try and disable Use Brightness and Use Transition and see if that works. If so then add one back in at a time to see what one causes the problem.
The below code goes into your configuration.yaml. The heading ātemplate:ā is where you put all your template sensors under. Normally when you have a occupancy sensor they can detect you well as long as they can see you in line of sight.
template:
- trigger:
- platform: state
entity_id: binary_sensor.badevaerelse_sensor_dor_aqara_contact
to: "on"
- platform: state
entity_id: binary_sensor.badevaerelse_sensor_dor_aqara_contact
to: "off"
for:
seconds: 10
- platform: state
entity_id: binary_sensor.badevaerelse_sensor_bevaegelse_aqara_occupancy
to: "on"
binary_sensor:
- name: "BadevƦrelse Optaget Sensor"
device_class: occupancy
icon: mdi:account-box-outline
state: >
{{ is_state('binary_sensor.badevaerelse_sensor_dor_aqara_contact', 'off') and is_state('binary_sensor.badevaerelse_sensor_bevaegelse_aqara_occupancy', 'on') }}
You would create a template binary sensor and use the state āsmallā then use that template binary sensor only as the trigger.
To create a Template binary sensor, follow these steps:
Navigate to Settings > Device & Services > Helpers tab at the top.
Click the Create helper button.
Select Template and then choose Template a binary sensor.
Next, provide a Name and Device class (motion?) of your choice. If applicable, you can link this template to an existing device so it appears under that deviceās details.
In the State template field, add the code below, replacing your_radar_motion_sensor_entity_id_here with your entity ID.
Hi Andrew, you can also do it by creating a template binary sensor and add it into the bypass but you will have the same problem, that isā¦ if the light is ON you will have to turn it OFF and back ON again for it to turn ON the binary sensor.
template:
- trigger:
- trigger: state
entity_id: light.your_light_switch_here
to: "on"
id: "t1"
- trigger: state
entity_id: light.your_light_switch_here
to: "off"
binary_sensor:
- name: "Manual Light Switch"
icon: mdi:cog-pause
state: >
{% if trigger.id == 't1' and trigger.to_state.context.parent_id is none %}
on
{% else %}
off
{% endif %}
You can but it is not perfect, that isā¦ if the light is ON you will have to turn it OFF and back ON again for it to turn ON the binary sensor. Once you create the binary sensor you then add it to bypass option 1 as that will turn the light ON.
template:
- trigger:
- trigger: state
entity_id: light.your_light_switch_here
to: "on"
id: "t1"
- trigger: state
entity_id: light.your_light_switch_here
to: "off"
binary_sensor:
- name: "Manual Light Switch"
icon: mdi:cog-pause
state: >
{% if trigger.id == 't1' and trigger.to_state.context.parent_id is none %}
on
{% else %}
off
{% endif %}
In the bee in the hive example I have the below statement. It says once you create this sensor (bee in the hive) then group with you motion sensor and add the group to the trigger.
Iāll keep refining the post to make it as clear as possibleā¦ thank you so much for your feedback, it really helps! Sorry if my earlier explanations werenāt quite clear, but I think weāre on the same page now, and hopefully, youāve got it working."
Hello, I like your blueprint, i am having a hard time getting this to work without issue. The different items not working, and i have to manually run it after ha reboot or if i run a scene or manually change the lights.
I have changed a few things. Note; because you are using dynamic lighting option 1 if you change the brightness and normal lights are active then dynamic lighting will change the brightness to suit.
Removed script in Scenes - Scripts To Turn OFF. Because you are using light entities you donāt need a end scrip to turn OFF you lights.
In Ambient condition set your LUX levels to reflect dynamic lighting levels you have set.
Could you create a toggle helper and add it into dynamic lighting Dynamic Lighting - Toggle Helper (Optional). You have set a Dynamic Lighting - Min Brightness Value to 0% so you will need to add this toggle helper in.
In Night Light Control I have un-ticked Yes - Manage OFF script when crossing over as I removed the script you had above in 1.
Because you are using dynamic lighting in Light Control I have un-ticked Use Brightness. It wont matter if it is ticked but because you are using dynamic lighting option 1 it will not be used.
Below is you new code, Just remember to update your people in zone.
I can see you getting a bit advanced in your set up.
No because you donāt have
template: !include template.yaml
I personally do it this way and create folders but it is getting a bit off topic of this post/blueprint. HA is starting to do it all through helpers now but they are yet to have template trigger so I only have my template trigger sensors and some advance sensors there now and I use the helpers as it is a lot cleaner and easier to manage. If you need more help splitting your templates then maybe create a new topic or research the forum as there will be a lot of information on this. Even YouTube has people showing you how to.
template:
- trigger:
- trigger: state
entity_id: binary_sensor.badevaerelse_sensor_dor_aqara_contact
to: "on"
- trigger: state
entity_id: binary_sensor.badevaerelse_sensor_dor_aqara_contact
to: "off"
for:
seconds: 10
- trigger: state
entity_id: binary_sensor.badevaerelse_sensor_bevaegelse_aqara_occupancy
to: "on"
binary_sensor:
- name: "BadevƦrelse Optaget Sensor"
device_class: occupancy
icon: mdi:account-box-outline
state: >
{{ is_state('binary_sensor.badevaerelse_sensor_dor_aqara_contact', 'off') and is_state('binary_sensor.badevaerelse_sensor_bevaegelse_aqara_occupancy', 'on') }}
If you go my way and add the code below to your config file
template: !include_dir_merge_list template
You then create a folder under CONFIG (if using studio code server) or homeassistant/ (if you are using file editor) called template.
Once you done that in template folder you can create sub folders or just yaml files. I have a sub folder called binary. In binary you the create a file for your sensor say badevƦrelse_optaget_sensor.yaml. In the file add this code
# You can add a note here for future if you like
- trigger:
- trigger: state
entity_id: binary_sensor.badevaerelse_sensor_dor_aqara_contact
to: "on"
- trigger: state
entity_id: binary_sensor.badevaerelse_sensor_dor_aqara_contact
to: "off"
for:
seconds: 10
- trigger: state
entity_id: binary_sensor.badevaerelse_sensor_bevaegelse_aqara_occupancy
to: "on"
binary_sensor:
- name: "BadevƦrelse Optaget Sensor"
device_class: occupancy
icon: mdi:account-box-outline
state: >
{{ is_state('binary_sensor.badevaerelse_sensor_dor_aqara_contact', 'off') and is_state('binary_sensor.badevaerelse_sensor_bevaegelse_aqara_occupancy', 'on') }}
Youāre right that I donāt need a script, nor a toggle.
I didnāt saw that I can select a scene in the āentityā picker.
I think your example is probably too complex for a āfirst introductionā to the solution. If you have never faced the situation you will not see the value, and it makes you think that the only way to take advantage of the feature is with all that added complexity.
I may be the weirdo here, but I think that a āsimpleā and a ācomplexā example will make things easier. Or maybe a disclaimer? āthis is only needed if you want to transition from normal lights to night lights that stay onā or something like that.
Cheers
Yeah it is a big blueprint and has so many featuresā¦ this can be overwhelmingā¦ It can do so many things.
Hope you got it working, to start just add a trigger (motion sensor) enter in your light/s entities and click save. That starts your lights coming ON and OFF. Then tackle night lights in a similar way.