For quite some time I've been using a sensor so that I could easily start up most of my automations based on it either being a weekday or weekend:
- sensor:
- name: Room Wake up time
device_class: timestamp
state: >
{% set weekday = today_at("07:20") %}
{% set weekend = today_at("09:20") %}
{{ iif(is_state('binary_sensor.workday_sensor', 'on'), weekday, weekend) }}
That could easily trigguer automations with :
at: sensor.room_wake_up_time
trigger: time
But now I wanted to be able to edit these values in a more convenient way through the dashboard (without having to edit the yaml file and reload HA)
So I've been playing with input.daytime for this purpose.
But I've honestly hit a roadblock.
I've tested triggering directly from the input_datetimes and it works. But this would required an if condition on every automation I have done so far in order to work with the binary option of weekday/weekend.
Am I missing something simple?
- sensor:
- name: Room Wake up time
device_class: timestamp
state: >
{% set weekday = states('input_datetime.weekday_wake_up_time') %}
{% set weekend = states('input_datetime.weekend_wake_up_time') %}
{{ weekday if is_state('binary_sensor.workday_sensor', 'on') else weekend }}
input_datetime:
weekday_wake_up_time:
name: Weekday Wake Up Time
has_date: false
has_time: true
initial: '07:20:00' # Default time for weekdays
icon: mdi:clock
weekend_wake_up_time:
name: Weekend Wake Up Time
has_date: false
has_time: true
initial: '09:20:00' # Default time for weekends
icon: mdi:clock