Hi all, tried a few things but can’t get this to work. One of my automations below with lights on motion works fine (Alias - Turn on outside front lights when motion is detected) now I want to add a condition with time, want it to only trigger between 7pm and 6am, how do I add this condition?
I have a couple of other issues, e.g. notifications to WebOS doesn’t work, and after adding HomeBridge and integrating Apple HomeKit, my home automation controls / buttons on the Home Assistant GUI (Automation tab) don’t do anything, they’ll trigger even when I turn them off. This is another issue I can deal with later.
Your help here is much appreciated.
alias: iOS notification when motion is detected
trigger:
platform: state
entity_id: sensor.aeotec_zw100_multisensor_6_burglar
from: ‘0’
to: ‘8’
action:
service: notify.ios_ashors_iphone
data:
message: “Motion detected outside front door!”
alias: webOS notification when motion is detected
trigger:
platform: state
entity_id: sensor.aeotec_zw100_multisensor_6_burglar
from: ‘0’
to: ‘8’
action:
service: notify.living_room_tv
data:
message: “Motion detected outside front door!”
alias: Turn on outside front lights when motion is detected
trigger:
platform: state
entity_id: sensor.aeotec_zw100_multisensor_6_burglar
from: ‘0’
to: ‘8’
action:
service: homeassistant.turn_on
entity_id: switch.aeotec_zw132_dual_nano_switch_switch
alias: Turn off outside front lights 5 minutes after last movement
trigger:
platform: state
entity_id: sensor.aeotec_zw100_multisensor_6_burglar
from: ‘0’
to: ‘0’
for:
minutes: 5
action:
service: homeassistant.turn_off
entity_id: switch.aeotec_zw132_dual_nano_switch_switch
Alternatively, you could use the ‘sun’ component and it’s provided condition, so the action happens only during darkness (from dusk 'till dawn):
trigger:
....
condition:
condition: or # 'when dark' condition: either after sunset or before sunrise
conditions:
- condition: sun
after: sunset
- condition: sun
before: sunrise
action:
...
yaml is extremely syntax dependent. Spacing and indentation is important.
the only real way to help most of the time is to see your code in the format that you typed it into your configuration files. the best way to do that is when you copy your code to the editor, select it all and then click the pre-formatted text button ( </> ) at the top of the editor window.
- alias: iOS notification when motion is detected
trigger:
platform: state
entity_id: sensor.aeotec_zw100_multisensor_6_burglar
from: '0'
to: '8'
action:
service: notify.ios_ashors_iphone
data:
message: "Motion detected outside front door!"
- alias: webOS notification when motion is detected
trigger:
platform: state
entity_id: sensor.aeotec_zw100_multisensor_6_burglar
from: '0'
to: '8'
action:
service: notify.living_room_tv
data:
message: "Motion detected outside front door!"
- alias: Turn on outside front lights when motion is detected
trigger:
platform: state
entity_id: sensor.aeotec_zw100_multisensor_6_burglar
from: '0'
to: '8'
action:
service: homeassistant.turn_on
entity_id: switch.aeotec_zw132_dual_nano_switch_switch
- alias: Turn off outside front lights 5 minutes after last movement
trigger:
platform: state
entity_id: sensor.aeotec_zw100_multisensor_6_burglar
from: '0'
to: '0'
for:
minutes: 5
action:
service: homeassistant.turn_off
entity_id: switch.aeotec_zw132_dual_nano_switch_switch