Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 101645

Simple switch schedule automation to control a water heater

$
0
0

@davidusb wrote:

Dear all.
I’m trying to implement a simple scheduled switch automation to control a water heater.
For now I just want to turn on the water heater at a given time. For this I’m using a input_datetime. This is working fine. My problem is to turn off the heater. I want to use an input_select to let the user choose a delay (in hours) to turn off the heater. I can’t get this to work. With my above code I get the heater on at the desired time but it doesn’t turn off one hour later.
What I’m doing wrong?
Thank you for your help.

  - alias: 'Water Heather automation'
    trigger:
      - platform: template
        value_template: "{{ states.sensor.time.state == states.input_datetime.water_heater_on_time.state[0:5] }}"
    action:
    - service: switch.turn_on
      entity_id: switch.water_heater
        
  - alias: 'Water Heather OFF 1h'
    initial_state: true
    hide_entity: True
    trigger:
      - platform: template
        value_template: "{{ now().hour * 3600 > states.input_datetime.water_heater_on_time.attributes.timestamp + 3600 | int and is_state('input_select.water_heater_mode','1h') }}"
    action:
    - service: homeassistant.turn_off
      entity_id: switch.water_heater

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 101645

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>