In my case I’m trying to get my door locks to all automatically lock at night, and then report to my phone if there’s a problem (ie Lock is jammed or didn’t lock due to door being open, etc). This is the default action for my “choose” tree. When it executes, I get the notification on my Android (Samsung S21 Plus) but clicking on the notification doesn’t cause it to go to the app. I’ve tried a handful of format changes and nothing has gotten it working. Any insight?
default:
- service: notify.mobile_app_russ_phones21plus
data:
message: >-
SECURITY ALERT<br> {% if is_state('binary_sensor.alarm_side_entry_door',
'off') and is_state('lock.side_door_lock','locked') and
is_state('binary_sensor.side_door_lock_access_control_lock_jammed','off')
%} Side Door is Locked {% elif
is_state('binary_sensor.side_door_lock_access_control_lock_jammed','on')
%} Side Door is JAMMED {% else %} Side Door is Unlocked {% endif %}
title: SECURITY ALERT
data:
sticky: true
action: URI
title: "Open Security Tab"
uri: "/lovelace/security"
I have also tried these
default:
- service: notify.mobile_app_russ_phones21plus
data:
message: >-
SECURITY ALERT<br> {% if is_state('binary_sensor.alarm_side_entry_door',
'off') and is_state('lock.side_door_lock','locked') and
is_state('binary_sensor.side_door_lock_access_control_lock_jammed','off')
%} Side Door is Locked {% elif
is_state('binary_sensor.side_door_lock_access_control_lock_jammed','on')
%} Side Door is JAMMED {% else %} Side Door is Unlocked {% endif %}
title: SECURITY ALERT
data:
- actions:
sticky: true
action: URI
uri: "/lovelace/security"
this one doesn’t give me any errors when saving, but doesn’t actually send the message either.
default:
- service: notify.mobile_app_russ_phones21plus
data:
message: >-
SECURITY ALERT<br> {% if is_state('binary_sensor.alarm_side_entry_door',
'off') and is_state('lock.side_door_lock','locked') and
is_state('binary_sensor.side_door_lock_access_control_lock_jammed','off')
%} Side Door is Locked {% elif
is_state('binary_sensor.side_door_lock_access_control_lock_jammed','on')
%} Side Door is JAMMED {% else %} Side Door is Unlocked {% endif %}
title: SECURITY ALERT
- actions:
sticky: true
action: URI
uri: /lovelace/security
For android, here’s an example from my own automations:
- service: notify.all_mobile
data:
title: "Security Alert"
message: "The Garage Door has been open for <b>{{ (15 + ((repeat.index - 1) * 5)) }}</b> minutes."
data:
image: "{{ states('sensor.snapshot_remote_garage') }}{{ notify_image }}"
clickAction: "/lovelace/camera_garage"
ttl: 0
color: red
priority: high
tag: garage_door_open
channel: Security Alert
group: Security
actions:
- action: "URI"
title: "View Camera"
uri: "/lovelace/camera_garage"
- action: "alert_close_garage_door"
title: "Close Door"
The URI action launches the HA Companion App on the specified tab (a streamed view of the camera).
Looking at your automations and the documentation you are missing some of the structure - I’m a bit rushed, but the below should work I think:
default:
- service: notify.mobile_app_russ_phones21plus
data:
message: >-
SECURITY ALERT<br> {% if is_state('binary_sensor.alarm_side_entry_door',
'off') and is_state('lock.side_door_lock','locked') and
is_state('binary_sensor.side_door_lock_access_control_lock_jammed','off')
%} Side Door is Locked {% elif
is_state('binary_sensor.side_door_lock_access_control_lock_jammed','on')
%} Side Door is JAMMED {% else %} Side Door is Unlocked {% endif %}
title: SECURITY ALERT
data:
sticky: true
actions:
- action: "URI"
title: "Open Security Tab"
uri: "/lovelace/security"
Thank you - that does appear to work, albeit not quite how i had pictured.
If I expand the alert on my phone then I get a button i can click and it does open the tab in HA.
I was hoping to have the app open by just clicking on the alert message itself. Is this possible?
I’m looking through the link pedolsky posted as well, but I’m not getting that lightbulb moment.
That was the exact bit I was missing. But now I’m excited about the possibilities with the buttons and responses possible.
Now I can figure out how to add a “lock doors” button so if I can lock the doors when the wife forgets.
That “Close Door” button triggers an automation to close the garage door based on the action (as event_data), removes the “door open” notification identified by it’s unique tag and sends a follow up notification with camera image confirming closure: