custom-components / climate.programmable_thermostat

Programmable thermostat that let you have a smart thermostat on budget.
The Unlicense
115 stars 35 forks source link

Same device for heater and cooler #63

Closed grinco closed 1 year ago

grinco commented 1 year ago

Hey there, for air-to-air heatpump users, it would be useful if we could use the same climate device for both heating and cooling the room. The only difference is climate operation mode. Tried adding the same climate device to both heating and cooling entities, and it only heats the room.

Thanks for the great work!

thefelixno commented 1 year ago

Have you tried creating template-switches for your climate device? That gives you two separate switches, which will act on the same climate device. One switch for heating, one for cooling.

Like this, to give you an idea:

switch:
  - platform: template
    switches:
      heatpump_heating:
        value_template: "{{ is_state_attr('climate.heatpump', 'hvac_action', 'heating') }}"
        turn_on:
          service: climate.set_hvac_mode
          target:
            entity_id: climate.heatpump
          data:
            hvac_mode: heat
        turn_off:
          service: climate.turn_off
          target:
            entity_id: climate.heatpump
      heatpump_cooling:
        value_template: "{{ is_state_attr('climate.heatpump', 'hvac_action', 'cooling') }}"
        turn_on:
          service: climate.set_hvac_mode
          target:
            entity_id: climate.heatpump
          data:
            hvac_mode: cool
        turn_off:
          service: climate.turn_off
          target:
            entity_id: climate.heatpump

https://www.home-assistant.io/integrations/switch.template/

grinco commented 1 year ago

Great idea, I'll certainly give it a try. Thanks for the tip.

thefelixno commented 1 year ago

Glad I could help. I want to add, that you'll probably need two custom scripts, too:

Otherwise, if one switch is turned on, before the other one turned off, the last switch will override the hvac mode, effectively turning off your heatpump, even if it should be heating/cooling.

grinco commented 1 year ago

It worked quite nicely even without the scripts. Didn't look at the logs if it turns off the cooling before switching on heating, or goes straight to heating - but it works. Tried playing with the temperatures and different modes - all good. One of the things that I did notice, is that sometimes when temperature is close to or at target, the thermostat says it's off, while it doesn't really turn off the switch - so the heat pump is on idling..

I'll reproduce it then report a bug. Thanks again for the hint with the template sensors - completely didn't occur to me.