Created
July 7, 2025 20:43
-
-
Save SnoFox/27a379a4179d9501e179ff63a7f2a1e6 to your computer and use it in GitHub Desktop.
Home Assistant automation example for adding actions to iOS notifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias: Remind home-dwellers to feed Pixel | |
description: "" | |
triggers: | |
- entity_id: | |
- schedule.pixel_food_time | |
from: "on" | |
to: "off" | |
trigger: state | |
conditions: [] | |
actions: | |
- variables: | |
action_feed: "{{ 'FEED_' ~ context.id }}" | |
action_ignore: "{{ 'IGNORE_' ~ context.id }}" | |
need_food: false | |
alias: Set up variables for the actions | |
- alias: If Pixel hasn't been fed, set need_food to true | |
choose: | |
- conditions: | |
- alias: Confirm it is afternoon | |
condition: time | |
after: "12:00:00" | |
before: "16:59:59" | |
- alias: Confirm she hasn't been fed | |
condition: numeric_state | |
entity_id: counter.pixel_meals_fed | |
below: 1 | |
sequence: | |
- variables: | |
need_food: true | |
alias: If Pixel hasn't been fed in the afternoon | |
- conditions: | |
- alias: Confirm it is evening | |
condition: time | |
after: "17:00:00" | |
before: "19:00:00" | |
- alias: Confirm she hasn't been fed | |
condition: numeric_state | |
entity_id: counter.pixel_meals_fed | |
below: 2 | |
sequence: | |
- variables: | |
need_food: true | |
alias: If Pixel hasn't been fed in the evening | |
- if: | |
- condition: template | |
value_template: "{{ need_food }}" | |
then: | |
- action: notify.mobile_app_kanzi | |
metadata: {} | |
data: | |
message: Have you considered feeding Pixel today? | |
title: "Cat become hungry " | |
data: | |
url: /config/devices/device/7ee7d8383ba72c3036b724d727ea4965 | |
clickAction: /config/devices/device/7ee7d8383ba72c3036b724d727ea4965 | |
actions: | |
- action: "{{ action_feed }}" | |
title: Feed | |
- action: "{{ action_ignore }}" | |
title: Ignore | |
- wait_for_trigger: | |
- trigger: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "{{ action_feed }}" | |
- trigger: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "{{ action_ignore }}" | |
continue_on_timeout: true | |
timeout: | |
hours: 5 | |
minutes: 0 | |
seconds: 0 | |
milliseconds: 0 | |
- choose: | |
- conditions: | |
- condition: template | |
value_template: "{{ wait.trigger == none }}" | |
sequence: | |
- action: notify.mobile_app_kanzi | |
metadata: {} | |
data: | |
title: Pixel is hungry | |
message: >- | |
Pixel wasn't fed after the last notification, and it is now | |
invalid | |
alias: Trigger timeout | |
- conditions: | |
- condition: template | |
value_template: "{{ wait.trigger.event.data.action == action_feed }}" | |
sequence: | |
- device_id: 7ee7d8383ba72c3036b724d727ea4965 | |
domain: button | |
entity_id: 86741fe65e2d9d37683c94f34b1753d3 | |
type: press | |
alias: Feed action | |
- conditions: | |
- condition: template | |
value_template: "{{ wait.trigger.event.data.action == action_ignore }}" | |
sequence: [] | |
alias: Ignore action | |
default: | |
- action: notify.mobile_app_kanzi | |
metadata: {} | |
data: | |
title: Pixel is hungry | |
message: >- | |
Pixel wasn't fed after the last notification, and it is now | |
invalid | |
mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment