Generic Thermostat on/off

Hello.

I think it would be useful to have a way of turning on/off a generic thermostat. I currently have one defined with a switch which I use for other things than the heater, when it’s Summer (for instance).

Ideas to achieve it:

  • Adding an OFF or N/A value to the temperature;
  • Allowing modes (in this case, sleep) for it.

With that in mind, afterwards I would also be able to schedule the thermostat as on/off using an automations.

Would this be feasible/make sense?

Thanks in advance.

This is already possible. What I do is set the temperature to 0 invoking the service climate.set_temperature, e.g.:

- alias: "Turn off heating when sumer"
  trigger:
    platform: state
    entity_id: input_boolean.summer
    from: 'off'
    to: 'on'
  action:
    - service: climate.set_temperature
      data:
        temperature: 0
1 Like

I do something similar to @kirichkov, setting the target temp very low to effectively turn off the generic thermostat. That being said, I would also like to see modes added to the generic thermostat. I think Sleep and Away mode, in addition to Off, would be very handy. It would be nice to be able to define these modes in the config, rather than having to set up several automations to set temperatures. You’d still need automatons to set the mode, but I think it would be cleaner.

I remember seeing a pull request about away and hold modes for the generic thermostat but those were rejected at the time, so I wouldn’t hold my breath.

What a pity, I think this would make sense.

Anyway, I’ll try to implement automation as you described above, good enough as a workaround.

Hello again.

I implemented your suggestion, but I cannot get the thermostat to be triggered properly. This is how it looks like (always shows Idle, no matter what the input_boolean says):

And here is my configuration.yaml bit:

# As per https://home-assistant.io/components/climate.generic_thermostat/
climate:
  - platform: generic_thermostat
    name: Sala
    heater: switch.tomada_sala
    target_sensor: sensor.temperatura_sala
    min_temp: 19
    max_temp: 25
    target_temp: 20
    tolerance: 1

# New switch to control if generic_thermostat above is to be on or off
input_boolean:
  temp_sala_auto:
    name: Termostato Sala
#    initial: off
    icon: mdi:thermometer-lines

# Control if generic_thermostat is to be on or off
- alias: "Thermostat On"
  trigger:
    platform: state
    entity_id: input_boolean.temp_sala_auto
    from: 'off'
    to: 'on'
  action:
    - service: climate.set_temperature
      data:
        entity_id: climate.sala
        temperature: '20'

- alias: "Thermostat Off"
  trigger:
    platform: state
    entity_id: input_boolean.temp_sala_auto
    from: 'on'
    to: 'off'
  action:
    - service: climate.set_temperature
      data:
        entity_id: climate.sala
        temperature: 0

Any ideas on why it doesn’t go out of Idle, no matter what?

Thanks in advance.

“Idle” means that it won’t turn on. This is also what I get displayed. However, there’s something off, you should normally get “Idle” without a temperature next to it.

It won’t show on/off, but because there’s no temperature next to it, I assume this is actually setting the setpoint to NULL, which means it shouldn’t turn on even if the temperature becomes negative. I believe I tested this using shell switch/shell sensor.

It won’t display “OFF” if that’s what you think it will, but the effect should be the same.

Nope.

My problem is that even when I have a temperature set (let’s say 25ºC when room temperature is 23ºC), it still shows ‘Idle’ and it doesn’t seem to turn on the plug (in my example switch.tomada_sala).

Can you try changing the temperature, just to check what should appear next to the temperature (should be Heat?)?

Thanks in advance.

Yes, I do get “Heat” instead of Idle, when the ambient temperature is LOWER than the set temperature. But what you have is a different issue then your first one :slight_smile: You have to post your generic thermostat configuration, and also let us know what plug are you using to control (I presume) the electric heater.

Please use the preformatted text in the editor when posting the configuration (the </> icon).

My configuration for the climate generic thermostat is as it is here and switch + sensor assigned to it, are defined like this:

switch:
  - platform: tplink
    host: 172.16.23.17
    name: "Tomada Sala"
sensor: 
  - platform: mqtt
    state_topic: "sensor_sala"
    name: "Temperatura Sala"
    unit_of_measurement: '°C'

Any idea of why it doesn’t change from Idle?

Thanks in advance.

Does the switch actually turn on? I’ve had issues with tp-link switches where they just stop responding to commands and queries. Can you check whether you can turn the switch at all, maybe it’s crashed. Inspecting the log (located in .homeassistant/home-assistant.log) can help as well

Yes, I can do it manually without issues (nothing in the log either).

Actually this same device has worked properly in the past but I temporarily stopped using it because I could not turn it off…

Once I brought this device again to try your suggestion, I can never get it to go out of Idle, no matter what.

I think that’s the problem - remove the quotation marks around 20! This way you are passing a string, and not a number. Remove the quotes and give it another try and report back :slight_smile:

Nope, same thing.

Even if that was the case, once I would change the temperature to one that should trigger the switch - from within the UI (not via automation), plug should be turned on… and it is not!

I think I have been playing before with set_away and set_mode methods and that may have caused any issue. I already tried changing the entity name, to see if it would make a difference, but also no…

does it turn manually if you switch it as a plug?

anything of use in the logs?

P.S. I mean switching the plug through the HASS UI, not using the physical button

Yep, that’s what I did before, it works perfectly and nothing shows in the logs…

Can you try adding the min_cycle_duration option to something low like 5 seconds.

Example is here: https://home-assistant.io/components/climate.generic_thermostat/

Other than that I’m out of options. I’ve used an HS110 with the generic thermostat component and it worked, but that was half a year ago or more

I tried adding min_cycle_duration and it actually seems to have started to work.

I will need to test more when I have the time, namely the usage you suggested of the input_boolean to turn the thermostat off/on (on restart, even if the previous input_boolean state is being reinstated after a restart using recorder, the thermostat temperature value is not being set accordingly).

Which switch do you have?

Where I live thermostats are simple short circuit two cables (on) or keep open (off). How you use a hs110?