If you have an Elf on the Shelf, you’ll probably know how annoying it is to keep track of moving it around every night. (If you don’t have one, be warned: It’s fun for like 3 days, but what you don’t realize is you doom yourself to several years of having to deceive your children.)
I came up with a simple automation that works with Android actionable notifications to remind about this. When you click “it was moved” on any phone, it updates all of them. Uses the ambiguous term “thing” for obvious reasons.
Unfortunately this can’t be a blueprint because each mobile notification is a unique service name, so you’ll have to modify this and duplicate the notification sections (under parallel
action) for every phone.
alias: Move the thing Android UI
description: ""
trigger:
- platform: time
id: send
at: "22:45:00"
- platform: event
event_type: mobile_app_notification_action
event_data:
action: done
id: action_done
alias: When 'done' clicked in notification
condition:
- condition: or
conditions:
- condition: trigger
id:
- action_done
- condition: template
value_template: >
{%- set now = now() -%} {{ (now.month == 11 and now.day == 31) or
(now.month == 12 and now.day <= 25) }}
alias: Before christmas
alias: Only trigger during December
action:
- choose:
- alias: Time
conditions:
- condition: trigger
id: send
sequence:
- parallel:
- service: notify.mobile_app_greg_phone
data:
message: Did you move the thing?
title: Time to move the thing
data:
channel: Move The Thing
tag: move-the-thing
persistent: true
timeout: 36000
notification_icon: mdi:google-street-view
actions:
- action: done
title: It was moved
- service: notify.mobile_app_partners_phone
data:
message: Did you move the thing?
title: Time to move the thing
data:
channel: Move The Thing
tag: move-the-thing
persistent: true
timeout: 36000
notification_icon: mdi:google-street-view
actions:
- action: done
title: It was moved
alias: Send reminder notification
- alias: Thing was moved
conditions:
- condition: trigger
id: action_done
sequence:
- parallel:
- service: notify.mobile_app_greg_phone
data:
message: >-
The thing was moved by
{{ states.person|selectattr("attributes.user_id", "==", trigger.event.context.user_id)|map(attribute="attributes.friendly_name")|first }}
on
{{ trigger.event.time_fired|as_timestamp|timestamp_custom("%A
at %I:%M %p") }}
title: Time to move the thing
data:
channel: Move The Thing
tag: move-the-thing
persistent: false
timeout: 1800
notification_icon: mdi:google-street-view
- service: notify.mobile_app_partners_phone
data:
message: >-
The thing was moved by
{{ states.person|selectattr("attributes.user_id", "==", trigger.event.context.user_id)|map(attribute="attributes.friendly_name")|first }}
on
{{ trigger.event.time_fired|as_timestamp|timestamp_custom("%A
at %I:%M %p") }}
title: Time to move the thing
data:
channel: Move The Thing
tag: move-the-thing
persistent: false
timeout: 1800
notification_icon: mdi:google-street-view
alias: Send "moved" notification
mode: restart