Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using AirConditioner as both heat and cold unit #54

Closed
ALERTua opened this issue May 22, 2023 · 5 comments
Closed

Using AirConditioner as both heat and cold unit #54

ALERTua opened this issue May 22, 2023 · 5 comments

Comments

@ALERTua
Copy link

ALERTua commented May 22, 2023

I apologize for creating an issue. The discussion is not enabled for this GitHub project.

As the default air conditioner Auto HVAC mode is unable to read from external temperature sensors, I am in need of this great plugin. But I cannot figure out how I can use climate.ac_unit for both cooling if higher and heating if lower temperature than stated in the config, with setting the AC temperature. I would appreciate a config example for such usage.
Also, it would be great if this repository has an examples folder with the examples of config YAML files for different setups.
Thank you.

@dugancom
Copy link

Hello, this was my need too but it doesn't seem that the component is designed to control one unit that has both a heat and cool function. My attempt was to set both the heater and cooler parameters to the same switch but it seems like it only uses the first one.

@neoKushan
Copy link

neoKushan commented Sep 7, 2023

@ALERTua @dugancom does this help? I had the same issue as you guys (plus another annoying issue), I wanted to use this component to control an AC unit that I use for both heating and cooling, but with an external sensor because the one in the Unit is borderline useless.

To do this, I created two template switches that control the AC unit in different ways:

- platform: template
  switches:
    office_aircon_cool:
      value_template: "{{is_state('climate.office_ac', 'cool')}}"
      turn_on:
        - service: climate.set_hvac_mode
          data:
            hvac_mode: cool
          target:
            entity_id: climate.office_ac
        - service: climate.set_temperature
          data:
            hvac_mode: cool
            temperature: "{{state_attr('climate.office_smart_thermostat', 'target_temp_low') | round(0, 'floor') }}"
          target:
            entity_id: climate.office_ac
      turn_off:
        service: climate.set_hvac_mode
        data:
          hvac_mode: "fan_only"
        target:
          entity_id: climate.office_ac
    office_aircon_heat:
      value_template: "{{is_state('climate.office_ac', 'heat')}}"
      turn_on:
        - service: climate.set_hvac_mode
          data:
            hvac_mode: heat
          target:
            entity_id: climate.office_ac
        - service: climate.set_temperature
          data:
            hvac_mode: heat
            temperature: "{{state_attr('climate.office_smart_thermostat', 'target_temp_high') | round(0, 'ceiling') }}"
          target:
            entity_id: climate.office_ac
      turn_off:
        service: climate.set_hvac_mode
        data:
          hvac_mode: "fan_only"
        target:
          entity_id: climate.office_ac

A couple of things to note here, as it might not be relevant to you:

My AC is really stupid, when you power it off it won't accept additional commands until it has done its power-off-clean-cycle, which can take up to 20mins to do - not ideal when I just want it to keep the temperature in check, so for these switches the "Off" function just sets the AC to fan-only mode, which will let it quickly switch back to heat or cool mode when it needs to.

My AC's built-in temperature sensor is also terrible but it tries to use it regardless, so in order to get it to actually heat or cool based off of the external temperature, I set the target temperature in the service call to a rounded number (up if heating, down if cooling) - so if you set the temperature to say 22.4, it'll be 22 in cooling mode or 23 in heating mode

Finally, with those two switches defined, I use them in this dual smart thermostat like so:

climate:
  - platform: dual_smart_thermostat
    name: Office smart Thermostat
    heater: switch.office_aircon_heat
    cooler: switch.office_aircon_cool
    target_sensor: sensor.lumi_lumi_weather_temperature
    min_temp: 18
    max_temp: 26
    target_temp: 22
    target_temp_high: 22.0
    target_temp_low: 21.0
    cold_tolerance: 0.3
    hot_tolerance: 0.3
    min_cycle_duration:
      seconds: 5
    initial_hvac_mode: "heat_cool" # hvac mode will reset to this value after restart
    heat_cool_mode: true
    keep_alive:
      minutes: 3
    away: # this preset will be available for all hvac modes
      temperature: 7
      target_temp_low: 7
      target_temp_high: 30
    anti_freeze: # this preset will be available for all hvac modes
      temperature: 7
      target_temp_low: 7
      target_temp_high: 30
    comfort: # this preset will be available for all hvac modes
      temperature: 22
      target_temp_low: 21.0
      target_temp_high: 22.0
    home: # this preset will be available only for heat or cool hvac mode
      temperature: 21
    precision: 0.1

I have defined the anti_freeze and away profile for scheduling purposes, they're just there to effectively turn the AC off because I can't find a good way to actually switch it off since the "off" mode in both is defined as fan mode. Hope all that makes sense.

@ALERTua
Copy link
Author

ALERTua commented Sep 7, 2023

Yes, this would help. This was my first solution. But then I wrote my own script using Pyscript.

@neoKushan
Copy link

I'd be interested in learning more about your solution, @ALERTua, if you have something you're able to share?

@ALERTua
Copy link
Author

ALERTua commented Sep 7, 2023

https://gist.github.com/ALERTua/0e89f5279dd0e1de7ee270c9e718d8d2
based on https://github.com/custom-components/pyscript and https://github.com/ALERTua/ha_pyscript_modules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants