Also just wanted to add, if anyone else happens to be looking for an elegant way to pair this automation with automated brightness control like I was: I’ve been using this blueprint along with the Adaptive Lighting integration (https://github.com/basnijholt/adaptive-lighting) and I’ve been super happy with the results. I don’t have to have numerous complex scripts/automations for each set of lights to handle it all. I just have this blueprint running per room/set of lights and those same lights together in an instance of Adaptive Lighting and it works fantastically together.
For some reason automation based on this blueprint stopped working. It turns the light off in a few seconds after turning it on. I believe there may be some changes in Home Assistant which caused such behavior. Please help
Are you sure something didn’t change with your triggers/sensors to cause that? Fwiw I have over a dozen automations using this blueprint and running latest HA and they are all still working just fine. Maybe the log of the target light can tell you what turned it off? If it is the automation then maybe a examining the trace?
Hello!
I would like to turn on bulbs ans switches but I read it cannot handle multiple target_entity.
Is the creation on 2 automations (one for bulbs and one for switches) a solution?
Thanks!
I’m having the same issue with input numbers.
The automation stops working when I use an input number.
This is not working:
alias: Light On Motion - Hal
description: ""
use_blueprint:
path: kevinxw/state_based_entity_control.yaml
input:
trigger_entity: binary_sensor.motionsensor_hal_occupancy
target_entity: light.hal
illuminance_sensor: sensor.motionsensor_hal_illuminance
illuminance_below: input_number.hal_illuminance_threshold
This is working:
alias: Light On Motion - Hal
description: ""
use_blueprint:
path: kevinxw/state_based_entity_control.yaml
input:
trigger_entity: binary_sensor.motionsensor_hal_occupancy
target_entity: light.hal
illuminance_sensor: sensor.motionsensor_hal_illuminance
illuminance_below: '10'
I figured this out myself in the meantime so I’m leaving this here in case someone else runs into this issue:
The helper I created in the UI is having a decimal value. (For example ‘10.0’)
I used a template to get the integer value for the input_numer and now it works.
alias: Light On Motion - Hal
description: ""
use_blueprint:
path: kevinxw/state_based_entity_control.yaml
input:
trigger_entity: binary_sensor.motionsensor_hal_occupancy
target_entity: light.hal
illuminance_sensor: sensor.motionsensor_hal_illuminance
illuminance_below: "{{ states('input_number.hal_brightness_threshold') |int }}"
Luckily the blueprint seems to be able to handle groups like binary_sensor.presence_group
.
One important question as the docs are not clear about this:
Does “timeout_blocker_entity” allow multiple entities, so e. g. input_boolean.blocker_a|binary_sensor.blocker_b
?
It does not.
You can create a group containing the bulbs and switches, then put the group into target_entity
Hi Kevin, I like what I see in your script here. I’m trying to figure out if I can tweak/modify it for use in such a manner as described below. If you know how to quickly tweak/support I’d greatly appreciate it.
- Instead of motion sense triggering (since I don’t have motion sensors yet) I’d like just have the light switches trigger automation (e.g. light switch pressed once it will timeout after blueprint instantiation timeout or alternate timeouts during times of the day).
- If the light switch is pressed on, then off, and back on within 3 seconds then I’d like to override the normal light off timeout with a different value (or no timeout)
I noticed your blueprint currently has a 3 second trigger that would probably need changed for #2 to work. Also, I tried making the light switch the trigger and the target and it didn’t seem to work for #1. Perhaps I need some other options in the blueprint for the light to turn off automatically after a timeout?
You can put anything into trigger. A motion sensor is just an entity which will turn itself off after it was on for some time.
Thus, you can create a helper entity to simulate a motion sensor. Just create a toggle entity in helper, then create an automation which will be triggered by the light state. In the condition, when the light state is changed to “on” (make sure the trigger is empty so that you know it’s not turned on by another automation), set the helper’s state to “on”, then set a delay, then set the state to “off”.
Now you can fill the helper entity to trigger. You can do the similar thing for your second requirement: create a helper, then create an automation to set this helper’s state based on your desired actions. Then fill this helper to the block entity of my automation.
Hi I seem to be having issues with the Trigger Timeout where I’m using an input text helper and I’ve tried entering 00:00:30
but the lights are not turning off after the timeout has elapsed. If I manually enter 30 or 00:00:30 in the automation it works fine.
Looking at the trace for the unsuccessful execution I see the following message:
error: offset input_text.trigger_timeout should be format ‘HH:MM’, ‘HH:MM:SS’ or ‘HH:MM:SS.F’
This is my helper:
I’ve tried inputting 00:00:00, “00:00:00” and ‘00:00:00’ in the helper value, all with the same error outcome in the automation.
Hey there. I have fairly limited knowledge, but trying to get this to turn on/off a switch located in a bedroom when a group of other switches turn on/off. It used to work in an older version of HA, but i think something has changed, not sure what. I have updated to latest blueprint.
which version of homeassistant are you using?
I am using my blueprint with the latest homeassistant with no problem
Awesome thanks for the reponse Kevin. This hasn’t been working for a good six months. Current HA version installed 2023.2.2. Could it be something wrong with the groups? The automation always turns the switch on when a another switch is turned on, but whereas it used to also turn the switch off, now the switch just stays on??
Stopped working with the old blueprint on an updated HA, just updated blueprint but still the same behaviour. This is the current test where switch.ah1 (is a switch group created in devices, Helpers Group, Switch group) and switch.2
id: ‘1683345131402’
alias: ah1
description: ‘’
use_blueprint:
path: kevinxw/state_based_entity_control.yaml
input:
trigger_entity: switch.ah1
target_entity: switch.2
trigger_entity_state_off: ‘On’
target_entity_state: Trigger Entity States
Could someone that has successfully used the trigger timeout provide any pointers to me, I can’t seem to use an input text helper to work at all.
In case anyone reads this, for me the blueprint did not accept an input text helper in the Trigger Timeout field (even though the dropdown menu implies that it should) and it only accepted hard coded text in this field in the automation.
For my own use case I edited the blueprint and reconfigured the Trigger Timeout to accept an input number helper and it’s now working for me.
This blueprint really is my “all in one” weapon for many things meanwhile, mostly light automations. Unfortunately, I can not implement this use-case:
-
Trigger entity
(motion sensor) is at desired state -
(Optional) Illuminance Below
is also true
→ it got dark meanwhile, while people still constantly trigger the trigger entity which stays on)
Unfortunately, the target entity (light) stays off, as the decrease of illuminance is not discovered as trigger.
Using a dumb switch or living with annoyed people is not a (smart) option.
Any smart way to work around that? I want to solve this within one automation (ideally by being able to use the illuminance sensor as second trigger, but based on a range of values instead of a fixed on/off state), based on this blueprint.
I tried to set both the motion sensor and illuminance sensor as trigger entity (trigger_entity: binary_sensor.motion|sensor.illuminance
) and use trigger_entity_state: true|5|4|3|2|1|0
- which gave an error and rendered the whole automation faulty.
Can you try put trigger_entity: binary_sensor.motion,sensor.illuminance
instead? i.e. replace |
with ,
Well, while syntactically correct (in a way which does not force the automation to render faulty), the automation immediately stops working with
trigger_entity: binary_sensor.motion,sensor.illuminance
trigger_entity_state: on|5|4|3|2|1|0
# Also tried the syntax of the next line alternatively to the pipes above
trigger_entity_state: on,5,4,3,2,1,0
Light now stays off even when motion sensor is triggered (same when illuminance sensor triggers). Automation fails. Automation debug section gives
So:
- doesn’t work. Don’t know why, would need a bit of automation debug skills (“template condition”)
- Even if it would work, the automation is triggered very very often (like it did already during the tests above) - as every illuminance sensor change triggers the automation. A “normal” hand-made automation would only trigger if also the appropriate brightness has been reached, e. g. with
trigger:
- platform: numeric_state
entity_id: sensor.illuminance
below: 6
I am very sure both things can be fixed by changing the blueprint itself. If another non-binary trigger entity (“secondary_trigger”) is set, the automation trigger needs to be combined with the numeric_value (threshold). That would really supercharge this automation.
Any other thing I can test to help this blueprint support this scenario?