YAMA - Yet Another Motion Automation (Scenes, Ambient Light and some Conditions )


i have added an optional “no motion blocker” with user choosable desired state.
(That was easy to add because i already had the code for the automation blocker and i need that for the next room.)

I´ve noticed that after updating the blueprint importing and using it always sets the elevation variable on my system. I do not know why, i did not change anything there…

If you use this new Version please can you check if you have the same bug?
You can check this very fast, if you are in the configuration for a automation using this blueprint click the 3 dots top right corner, switch to yaml and look for this:

elevation_check: '0'

If it is in there and you did not configure this than you have the same bug.
Still i do not why and how… :frowning:

I should probably just make my own blueprint, but what I really would like to have is a motion automation that

  • detects motion
  • sets lights/scene bases on time of day
  • motion ends
  • restore lights to their prior state

I know you can do this with an action to create a new scene on the fly. Instead of just turning the lights off, it would be much nicer if you identify the lights that are being modified, then created a scene before changing the settings, and finally at the end of the motion just restore the scene that you previously created.


Ran into some issues with the following error code:

Blueprint Yet Another Motion Automation generated invalid automation with inputs OrderedDict([(‘no_motion_wait’, ‘30’), (‘motion_entity’, ‘binary_sensor.lumi_lumi_sensor_motion_aq2_ias_zone’), (‘light_target’, OrderedDict([(‘device_id’, ‘89c1257d5a9585f961592e849e99ca2’)])), (‘automation_blocker_boolean’, True), (‘automation_blocker’, ‘light.schlafzimmerdecke’), (‘scene_night’, ‘scene.schlafzimmer_nacht’), (‘time_scene_night’, ‘33:00:00’), (‘time_scene_morning’, ‘9:00:00’)]): Invalid time specified: 33:00:00 for dictionary value @ data[‘action’][0][‘choose’][2][‘conditions’][1][‘before’]. Got None <

What to make of it? I never set the “invalid time specified”. This should be 21:00:00 instead of 33:00:00

I can not imagine where this comes from, there is nothing in this blueprint which could cause this. (at least not that i know of)

Also i noticed this:
(‘automation_blocker’, ‘light.schlafzimmerdecke’)

is light.schlafzimmerdecke an input_boolean?
Can you please paste the automation as yaml?
(Configuration of this automation, three dots top right, select yaml)

Also which version are you using, that is in the description of the blueprint

This is absolutly possible, but to be honest i do not know in the moment if i build that in. :thinking:

Ok it seems the error is down to some leftover automations, which weren’t properly deleted over the UI. Had to manually edit the automations.yaml to get rid of these leftovers. This might also be the reason I had conflicts earlier.

light.schlafzimmerdecke is a Hue Device (not entity)… I think it should work. Have to test it first.

-> the blocker didn’t work. Can you use a target entity such as freakshock88?

Glad you sortet this out.

I can remove the input_boolean domain.

Hoping that in the future we are able to select multiple domains to make is easier for beginners to use that correctly.

Expect a new version tomorrow evening. No time today and my test stuff is in use for a little rework of the blueprint logic.

New Version online with restructered action logic to hopefully get new features in this soon.

I think i tested everything :smiley:

Still have the elevation bug, but nobody else is complaining so i guess this is something only i have :grimacing:

With the new blueprint it no longer works for me.I just added motion detectors and lights. With the old version, the light also went on during the day, now it doesn’t come on during the day. But I don’t want it to work during the day as it is quite dark in the basement …

Can you please check if you encounter this bug?

yes I have it in the .yaml. the old version ran fine.

Can you please try to delete the line and check if it reappears again?
I do not know why the blueprint is doing this, this started at some point. But there was no change for this stuff so I am hunting a ghost.

Did you add all the times for the scenes and ambient or are the wrong as well?
If yes then this is a new one also. (I do not have this if I do not configure them)

As a quick fix you can set the value for elevation to 90,then it should work the whole day.

Best to reverse this after the bug is fixed

I have now deleted the line and will not come back. the automation works again now. I also tried to set your tip to 90, unsuccessfully. I didn’t set up scenes and anything else, just motion detectors and lights. I have some shellys in operation that act as a “switch”, but I cannot select them because only “light” can be selected. is it possible to add “Switch”?

If you want to control switches you can at the moment use a scene or or expose the switch as a light :

Thank you for the info! now I have noticed that the automation has the entry elevation_check: ‘0’
but automatically adds again. I delete it from the .yaml, then the automation works once, the time runs out, the light goes out. then on the next attempt it does not work again because he has the entry elevation_check: ‘0’
adds back to .yaml.

Edit: then I have the switches twice in HA, once as a switch and as a light … I find it so confusing. then I have to work with scenes. is it possible to reactivate the blueprint V03? it worked without any problems for me.

so sadly you have the same bug :confused:

I tried to import a revision of a gist in HA but it takes the newest Version automatically.
So if you really want to use that version you need to do this yourself.

Either by forking or by copying the blueprint v03 on your ha server and using it from there.

the v08 works now so far. I am currently using the motion sensor with sun height for a time of 420 seconds, is it possible that from 10:00 p.m. - 6:00 a.m. the motion detection is only switched on for 120 seconds - so that from 10:00 p.m. the 420 seconds are deactivated and then the 120 seconds are active and then the other way around at 6 a.m.? if so, what do i have to do? Can somebody help me?

btw, you can turn a “switch” into a light entity:

I include a “light.yaml” and in there:

  - platform: switch
    name: Kitchen Counter
    entity_id: switch.kitchenlamp

This creates the entity “light.kitchen_counter”

I´ve updated the blueprint where the elevation check bug should be fixed.

I did not forget you, but needed first to solve this bug.
Will be added soon.

So you need two different wait times depending on time of day?
At the moment i think i will not build that in, but if more people need that i can have a look at this.

Ok, thank you for the information. then I have to implement this with various automations. because it makes no sense if the light is activated by a cat at night and then lights up for 420 seconds, so I only want 120 seconds at night.