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

I’d like to use this blueprint for my hallway and private office room.

You have multipe Times like:
Time for the morning scene (Optional)
Time for the day scene (Optional)
Time for the evening scene (Optional)
Time for the night scene (Optional)

An it would be great, if the blueprint would include for all this times also an option to include the illuminence sensors.
I would like to be able to only switch the light on, when it is darker then I defined it in the automation.

Do you understand what I mean?

I have personally created a binary_sensor helper called “Automation Blocker Büro” that prevents the light from switching on as soon as one of the conditions is met.

{{ is_state(“input_boolean.sleep_mode”,“on”) or is_state(“binary_sensor.darkness_office”,“off”) or
is_state(“binary_sensor.sun_elevation_threshold”,“off”) }}

Darkness Helper:

I hope this helps you.

1 Like

Is there a way to get two or more motion blocker helper? I already use a helper blocking the automation and switch the lights permanently to on.
Your solution would work with two diffrent motion blocker helper even the luminance sensor inside the automation would be easier :sweat_smile:

No, there can only be one Motion Blocker sensor. However, you can combine several sensors in one helper. To do this, create a binary_sensor helper as described above. Both iluminance sensors can then be included in this helper.
Example:

{{ is_state(“binary_sensor.darkness_office_1”,“off”) or is_state(“binary_sensor.darkness_office_2”,“off”) }}

Based on the YAMA and with the help of @anym001 I was able to update this blueprint for my needs and I want to share my settings, maybe some needs them too.
It’s like the yama before, but you can add multiple motion sensors additionally I added an option to use illuminance sensors. You can set a level for the sensors and the lights won’t run on.

I wasn’t sure to stay in this post or create a new one?

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

1 Like

Hi, I am pretty new to HA and I am trying to get my kitchen lights to automatically switch on and off.

I am using a Sonoff SNZB-06P Presence Sensor and the basic motion sensor automation included with HA worked but was of course missing the extended options given in this blueprint.

So far I am only trying to get it to work with the sun elevation option. It isn´t working and I think it might be because the sensor doesn´t have an on/off status. Instead it has “detected” and “normal”. I thought I might use a helper to create a dummy sensor that is “on” when “detected” and “off” when “normal”, but I am failing to do so.
Am I on the right track and do you have some pointers on how to fix my problem?

Thx, Jens

Hi jens,

Have a look into the developer options. The entity listed there shows you the status which is really used. Mine shows home or away in the gui but there on and off.
First you should try without sun to make sure it’s working.
Which blue print are you using? The one in the first post wasn’t working for me either

Hi,
thank you for your answer…
I am using the blueprint from the first post.
How do I disable the sun option?
I am not sure where to find the developer options, but I found the status window in the zigbee2mqtt tab and it says “occupancy”: true, So I guess it´s “true/false”

Try again using my version a few posts up.

Hi, I did,…
getting the following Error “Message malformed: Entity None is neither a valid entity ID nor a valid UUID for dictionary value @ data[‘action’][0][‘choose’][0][‘conditions’][1][‘entity_id’]”
No Idea which entity is meant…

The “old” automation using the blueprint from the 1st post seems to be working suddenly. So I guess the problem lies with the sun elevation. I checked the SunCalc website and if I understand correctly, the elevation here where I live is 8.86° one hour before sunset. So I set the value to 9, expecting that the automation will be blocked as long as the value is above 9?

Seems to be working now, didn´t change anything, maybe it just took some time.

I have a Hue Outdoor Sensor and a Hue Bulb. As soon as it is dark and the outdoor sensor detects motion I want the Hue bulb to be on for 120 seconds after the last motion.

I tried the following configuration, but the Hue bulb does not turn on if motion is detected:

The binary_sensor.gartenhaus_dunkel is “on” if motion is detected and is “off” when no motion is detected. What is wrong with my configuration?

Try using the entity, not the device

I use the entity binary_sensor.ID_occupancy as motion sensor which can be seen in the YAML editor.

Here is the YAML definition:

Can you please tell me what’s wrong with the definition?

Howdy FHEMbeta,

Your automation_blocker is a template, needs template syntax is my guess.

"{{ the thing }}"

That does not work, too. Syntax is the following:

automation_blocker: "{{ is_state(\"binary_sensor.gartenhaus_dunkel\",\"on\") }}"

Try the following. (Here as an example with two sensors)

{{ is_state("input_boolean.sleep_mode","on") or is_state("binary_sensor.darkness_office","off") }}

Hi,
I use a Philips Hue motion detector with a light sensor and would like to use it to control my kitchen lighting. I use the YAMA-Custom-Blueprint with the Lux option and have the following problem:
If no motion is detected, the light level will only be updated every 5 minutes. Every time motion is detected, it is updated immediately. The lamp should be switched on below the value of 15 lux. Now when motion is detected, the light turns on and the measured lux value is immediately updated to 78. After 3 minutes, the automation switches the lamp off again, but unfortunately the lux value remains at 78 for about 5 minutes. The lamp will no longer be switched on within the next 5 minutes.
However, if a new movement is detected within the 5 minutes, the lux value is updated very shortly after the movement is detected, unfortunately 1-2 seconds too late for YAMA to turn on the lamp. Is there a way for YAMA to ‘wait’ a few seconds after motion is detected before checking the lux level?
Or do you have a recommendation for another light sensor that updates the lux value more often (e.g. every 5 seconds)?

Thank you ver much for help!

Hi there!

can anyone help me, with my YAML?
I would like to enter a start time of 4.30 p.m. and an end time of 8 a.m. where the motion sensor should work. what is the best way to proceed, thank you

Here is my yaml:

alias: YAMA Eingang Test
description: Test Yama Eingang
use_blueprint:
path: networkingcat/yet_another_motion_automation.yaml
input:
light_target:
entity_id: light.shellyplus1_1c6920081f18_switch_0
motion_entity: binary_sensor.hue_bwm_eingangsbereich_belegung
no_motion_wait: 240
elevation_check: 1
automation_blocker_boolean: false

Big THX

1 Like