When using a blueprint, YAML code is created for the automation.
Can you post your generated automation code so I can review the contents?
It should look something like this and should be in the automations.yaml file:
- alias: Turn on second floor hallway lights on motion detected during day
id: 55d1042c98d244adb1a7bad7d9eb25dd
initial_state: true
use_blueprint:
path: homeassistant/motion_illuminance_activated_entity.yaml
input:
motion_sensor: group.motion_detectors_hallway_light
target_entity: scene.second_floor_hallway_day
illuminance_sensor: sensor.motion_sensor_2nd_floor_hallway_illuminance_lux
illuminance_cutoff: input_number.illumination_zolder_low_cutoff
no_motion_wait: input_number.second_floor_hallway_no_motion_turn_off_delay
time_limit_after: input_datetime.second_floor_hallway_lights_turn_on_after_limit
time_limit_before: input_datetime.second_floor_hallway_lights_turn_on_before_limit
target_off_entity: light.second_floor_hallway_light
I’m having the same issue as others with lights not turning off since 2022.6 update. I have updated your blueprint to the latest version (delete & reimport), as well as create new automations after updating. If I don’t define a value for Turn off wait time (minutes), then the lights will not turn off. Interestingly, even though you say hard-coded values don’t work, if I use 0, it does work.
Here is the log output when Turn off wait time (minutes) is undefined:
2022-07-07 00:48:29 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights] Garage Motion Lights: Restarting
2022-07-07 00:48:29 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights] Garage Motion Lights: Running automation actions
2022-07-07 00:48:29 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights] Garage Motion Lights: Executing step call service
2022-07-07 00:48:29 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights] Garage Motion Lights: Test condition template: False
And here is the log when Turn off wait time (minutes) = 0:
2022-07-07 00:50:17 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights_2] Garage Motion Lights 2: Restarting
2022-07-07 00:50:17 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights_2] Garage Motion Lights 2: Running automation actions
2022-07-07 00:50:17 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights_2] Garage Motion Lights 2: Executing step call service
2022-07-07 00:50:17 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights_2] Garage Motion Lights 2: Test condition template: True
2022-07-07 00:50:17 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights_2] Garage Motion Lights 2: Executing step wait for trigger
2022-07-07 00:50:17 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights_2] Garage Motion Lights 2: Initialized trigger
2022-07-07 00:51:22 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights_2] Garage Motion Lights 2: Executing step delay 0:00:00
2022-07-07 00:51:22 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights_2] Garage Motion Lights 2: Test condition template: True
2022-07-07 00:51:22 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights_2] Garage Motion Lights 2: Choose at step 6: default: Running automation actions
2022-07-07 00:51:22 INFO (MainThread) [homeassistant.components.automation.garage_motion_lights_2] Garage Motion Lights 2: Choose at step 6: default: Executing step call service
It appears there’s a bug in the template somewhere that only manifested after 2022.6, because previously it worked fine for many months.
Now that you have pointed it out, its very much as case of RTFM!!!
Apologies. I think I now have it working. Just need to play around with the “Turn off wait time” - I have set it to 1 (a helper) but in MQTT the sensor is get to 5 secs before its resets its self, so the light goes off after 5 secs. I think I need to have a play!
Thanks for your report. You are correct. I have now edited the blueprint to fix the no_motion_wait undefined scenario. Please update the blueprint and try again
Do you actually have helper entities defined called input_number.5 and input_number.20? That does not make sense. The helper entity should have a logical name i.e. input_number.kitchen_lights_turn_off_wait_time_minutes and a VALUE of 5.
Yes, I was only using them for testing and was going to set them correct when done - honest
I have deleted them all and rebooted - made 2 new ones for the timeout and the lux and it looks to be working correctly now. Many thanks for your help.
I use this for illuminating the kitchen. When the light is turned on by this blueprint (presence detected), it correctly turns off again later. But when the light is turned on any other way (e.g. someone using the wall switch) it stays on forever. I would prefer that it then also turns out when the presence sensor recognizes that noone is there any more.
No, your usecase is not supported in this blueprint. It should not be too hard to create a blueprint or automation to have logic like you are describing though.
I have tried every single numbering type of input selection through the UI. Nothing works. Can you give a step-by-step guide as part of your documentation on how to build a 5 minute timer? I see that this thread is riddled with people having the same issues as I am. They magically can get it fixed, I cannot. I have no magic.
I was wondering about the actual value that shows in the ‘States’ section of the developer Tools in Home Assistant.
It should show a date in this format: