Hi all. New to HA and having a few small issues regarding coding, im not able to add another phone to notify when the alarm first goes into pending without getting errors, any help greatly appreciated, thanks.
#konnected alarm
- alias: "Alarm - Trigger when sensors go off"
trigger:
- platform: state
entity_id: binary_sensor.tamper
to: 'on'
- platform: state
entity_id: binary_sensor.hallway
to: 'on'
- platform: state
entity_id: binary_sensor.bar_garage
to: 'on'
- platform: state
entity_id: binary_sensor.kitchen
to: 'on'
- platform: state
entity_id: binary_sensor.lounge
to: 'on'
# Add more triggers here for other doors/windows
condition:
# Only trigger the alarm if it's armed
condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.alarm
state: armed_home
- condition: state
entity_id: alarm_control_panel.alarm
state: armed_away
action:
service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.alarm
- alias: "Alarm - Triggered"
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
to: "triggered"
action:
- service: homeassistant.turn_on
entity_id: switch.siren
- alias: "Alarm - Pending"
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
from: "armed_away" # No need for armed_home, there's no pending delay there.
to: "pending"
action:
- delay: 00:00:05 # Small delay for "Announce" automation to run.
- service: notify.mobile_app_Steveiphone
data:
message: ALARM TRIGGERED! PLEASE DISARM!
- service: notify.alexa_media
data:
target:
- media_player.steven_s_echo_dot
data:
type: announce
message: "Please disarm the alarm"
# Start a timer to repeat the warning
- service: timer.start
entity_id: timer.alarm_pending
- alias: "Alarm - Pending Repeat"
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.alarm_pending
condition:
condition: state
entity_id: alarm_control_panel.alarm
state: pending
action:
- service: notify.alexa_media
data:
target:
- media_player.steven_s_echo_dot
data:
type: announce
message: "Disarm the alarm now or i will fucking deafen you!"
# Restart the timer
- service: timer.start
entity_id: timer.alarm_pending
- alias: "Alarm - Disarmed"
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
to: "disarmed"
action:
# Turn off the siren once the alarm is disarmed
- service: homeassistant.turn_off
entity_id: switch.siren
# Stop the warning repeat timer
- service: timer.cancel
entity_id: timer.alarm_pending
Also any help regarding making an Tuya led strip scene for when the alarm goes into pending state and switching off after 30 seconds would also be greatly appreciated.
What error are you getting?
Do the two notify.mobile_app_xxxxx notifications BOTH work on there own?
(if you replace Steveiphone with only Sophieiphone) does it still work?
Also have you considered simply making a group notify for the two of you?
Edit: if you are ever in doubt, then a useful tip is to go to Developer Tools, Services and fill out the service and data in question in the Ui and then click on “GO TO YAML MODE” to see the underlying yaml formatting and spacing etc
perfect that works, thank you! still not sure what is different between those two other than that the “data:” field is slightly forwards lol
Have you any idea about me using my alarm to trigger a Tuya led strip with a red/blue flashing scene for like 30 seconds ? never quite expected to find all this so hard since i used to do java coding years ago haha