Here’s hoping someone can assist. I have an automation that turns lights on based on motion or vibration (with a lux sensor in there too).
Is there a way to not trigger the automation if the lights were manually turned on by my Google Home?
According to the logbook, I can see when the lights have been turned on/off by Google Home, but I dont know how to get it to be a condition of the automation.
The automation (blueprint) looks like this:
blueprint:
name: Vibration-activated Light with illuminance
description: Turn on a light when vibration is detected and illuminance is below a
set Lux level.
domain: automation
input:
vibration_entity:
name: vibration Sensor
selector:
entity:
domain: binary_sensor
device_class: vibration
multiple: false
lux_entity:
name: Illuminance Sensor
selector:
entity:
domain: sensor
device_class: illuminance
multiple: false
lux_level:
name: Illuminance level
description: If lux is below this value and vibration is detected, the light will
turn on.
default: 100
selector:
number:
min: 0.0
max: 1000.0
step: 1.0
mode: slider
light_target:
name: Light
selector:
target:
entity:
domain: light
no_vibration_wait:
name: Wait time
description: Time to leave the light on after last vibration is detected.
default: 120
selector:
number:
min: 0.0
max: 3600.0
unit_of_measurement: seconds
step: 1.0
mode: slider
brightness:
name: Light brightness
description: The brightness of the lights.
default: 254
selector:
number:
min: 5.0
max: 255.0
step: 1.0
mode: slider
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input 'vibration_entity'
from: 'off'
to: 'on'
condition:
condition: and
conditions:
- condition: numeric_state
entity_id: !input 'lux_entity'
below: !input 'lux_level'
action:
- service: light.turn_on
data:
brightness: !input 'brightness'
target: !input 'light_target'
- wait_for_trigger:
platform: state
entity_id: !input 'vibration_entity'
from: 'on'
to: 'off'
- delay: !input 'no_vibration_wait'
- service: light.turn_off
target: !input 'light_target'
I had thought a value template would be a solution, but I’m not sure how to go about it.
Probably the “long road arround the problem” will be the easy one.
Create a new automation, triggered by on light on. Check the user for the light-on statement. If it is Google Home, set a Helper to on, and then use tis helper as a condition in you automation.
My YAML skills are not sufficient to figure out what’s wrong. It looks good for me.
However, you blueprint logic is a little sub-optimal, if you ask me. It will wait for no-motion and then it will do a delay before turning off. If someone enteres into the room again, it will re-trigger. With this simple turn on/off it will work, as it will just turn on the light again. However if you have transistions of light etc, it will re-trigger and this will be visible.
I normally use the “for-time” in the trigger, to secure that it have been “off” for a given time. Looking like this.
trigger:
- platform: state
entity_id: group.badmotion
to: 'off'
for:
hours: 0
minutes: 8
seconds: 0
AHA! It seems that using ‘input_boolean’ or ‘boolean’ in the input section of the blueprint upset it. Once I changed it go ‘GH’ it is working with no errors.