Use of generic thermostat along with manual timer

Hey guys, let me explain:

I have a gpio switch that turns my radiator on and off

switches.yaml:

  - platform: rpi_gpio
    ports:
     8: radiator_upstairs

I also have a template switch that uses two scripts to turn the gpio switch on and off according to a timer set by an input_number:

switches.yaml:

  - platform: template
    switches:
      #radiator auto off
      radiator_upstairs_auto:
        value_template: "{{ is_state('switch.radiator_upstairs' , 'on') }}"
        turn_on:
          service: script.turn_on
          entity_id: script.radiator_upstairs_auto_on
        turn_off:
          service: script.turn_on
          entity_id: script.radiator_upstairs_auto_off

and scripts,yaml:

######## Radiator  - upstairs
######## TIMED ON AND OFF
radiator_upstairs_auto_on:
  sequence: 
    - service: switch.turn_on
      entity_id: switch.radiator_upstairs
    - delay: '00:{{ states.input_number.radiator_timer_upstairs.state | int }}:00'
       # seconds: 3600
    - service: switch.turn_off
      entity_id: switch.radiator_upstairs

######## SIMPLE OFF  
radiator_upstairs_auto_off:
  sequence:
    - service: switch.turn_off
      entity_id: switch.radiator_upstairs      
    - service: script.turn_off
      entity_id: script.radiator_upstairs_auto_on

So far, so good.
The problem starts when i try to implement a generic Thermostat as an alternative to the timer.
I want to have both options available.

  - platform: generic_thermostat
    name: Upstairs
    heater: switch.radiator_upstairs
    target_sensor: sensor.dht_sensor_temperature
    min_temp: 15
    max_temp: 22
    target_temp: 15
    cold_tolerance: 0.3
    hot_tolerance: 0.5
    min_cycle_duration:
      seconds: 10

The thermostat works well when enabled.

On the other hand, as soon as i enable the code for the thermostat, it will screw up my timed template switch.
What happens is, i put the thermostat to a lower target temperature than the current, say my current is 18 and i set it at 15.
When i turn on the “manual” timed switch, the switch turns on, but is forced closed in ~30 seconds, leaving the radiator_upstairs_auto_on script running (i cant re-enable the template switch).
I came to the conclusion that the problem is the generic thermostat because i have disabled the last part of the code and the timer works as intended.

Any ideas?

Get your timed script to set the generic thermostat temperature rather than directly activating the switch?

Whoo!
Thats smart Sir!
Any hints on how to achieve that?

Service: climate.set_temperature
Entity_id : your generic thermostat
Temperature: the temp

Actually, i ve been fiddling a it more on the generic thermostat.
Is there a way i can change the operation_mode between “off” and “auto”?
What service should i call?

Here is the states page part:

climate.upstairs	off


current_temperature: 18.9
min_temp: 7
max_temp: 36
temperature: 22.5
operation_mode: off
operation_list: auto,off
unit_of_measurement: °C
friendly_name: Upstairs
supported_features: 129

Could i add a timed switch that would change that?
7

Use the climate.set_operation_mode service.

1 Like