Actionable notification question
-
Good morning,
I'm running Home Assistant with MSR, and I do my automation strictly within MSR. I have some basic notifications set up, for instance, when my dishwasher has completed it's cycle, it'll send my iPhone a push notification via the x_haas.system.call_service --> notify.mobile_iphone action.I saw in the Home Assistant documentation that you can push Actionable Notifications. The example they use if there is motion detection, but no one is home, you can sound an alarm or silence an alarm.
Can this be done from MSR and not directly in Home Assistant? I'd like to do something more of an acknowledgement, like if a door or window is left open, to have a way to get notified, but acknowledge that it is open, and not send any more notifications. If not acknowledged, the notification will continue every 5 or 10 minutes until the door or window is closed, or the notification is acknowledged. This would be useful in situations where I may have a slider door open for some fresh air, so it was deliberate, versus an entry door that didn't latch when entering or leaving the house.
-
I haven't found a way to create actionable notifications in MSR because HA doesn't expose the
mobile_app_notification_action
event. The way I do it instead is create the actionable notification action in HA then have MSR trigger it.@Pabla I like this.
I do something similar with my LIFX bulbs. For some yet-to-be-discovered reason two of them turn on during the day. My Hubitat integration were they live does not see it... but my HA integration does. So I created a ruleset in MSR that watches the HA version of the lights and fires an HA automation that turns them off.
More than one way to get to the circus!
-
I haven't found a way to create actionable notifications in MSR because HA doesn't expose the
mobile_app_notification_action
event. The way I do it instead is create the actionable notification action in HA then have MSR trigger it.@Pabla said in Actionable notification question:
I haven't found a way to create actionable notifications in MSR because HA doesn't expose the mobile_app_notification_action event.
I'm not exactly sure what you mean or intend here, but I just ran a quick test using the service call HA provides in their documentation for Actionable Notifications (linked in the head post), and Reactor does see the
mobile_app_notification_action
event when a button is pressed on the mobile app notification (Android tested). Here's the service call I made:service: notify.mobile_app_sm_g996u data: message: "Something happened at home!" data: actions: - action: "ALARM" title: "Sound Alarm" icon: "sfsymbols:bell" - action: "SILENCE" title: "Silence Alarm" icon: "sfsymbols:bell.slash"
When the Sound Alarm button on the notifications is pressed, Reactor gets this event:
{ "type": "event", "event": { "event_type": "mobile_app_notification_action", "data": { "action_2_title": "Silence Alarm", "webhook_id": "2f7fba8991b3bfac3a5fb46ace19cd6d616becb829aecb5a8ae2a2ece759052f", "message": "Something happened at home!", "action_1_title": "Sound Alarm", "action_1_key": "ALARM", "action_2_key": "SILENCE", "server_id": "1", "action": "ALARM", "device_id": "c8458cf66b182e07" }, "origin": "REMOTE", "time_fired": "2024-01-23T00:59:00.722438+00:00", "context": { "id": "01HMSX7RQJDJYFFQPJFWX8HEG8", "parent_id": null, "user_id": "459ddf6f84b14de98f4c65e2d2da2dc6" } }, "id": 1705971523928 }
So in Reactor, I can configure an event reaction (in
reactor.yaml
for a HassController instance):config: # this line is for alignment only event_targets: notification_sound_alarm: capabilities: - binary_sensor events: - event: event_type: mobile_app_notification_action data: device_id: "c8458cf66b182e07" action: "ALARM" response: "binary_sensor.state": expr: "! entity.attributes.binary_sensor.state"
This trivial event handler just toggles the
binary_sensor.state
attribute in the associated virtual device it creates (having IDnotification_sound_alarm
), every time the event is received.Works a treat. Really cool actually. Actionable Notifications... TIL.
Ref to docs for creating event handlers: https://reactor.toggledbits.com/docs/HassController/#handling-home-assistant-events
-
@Pabla said in Actionable notification question:
I haven't found a way to create actionable notifications in MSR because HA doesn't expose the mobile_app_notification_action event.
I'm not exactly sure what you mean or intend here, but I just ran a quick test using the service call HA provides in their documentation for Actionable Notifications (linked in the head post), and Reactor does see the
mobile_app_notification_action
event when a button is pressed on the mobile app notification (Android tested). Here's the service call I made:service: notify.mobile_app_sm_g996u data: message: "Something happened at home!" data: actions: - action: "ALARM" title: "Sound Alarm" icon: "sfsymbols:bell" - action: "SILENCE" title: "Silence Alarm" icon: "sfsymbols:bell.slash"
When the Sound Alarm button on the notifications is pressed, Reactor gets this event:
{ "type": "event", "event": { "event_type": "mobile_app_notification_action", "data": { "action_2_title": "Silence Alarm", "webhook_id": "2f7fba8991b3bfac3a5fb46ace19cd6d616becb829aecb5a8ae2a2ece759052f", "message": "Something happened at home!", "action_1_title": "Sound Alarm", "action_1_key": "ALARM", "action_2_key": "SILENCE", "server_id": "1", "action": "ALARM", "device_id": "c8458cf66b182e07" }, "origin": "REMOTE", "time_fired": "2024-01-23T00:59:00.722438+00:00", "context": { "id": "01HMSX7RQJDJYFFQPJFWX8HEG8", "parent_id": null, "user_id": "459ddf6f84b14de98f4c65e2d2da2dc6" } }, "id": 1705971523928 }
So in Reactor, I can configure an event reaction (in
reactor.yaml
for a HassController instance):config: # this line is for alignment only event_targets: notification_sound_alarm: capabilities: - binary_sensor events: - event: event_type: mobile_app_notification_action data: device_id: "c8458cf66b182e07" action: "ALARM" response: "binary_sensor.state": expr: "! entity.attributes.binary_sensor.state"
This trivial event handler just toggles the
binary_sensor.state
attribute in the associated virtual device it creates (having IDnotification_sound_alarm
), every time the event is received.Works a treat. Really cool actually. Actionable Notifications... TIL.
Ref to docs for creating event handlers: https://reactor.toggledbits.com/docs/HassController/#handling-home-assistant-events
@toggledbits Every time I think I have Reactor figured out I always end up learning something new! Will defs be playing with this
-
@Pabla said in Actionable notification question:
I haven't found a way to create actionable notifications in MSR because HA doesn't expose the mobile_app_notification_action event.
I'm not exactly sure what you mean or intend here, but I just ran a quick test using the service call HA provides in their documentation for Actionable Notifications (linked in the head post), and Reactor does see the
mobile_app_notification_action
event when a button is pressed on the mobile app notification (Android tested). Here's the service call I made:service: notify.mobile_app_sm_g996u data: message: "Something happened at home!" data: actions: - action: "ALARM" title: "Sound Alarm" icon: "sfsymbols:bell" - action: "SILENCE" title: "Silence Alarm" icon: "sfsymbols:bell.slash"
When the Sound Alarm button on the notifications is pressed, Reactor gets this event:
{ "type": "event", "event": { "event_type": "mobile_app_notification_action", "data": { "action_2_title": "Silence Alarm", "webhook_id": "2f7fba8991b3bfac3a5fb46ace19cd6d616becb829aecb5a8ae2a2ece759052f", "message": "Something happened at home!", "action_1_title": "Sound Alarm", "action_1_key": "ALARM", "action_2_key": "SILENCE", "server_id": "1", "action": "ALARM", "device_id": "c8458cf66b182e07" }, "origin": "REMOTE", "time_fired": "2024-01-23T00:59:00.722438+00:00", "context": { "id": "01HMSX7RQJDJYFFQPJFWX8HEG8", "parent_id": null, "user_id": "459ddf6f84b14de98f4c65e2d2da2dc6" } }, "id": 1705971523928 }
So in Reactor, I can configure an event reaction (in
reactor.yaml
for a HassController instance):config: # this line is for alignment only event_targets: notification_sound_alarm: capabilities: - binary_sensor events: - event: event_type: mobile_app_notification_action data: device_id: "c8458cf66b182e07" action: "ALARM" response: "binary_sensor.state": expr: "! entity.attributes.binary_sensor.state"
This trivial event handler just toggles the
binary_sensor.state
attribute in the associated virtual device it creates (having IDnotification_sound_alarm
), every time the event is received.Works a treat. Really cool actually. Actionable Notifications... TIL.
Ref to docs for creating event handlers: https://reactor.toggledbits.com/docs/HassController/#handling-home-assistant-events
@toggledbits, it's going to take soem time to wrap my head around everything you posted, but it's great to know it's possible!
-
I realize the documentation on configuring event handlers isn't great. I've made some updates and will post them later today, but I still feel it needs work. Feel free to ask questions and make suggestions; then I'll know what holes to fill.
-
T toggledbits locked this topic on