Turn on light, switch, scene, script or group based on motion, illuminance, sun (+ more conditions)

I use zigbee2mqtt with RTCGQ01LM as well with this blueprint. RTCGQ01LM has it’s own illuminance sensor. Are you using the GZCGQ01LM as the value for the illuminance in this blueprint? That would not be necessary because the RTCGQ01LM should have its own illuminance sensor.
Perhaps that would solve your problem already. Please also update to the latest zigbee2mqtt version, because a bug was fixed where occupancy and illuminance could not be reported at the same time.

This behavior should not occur in the latest version of the blueprint.
The automation should reset after a second motion detected event.
Have you reimported the latest version?

That does make sense indeed :slight_smile: I just removed the restriction on the motion sensor, it can now be any entity, including a group you can define with multiple motion sensors.

2 Likes

the only way to pull in your new change is for me to remove the blueprint and re-add from the gist ?
I dont think there is any other way (but would be nice if Blueprints could get updates from their original gist on startup or something)

As far as I know, yeah.
I assume updates will be made easier in the future, we will see :slight_smile:

1 Like

Hi, for the “Wait time to turn off”… you say :

(OPTIONAL) Turn off wait time

"Time to leave the light on after last motion is detected. If not used entity will not auto turn off. Only works for target_entity types light and switch.

Shoudl that still work for an Entity of type “Group” - I have a group created with two sets of lights in it (as the Entity picker in blueprint only allows me pick a single entity I grouped two lights togther in the group)

Good catch, that line is no longer valid.

The wait time works for any supported entity, including groups.
I’ve removed the wrong line from the blueprint.

I believe you use RTCGQ11LM (Aqara RTCGQ11LM control via MQTT | Zigbee2MQTT) and not RTCGQ01LM (Xiaomi RTCGQ01LM control via MQTT | Zigbee2MQTT).
Mine does not report illuminance, which is why I use the GZCGQ01LM in addition to it.

Zigbee2mqtt is up to date (auto-update on)

Regarding the behavior (timer not reset), well, I admit I don’t really get this blueprint update thing.
From what I understand, I only import the github URL, and then HA takes care of pulling any changes on the imported repo (I don’t know the frequency though). And then, automation only references the blueprint, it does not copy its code.
So, from what I understand, I cannot be out of date regarding the blueprint. If you make any changes, they will be automatically pulled on my side, and the automation would therefore use the latest version without any manual intervention on my side.
Am I wrong ?
If yes, can you explain what I should do to be up to date ? Should I delete my automation and recreate it ?
If not, then the behavior I mentioned was tested yesterday evening (so after the fix you mention I think), which would lead me to say that the issue is still there

Thanks again for your work and time !

Aah yes sorry, my mistake.

No, that is incorrect. There is no updating mechanism right now.
The only way to update is to import the blueprint again (maybe you have to delete the exising version first, not sure about that).

The automation itself is not required to change, as long as there are no breaking changes in the updated blueprint (which of course I try to avoid :wink: )

I think the steps are:

  • Delete the blueprint (not the generated automations)
  • Reimport the blueprint
  • Profit :slight_smile:
1 Like

Hi, I just installed my conbee stick via ZHA and added my hue motion sensor. The first thing I tried was this blueprint and I like it very much. Good job! :slight_smile:

One suggestion for improvement: The official “Motion-activated Light” blueprint allows to pick an area as the target device. This is very convenient because it will trigger all lights in that area (room).
Would it be possible to add areas as possible target entities to this blueprint?

I was getting “Invalid domain name” and my automation didn’t work. It was not at all clear to me how from the example how to actually get values into the times. Example shows how to define the time entitles, but not how to set their values. If it’s possible to add the values in the automation’s YAML, show that in the example, and also mention that to use the optional features you MUST edit in YAML. I completely ignored that section because I want avoid YAML configs when possible, just an ideological thing with me.

What I did, based on the suggestion in one of the comments here, is to go to the Configuration->Helpers page and define the time and number entries, then click the slider icon thing in the upper right to set the value. I don’t know if this is the best way, but being new to HomeAssistant this is very unintuitive. I’d much rather just type the values in, but i can understand if the limitation of the language doesn’t support casting those string values.

Actually now I see that you do mention to create the helpers, in a single sentence, that I didn’t know what to do with since this is my first automation ever. Can that just be more clear that we need to go into Configuration->helpers? Now that I know what to do it’s clear, it’s just not clear to beginners.

I looked into it, but it does not seem compatible with how this blueprint is setup.
Blueprints can have entity selectors (like this one) or target selectors (which support area’s).
I cannot change this blueprint to have a target selector without breaking it for previous users.

A workaround is that instead of using area’s, you define a group for the lights you want to trigger.

1 Like

I’ve now updated the first post with info on how to do that.

It’s possible to set an initial value for helper entities in YAML, but I dont recommend using it because the value gets set to this value every time homeassistant starts. I want the value to be dynamically set and stay that way until the user changes it.

Like you yourself have found out later, using YAML is not required to use the optional features, or at all for this blueprint.

The reason for not being able to type in users is just a design choice on my part.
I wanted to use dynamic limits, not hardcoded ones.

I hope it’s more clear now, if not let me know !

perfect! now I just need to figure out how to allow multiple time frames and I’ll be completely off webcore and smartthings

I’m still pretty new to HA, so this might be obvious to most: is there a way to set the run before/after times based on sunrise and sunset? Possibly with an offset (like stop an hour after dawn, or an hour before sunset)? I know I can get Sun state, but unsure about daily datetime.

That should be possible by defining an input_datetime that is set by an automation when the sun state changes.
Some examples here.
I also see that there are already datetime values in the sun.sun entity attrributes that can be used for this.
I don’t have the exact code for this right now, but maybe someone else has something like that ready to share?

Hi
Thanks for this blueprint
As for some others here I am quite new with HA and not very good at yaml.
I was wondering if there is a reason that the time fields are somewhat “inverted” instead of having them say run from 07.00 - 18.00 ? Maybe just me but it seems more logical.

Also would it be possible to have what weekdays the automation should run, for example we have a combined office and playroom and on weekdays when it is used for office the time between motion needs to be longer 60-120 min whilst on weekends when it is used it needs to be shorter 15-20 min.

But great work with having a lot more possibilities than most motion blueprints!
Thanks

I wrote a blueprint which uses Sun elevation. I tried the sun rise/sun set time, somehow they do not work well in condition (but works perfectly if they are in trigger)

Feel free to try it: https://gist.github.com/kevinxw/abeffde9c4fac0fcc3544772a225bd60

1 Like

Hi,
I’ve been running an automation based on this blueprint for a week. It generally works very well, but there is one thing that is bugging me: During dusk, there is a time period, where the outsight light is below the cutoff, so the lights are triggered. But the lights also illuminate the sensor to a luminance higher than the cutoff value. So after the timeout, the lights go out and are not triggered immediately again by movement. Only after the illuminance sensor gets a new reading of the dark room a while later, movement will trigger this automation again. So I have to sit in the dark (rather dusk) for a while… Quite annoying.

Any tips on how get around this?

I had the same issue. My suggestion: use sun set time instead of illuminance sensor, or move your sensor to a place not under the light, or use my blueprint provided above.

Hi,

I’m rather new with HA.

I tried to use the “Only run after time” option without success. Input is for example: 10:00

The log registers the following: 2021-01-16 12:01:15 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: TemplateError: str: Invalid domain name '11:20

No trigger at all happens. What could be the cause?

Besides this, I checked the Blue print code.2021-01-16_11-28-17 and a warning pops up (see attached file). I imported the latest version of this Blueprint.