Mapping schedule helpers to devices

I’m exploring the use of schedule helpers. My use case is a plug switch that I’d like to turn off/on at a regular schedule - seems perfect for a helper, right? Here is the general automation code:

id: 'readinglight'
alias: 'Reading Light'
trigger:
  - platform: state
    entity_id: schedule.bedroom_light
condition:
  - condition: template
    value_template: "{{ trigger.to_state.state != 'unavailable' }}"
  - condition: template
    value_template: "{{ trigger.to_state.state != 'unknown' }}"
action:
  - service: >
      switch.turn_{{ trigger.to_state.state }}
    entity_id: switch.bedroom_light

I need the unavailable and unknown conditions because they effectively map to “off” during a home assistant reboot.

I have recently become aware of the scheduler custom component and and custom card, I’ll likely explore that further, but I’m first just trying to stick to core home assistant.

This seems like it would be a fairly common task. My question is - Is there a better way to do this, or an operator or service I’m not aware of that would more directly map a schedule to a device/entity, using core home assistant?

Thanks!

I have messed around with a few schedulers over the last year or so. The new helper in HA core is useful, but the granularity of 30 minutes is quite coarse. There are various schedulers in nodered that you could use, but then they are not accessible from the companion app / dashboard if that is what you want. I suggest that you look into the scheduler custom component :slight_smile: .