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

Update climate.py for air conditioning #888

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dubyatp
Copy link

@dubyatp dubyatp commented Jun 17, 2022

Some quick and dirty changes to climate.py to support air conditioning, since the current version seems to only be heat-centric.

Likely need to put in a more refined way to differentiate between heat and cool, but adding an additional True/False HVAC mode for Cool allows HA to recognize my Tuya TCL window air conditioner as "cooling", while also letting me turn on/off the air conditioner with the "Cool" and "Off" options.
Screenshot_2022-06-16_20-52-45
Screenshot_2022-06-16_21-11-47

While not included in this PR, I also needed to manually adjust the default min and max temps because this TCL air conditioner does not provide DP's for min and max temperature, and the default ones in HA are designed for Celsius and do not work properly in a Fahrenheit configuration. It might be worth adding the ability to enter custom min/max temps within the integration.

homeassistant:
  customize:
    climate.bedroomac:
      max_temp: 90
      min_temp: 10 

Copy link

@AndrewLitvinov AndrewLitvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works

Copy link

@adrienvsj adrienvsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good for me. I also tested it with my air conditioning Kraftwerk Smart 10k connected to Tuya and it worked perfectly

@adrienvsj
Copy link

@dubyatp Can you fix conflicts ?

@dubyatp
Copy link
Author

dubyatp commented Sep 4, 2022

Done

@dubyatp dubyatp reopened this Sep 4, 2022
@adrienvsj
Copy link

@rospogrigio Do you think you could watch this MR? It's really easy to review and would be super useful for people who use air conditioners

@@ -250,6 +264,23 @@ def hvac_action(self):
) > self._target_temperature:
self._hvac_action = CURRENT_HVAC_IDLE
return self._hvac_action
if self._hvac_mode == HVAC_MODE_COOL:
if self._current_temperature < (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the sign the right way around? I think it makes sense re heating (if less than target temp, heat); but not so much cooling

self._hvac_action = CURRENT_HVAC_IDLE
if (
self._current_temperature + self._precision
) > self._target_temperature:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here

@apbarratt
Copy link

As discussed in #1793, I've included your discovered modes, however I haven't included any of the logic for switching to cooling vs heating that you've cleverly suggested.
My problem at this stage is that you simple logic for less than or greater than logic will not account for tolerances.

For example, my heating system can be set to 20°C, but it will continue heating to a tolerance of 1 degree, and the tolerance could be adjusted to 2 or 3 degrees (which I expect is more appreciated in Fahrenheit for example). And likewise, it won't start heating until the temperature drops to 19°C. With your logic, I can therefore assume that if my heating is at 20.5°C, it would show up in home assistant saying that my system is now cooling, despite not having an AC mode built in.

However I do think this is a good idea, it just needs a little more work, so make sure you get a rebase done and see what can be done :)

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

Successfully merging this pull request may close these issues.

5 participants