@freakshock I’m testing Home Assistant 2022.6 beta now, and I found that your blueprint does not turn off the lights now. They turn on at motion and at the correct luminance, but they don’t turn off. Anyone else experiencing this with this blueprint?
It all worked in previous HA versions, but as soon as I installed 2022.6 all automations with this blueprint started to behave the same. No changes to the system was made just before installing 2022.6, so something in that version has changed that in turn affects this blueprint, I guess.
’ Error: ValueError: Template error: int got invalid input ‘None’ when rendering template ‘{{ states[no_motion_wait].state | int }}’ but no default was specified’
I think this is the problem but no clue how to solve this.
Have you guys updated to the latest version of the blueprint?
I think this error might only occur because an older version of the blueprint did not define default values in templates. I see that the template that Remco is providing from the logs is missing the |int(0) part which is in the latest version of the blueprint.
Please try to update the blueprint (delete and readd it) to the latest version and try again.
If that still does not work let me know (and provide logs if you can).
Hi,
I’ve just set up the automation along with time constrains. Tested it earlier, and it worked great, but now after setting before time to 2am and after time to 8am it doesn’t seem to work, lights are still turned on, and it’s after 2am. I tried changing to 1am with no success, but when I tried before time to 11pm, scripts correctly halted and didn’t turn on the lights.
Any ideas what can I be doing wrong, or how can I help to find the issue?
Some more testing revealed that after 10AM local time it works only if I set ‘after’ to 8AM - it stops working for 9AM or 10AM put in the field. I’m in GMT+2 now, so it seems like it ignores timezones - which means that all timing will break when we switch to winter time.
Is there a solution to that?
EDIT: Resolved, I didn’t have timezone setup in general Home Assistant settings.
I have two questions, the “no_motion_wait” have to be seconds instead of minutes. I have a motion Sensor in the floor and 1min is really to much. 15sec totally fine. But is not possible with the default blueprint.
Is there any advantage to use a helper for e.g. Illuminance cutoff value, Turn off wait time (minutes) instead of a direct input? I just find it unnecessarily complicated to have to create an extra helper.
Hey,
I’ve been having an automation problem since I accelerated the lighting sensor update. My light turns on under defined conditions, but it won’t turn off anymore. I assume that it doesn’t turn off because immediately after the light is turned on, the light level has increased above the defined threshold and thus the condition is not met. Can anyone advise?
Hello, I am new to the Home Assistant topic and this script is exactly what I am looking for. However, when I set it up, it does not work. Are there any problems with the script or am I doing something wrong?
Looks like I figured it out. The light doesn’t turn off when I don’t use the optional parameter “Turn off wait time”. I require the light to turn off immediately after the motion sensor clears. When I set the parameter “Turn off wait time”, it works and the light turns off.
As far as I’m reading in the docs, input_number is a float so you vould also set it to 0.25 to set the wait time to 15 seconds. I agree seconds might have been a more logical design choice for this template, but I don’t want to change it now and break all existing automations when people update.
As for having a helper entities for some configuration, I like to sometimes change the values without having to change the automation code. But I understand it might be a bit overkill for most people. I might look into also supporting hardcoded values in the future, but in the next few weeks I will not have time for it.
Read the first post again. You cannot use hardcoded values for illuminance_cutoff or no_motion_wait, you need to create input_number helper entities for that.
I have configured this automation in my kitchen to turn off the lights if no motion is detected after 20 minutes. I have a helper defined with the input_number 20 however at the 20 minute mark the lights turn off as per the automation but it also turns off even though there has been motion during the 20 minutes. I thought if there is motion detected then the timer resets and the 20 minutes is extended for another 20 minutes if there is no motion detected and it will turn off.
That should not happen. If the motion detector state turns ‘on’ within those 20 minutes, the automation (so also the ‘timer’) should restart. Have you tried reinstalling the blueprint? Maybe you don’t have the latest version installed.
Thanks for your reply, here’s an idea for the seconds problem. Maybe you could let the user choose a number and additionally the unit (seconds, minutes etc…) Default then minutes so there would be no BC.
Currently I am struggling with a very strange problem, I use Z2M and the Philips HUE sends motion and current light value in one message:
This leads (I think) currently to the fact that the light does not always turn on. Because when processing the message, the current light value is used and not the new which is in the message. I do not know, but is there something like:
{% set illuminance = max(payload.illuminance_lux, states(illuminance_currently)) %}?
k, I found out what exactly the problem is. It is random whether the Philips HUE Sensor/Z2M sends motion or light status first. Since your automation only responds to motion, it may be that motion is transmitted first and then the current brightness. If you have set a lux threshold, the automation will fail.
For this reason, it makes sense to pay attention to movement and illuminance separately. What if you move in a room, the light is bright enough. Then you close the door and it is too dark. But movement is still “on” at this time.
I have created an automation that solves this problem. Maybe some suggestions for your blueprint.
Bonus: There is a night mode where the light comes on in 2 levels so you don’t burn your eyes in the middle of the night
About the Trigger: I know there is a Trigger with "Device → Motion Sensor (Illuminance) → Above/Below. And it can make this task more simple, but the issue is, that the Trigger NOT allow to use a input helper. I hope that the add it in the future (like the Trigger Numeric-Statechnage).
Hi,
I do have the same issue when using ‘scenes’ or ‘scripts’ to turn lights on. The lights do turn off after the timer runs down, if no motion was detected only for a moment, a new motion during the time period does not reset the time.
BUT when using individual lights or group of lights everything is working as expected and any movement resets the timer.
Is that by design or should the timer also restart when using ‘scenes’ or ‘scripts’?