Skip to content

Instantly share code, notes, and snippets.

@Ultrawipf
Created March 9, 2022 21:10
Show Gist options
  • Save Ultrawipf/39399ed7aea20e060e448d3649c12766 to your computer and use it in GitHub Desktop.
Save Ultrawipf/39399ed7aea20e060e448d3649c12766 to your computer and use it in GitHub Desktop.
Homeassistant blueprint for storing an alarm time in a date helper
blueprint:
name: Alarmhelper
description: Stores alarm time in helper
domain: automation
source_url: https://gist.github.com/Ultrawipf/39399ed7aea20e060e448d3649c12766
input:
alarm:
name: Alarm timestamp sensor
description: 'Sensor with timestamp of next alarm with device_class: timestamp'
selector:
entity:
device_class: timestamp
helper:
name: Helper date
selector:
entity:
domain: input_datetime
offset:
name: Alarm offset
description: Offset from alarm
default: 0
selector:
number:
min: -600
max: 600
unit_of_measurement: seconds
variables:
offset: !input 'offset'
sensor: !input 'alarm'
trigger:
platform: state
entity_id: !input alarm
action:
service: input_datetime.set_datetime
data:
timestamp: '{{as_timestamp(states(sensor)) + offset}}'
target:
entity_id: !input helper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment