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.
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.
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?
“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.
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?)?
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 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).
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
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
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…
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).