I’ve made an alarm automation to notify myself if motion is detected or a door is opened at certain times, however it is not triggering. This is the config:
- id: '1558813254853'
alias: Home Alarm
trigger:
- entity_id: binary_sensor.0x00158d00028ab3b7_occupancy
platform: state
to: 'on'
- entity_id: binary_sensor.0x00158d0002c6698c_contact
platform: state
to: 'on'
condition:
- condition: time
after: '00:00:00'
before: '06:00:00'
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
after: '08:00:00'
before: '12:00:00'
- condition: time
weekday:
- mon
- tue
- thu
after: '12:00:00'
before: '15:00:00'
action:
- data:
message: Home alarm triggered!
service: notify.mobile_app_phone'''
Any ideas what is wrong? I believe it must be something with the time condition as when I have an automation that removes the time condition it works fine.
first of all please enclose your code inside triple single quotes to preserve formatting as it’s crucial here.
I believe you can edit your post, no need to re-post.
to your automation as per docs.
also, I’m not quite sure about the action section, would prefer it like that:
action:
service: notify.mobile_app_phone
data:
message: Home alarm triggered!
When you correct your code, also try to trigger it manually, i.e find in developers page and click on the Trigger switch to see it runs at all.
Also, it might be easier to start with no/less conditions and then gradually add them checking if it still works.