Turning on a switch between 2 times in a card

I want to start my boiler manually between 01:00 and 05:00 when i turn the switch_boiler ON. Since the time changes dayly i want to access the settings of the time in a card.

I have the:
time
time:on
time.off
switch_boiler

The time on and off i have in helper.
Whats the best way to do this. Can it be done in Automation or do i have to do it in yaml?

Ole

It can be done in the automation editor or yaml.

On automation:

trigger:
  - platform: time
    at: input_datetime.boiler_on_time
action:
  - service: switch.turn_on
    target:
      entity_id: switch.boiler

Off automation:

trigger:
  - platform: time
    at: input_datetime.boiler_off_time
action:
  - service: switch.turn_off
    target:
      entity_id: switch.boiler

There are ways to do this in one automation but two is simpler and easily entered in the automation editor.

1 Like

Thanks a lot tom_I
In C++ i define everything in variables. I have been looking for variables in HA but could not find them. Everything in HA is about the naming of things, Helpers, hmm… I just have to learn, but at years old 65 it’s not that easy.
So tank you for your time, it works perfect.

Ole

This applies to automations and scripts: Script Syntax - Home Assistant

To do it in one automation you could do something like this:

trigger:
  - id: 'on'
    platform: time
    at: input_datetime.boiler_on_time
  - id: 'off'
    platform: time
    at: input_datetime.boiler_off_time
action:
  - service: "switch.turn_{{ trigger_id }}"
    target:
      entity_id: switch.boiler
1 Like