jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
202 stars 47 forks source link

Climate devices should honor thermostat modes reported by Hubitat #66

Open richardpowellus opened 4 years ago

richardpowellus commented 4 years ago

Hi all,

Firstly, thanks a lot for the hard work on this project. It's really great.

Secondly, I'm using this integration along with a device/app I'm writing for Hubitat so that I can control my Hot Tub. The Hot Tub is working great in Hubitat including my ability to control it from the Hubitat dashboard. An issue I'm facing, however, is that even though my device exports that its "supportedThermostatModes" are only [off, heat], that doesn't get translated over when the climate entity gets created in Hubitat. Instead, the climate entity ends up still including the full set of hvac_modes (heat, heat_cool, cool, 'off'). Ideally my climate entity would only end up with 'off' and 'heat'.

I do realize there may never be a perfect way to do this mapping since Hubistat's full list of thermostat modes are: ["auto", "off", "heat", "emergency heat", "cool"] and Climate has the following list of valid HVAC_MODES: HVAC_MODES = [ HVAC_MODE_OFF, HVAC_MODE_HEAT, HVAC_MODE_COOL, HVAC_MODE_HEAT_COOL, HVAC_MODE_AUTO, HVAC_MODE_DRY, HVAC_MODE_FAN_ONLY, ]

BUT, Hubitat also includes Fan modes. Which look like this: supportedThermostatFanModes - ENUM ["on", "circulate", "auto"]

So a possible mapping might look like:

HVAC_MODE_OFF -> Hubitat Fan Mode: auto | circulate | on, Thermostat Mode: off // We should assume all HVAC systems will support an "off" mode HVAC_MODE_HEAT -> Hubitat Fan Mode: auto | circulate | on, Thermostat Mode: heat HVAC_MODE_COOL -> Hubitat Fan Mode: auto | circulate | on, Thermostat Mode: cool HVAC_MODE_HEAT_COOL -> Hubitat Fan Mode: auto | circulate | on, Both Thermostat Modes "heat" and "cool" are present HVAC_MODE_AUTO -> Same requirements as HVAC_MODE_HEAT_COOL. TBH, I'm not sure the difference between this and HVAC_MODE_HEAT_COOL? HVAC_MODE_DRY -> AFAIK this just means you have a fan at all. You might not have heat or cool. HVAC_MODE_FAN_ONLY -> Same here, so long as they have a fan mode available and we have the ability to turn the Thermostat "off" we can enable this HVAC_MODE

I'm sure some may argue my mapping needs a bit of tweaking, but, nonetheless, I'm sure everyone gets the idea :) The important thing for me is that because I don't have "cool" in my supportedThermostatModes I won't ever have HVAC_MODE_COOL, HVAC_MODE_HEAT_COOL or HVAC_MODE_AUTO (I think?) in my climate entity in homeassistant.

Thoughts on this?

jason0x43 commented 4 years ago

So the goal here is to have the integration pay better attention to the supported modes, not advertising functionality that isn't available?

richardpowellus commented 4 years ago

Yes. Another option would be to give us a way to override entity state attributes all up, somehow. Like, some sort of filter that can be put in place that you would run every entity through before finally creating the entity in homeassistant. That would allow me to make some final alterations to the climate HVAC_MODE state attributes just before the climate entity gets created.

This would be more of a hack but it has the benefit of being something that can be used for a large number of scenarios outside of just my example here. It might be something that people could use as a stop-gap solution until there is time to implement the right / nice solution.

jason0x43 commented 4 years ago

For your target device, what are the supported thermostat modes and fan modes? Does it even support fan modes?

richardpowellus commented 4 years ago

My Hot Tub has a circulation pump which constantly circulates water and cannot be turned on or off. Most of the implementations I’ve seen online will allow control of the circulation pump using the “Fan” setting of a Thermostat when it comes to hot tubs (since some hot tub manufacturers do allow control of circulation pumps).

So it’s feasible you can have a hot tub that has a “Thermostat” with a circulation pump (fan) that can be on or off. A hot tub just heats and moves a different fluid around than an HVAC system at the end of the day 😊

If you query my Hubitat Thermostat device for supportedThermostatFanModes I only return “circulate”.

-Richard.

From: Jason Cheathammailto:notifications@github.com Sent: Friday, September 18, 2020 3:03 PM To: jason0x43/hacs-hubitatmailto:hacs-hubitat@noreply.github.com Cc: Richard Powellmailto:richard@powell.dev; Authormailto:author@noreply.github.com Subject: Re: [jason0x43/hacs-hubitat] When importing a Thermostat from Hubitat could hacs-hubitat honor supportedThermostatModes a little better? (#66)

For your target device, what are the supported thermostat modes and fan modes? Does it even support fan modes?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/jason0x43/hacs-hubitat/issues/66#issuecomment-695106360, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAKOOEILRI5OC6KZUGFPRS3SGPKJLANCNFSM4RSRBZZA.

github-actions[bot] commented 3 years ago

Stale issue message