Initial Commit
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
blueprint:
|
||||
name: Confirmable Notification
|
||||
description: >-
|
||||
A script that sends an actionable notification with a confirmation before
|
||||
running the specified action.
|
||||
domain: script
|
||||
source_url: https://github.com/home-assistant/core/blob/master/homeassistant/components/script/blueprints/confirmable_notification.yaml
|
||||
author: Home Assistant
|
||||
input:
|
||||
notify_device:
|
||||
name: Device to notify
|
||||
description: Device needs to run the official Home Assistant app to receive notifications.
|
||||
selector:
|
||||
device:
|
||||
filter:
|
||||
integration: mobile_app
|
||||
title:
|
||||
name: "Title"
|
||||
description: "The title of the button shown in the notification."
|
||||
default: ""
|
||||
selector:
|
||||
text:
|
||||
message:
|
||||
name: "Message"
|
||||
description: "The message body"
|
||||
selector:
|
||||
text:
|
||||
confirm_text:
|
||||
name: "Confirmation Text"
|
||||
description: "Text to show on the confirmation button"
|
||||
default: "Confirm"
|
||||
selector:
|
||||
text:
|
||||
confirm_action:
|
||||
name: "Confirmation Action"
|
||||
description: "Action to run when notification is confirmed"
|
||||
default: []
|
||||
selector:
|
||||
action:
|
||||
dismiss_text:
|
||||
name: "Dismiss Text"
|
||||
description: "Text to show on the dismiss button"
|
||||
default: "Dismiss"
|
||||
selector:
|
||||
text:
|
||||
dismiss_action:
|
||||
name: "Dismiss Action"
|
||||
description: "Action to run when notification is dismissed"
|
||||
default: []
|
||||
selector:
|
||||
action:
|
||||
|
||||
mode: restart
|
||||
|
||||
sequence:
|
||||
- alias: "Set up variables"
|
||||
variables:
|
||||
action_confirm: "{{ 'CONFIRM_' ~ context.id }}"
|
||||
action_dismiss: "{{ 'DISMISS_' ~ context.id }}"
|
||||
- alias: "Send notification"
|
||||
domain: mobile_app
|
||||
type: notify
|
||||
device_id: !input notify_device
|
||||
title: !input title
|
||||
message: !input message
|
||||
data:
|
||||
actions:
|
||||
- action: "{{ action_confirm }}"
|
||||
title: !input confirm_text
|
||||
- action: "{{ action_dismiss }}"
|
||||
title: !input dismiss_text
|
||||
- alias: "Awaiting response"
|
||||
wait_for_trigger:
|
||||
- platform: event
|
||||
event_type: mobile_app_notification_action
|
||||
event_data:
|
||||
action: "{{ action_confirm }}"
|
||||
- platform: event
|
||||
event_type: mobile_app_notification_action
|
||||
event_data:
|
||||
action: "{{ action_dismiss }}"
|
||||
- choose:
|
||||
- conditions: "{{ wait.trigger.event.data.action == action_confirm }}"
|
||||
sequence: !input confirm_action
|
||||
- conditions: "{{ wait.trigger.event.data.action == action_dismiss }}"
|
||||
sequence: !input dismiss_action
|
||||
@@ -0,0 +1,129 @@
|
||||
blueprint:
|
||||
name: 'Sleep as Android: Trigger app actions'
|
||||
description: 'Send commands to the Sleep as Android app on your selected mobile
|
||||
device via Home Assistant. Requires the device to run the official Home Assistant
|
||||
companion app.
|
||||
|
||||
'
|
||||
domain: script
|
||||
author: tr4nt0r
|
||||
input:
|
||||
notify_device:
|
||||
name: Target device
|
||||
description: 'The mobile device running Sleep as Android. Must have the official
|
||||
Home Assistant companion app installed and connected.
|
||||
|
||||
'
|
||||
selector:
|
||||
device:
|
||||
filter:
|
||||
- integration: mobile_app
|
||||
multiple: false
|
||||
sleep_action:
|
||||
name: Action
|
||||
description: 'The specific Sleep as Android command to trigger
|
||||
|
||||
'
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- label: Start sleep tracking
|
||||
value: com.urbandroid.sleep.alarmclock.START_SLEEP_TRACK
|
||||
- label: Start sleep tracking + Set an alarm for ideal sleep length
|
||||
value: com.urbandroid.sleep.alarmclock.START_SLEEP_TRACK_WITH_IDEAL_ALARM_ACTION
|
||||
- label: Stop sleep tracking
|
||||
value: com.urbandroid.sleep.alarmclock.STOP_SLEEP_TRACK
|
||||
- label: Pause sleep tracking for 5 minutes
|
||||
value: com.urbandroid.sleep.ACTION_PAUSE_TRACKING
|
||||
- label: Snooze alarm
|
||||
value: com.urbandroid.sleep.alarmclock.ALARM_SNOOZE
|
||||
- label: Dismiss alarm
|
||||
value: com.urbandroid.sleep.alarmclock.ALARM_DISMISS_CAPTCHA
|
||||
- label: Stop lullaby
|
||||
value: com.urbandroid.sleep.ACTION_LULLABY_STOP_PLAYBACK
|
||||
- label: Request backup
|
||||
value: com.urbandroid.sleep.REQUEST_SYNC
|
||||
- label: Change alarm state (when not currently ringing)
|
||||
value: com.urbandroid.sleep.alarmclock.ALARM_STATE_CHANGE
|
||||
multiple: false
|
||||
sort: false
|
||||
custom_value: false
|
||||
section_extra_snooze_time:
|
||||
name: Snooze alarm extras
|
||||
icon: mdi:alarm-snooze
|
||||
collapsed: true
|
||||
input:
|
||||
extra_snooze_time:
|
||||
name: Extra snooze time (optional)
|
||||
description: 'Override the snooze duration for this alarm (1–60 minutes). Leave
|
||||
blank to use the default snooze time set in the Sleep as Android app.
|
||||
|
||||
'
|
||||
selector:
|
||||
number:
|
||||
min: 1.0
|
||||
max: 60.0
|
||||
unit_of_measurement: minutes
|
||||
mode: box
|
||||
step: 1.0
|
||||
default: ''
|
||||
section_alarm_state_change:
|
||||
name: Change alarm state extras
|
||||
icon: mdi:alarm
|
||||
description: These settings are required when using the "Change alarm state"
|
||||
action.
|
||||
collapsed: true
|
||||
input:
|
||||
alarm_label:
|
||||
name: Alarm label
|
||||
description: 'The label of the alarm to modify. Must explicitly set **in
|
||||
the Sleep as Android app** for this action to work. If multiple alarms
|
||||
share this label, only one will be changed (no guarantee which).
|
||||
|
||||
'
|
||||
selector:
|
||||
text: {}
|
||||
default: Alarm
|
||||
alarm_state:
|
||||
name: Enable or disable
|
||||
description: 'Select whether the specified alarm should be turned on (enabled)
|
||||
or turned off (disabled).
|
||||
|
||||
'
|
||||
selector:
|
||||
boolean: {}
|
||||
default: false
|
||||
section_start_in_battery_saving_mode:
|
||||
name: Start sleep tracking extras
|
||||
icon: mdi:record-rec
|
||||
collapsed: true
|
||||
input:
|
||||
start_in_battery_saving_mode:
|
||||
name: Start in battery saving mode
|
||||
description: Start sleep tracking with reduced power usage to save battery.
|
||||
selector:
|
||||
boolean: {}
|
||||
default: false
|
||||
source_url: https://community.home-assistant.io/t/sleep-as-android-trigger-app-actions/920845
|
||||
mode: parallel
|
||||
sequence:
|
||||
- variables:
|
||||
sleep_action: !input sleep_action
|
||||
alarm_label: !input alarm_label
|
||||
alarm_state: !input alarm_state
|
||||
extra_snooze_time: !input extra_snooze_time
|
||||
start_in_battery_saving_mode: !input start_in_battery_saving_mode
|
||||
- alias: Send intent to Sleep as Android
|
||||
domain: mobile_app
|
||||
type: notify
|
||||
device_id: !input notify_device
|
||||
message: command_broadcast_intent
|
||||
data:
|
||||
intent_package_name: com.urbandroid.sleep
|
||||
intent_action: !input sleep_action
|
||||
intent_extras: "{% if sleep_action == 'com.urbandroid.sleep.alarmclock.ALARM_STATE_CHANGE'
|
||||
and alarm_label %}\n alarm_label:{{ alarm_label }},alarm_enabled:{{ alarm_state
|
||||
}}\n{% elif sleep_action == 'com.urbandroid.sleep.alarmclock.ALARM_SNOOZE' and
|
||||
extra_snooze_time %}\n extra_snooze_time:{{ extra_snooze_time }}\n{% elif sleep_action
|
||||
== 'com.urbandroid.sleep.alarmclock.START_SLEEP_TRACK' and start_in_battery_saving_mode
|
||||
%}\n START_IN_BATTERY_SAVING_MODE:true\n{% endif %}"
|
||||
Reference in New Issue
Block a user