Add humidifier and dehumidifier as seperate entities#44
Add humidifier and dehumidifier as seperate entities#44nberardi wants to merge 1 commit intochamberlain2007:developfrom
Conversation
added support for aux_heat added support for aux_heat
chamberlain2007
left a comment
There was a problem hiding this comment.
@nberardi Thanks for doing this! I provided some feedback inline.
| def mode(self) -> str | None: | ||
| """Get dehumidifier mode.""" | ||
|
|
||
| mode = self.coordinator.data.get(Attribute.MODE) |
There was a problem hiding this comment.
@nberardi I think this should be controlled via the main climate entity. Otherwise, someone will think they are changing the mode for the humidifier and actually be setting it on the whole system.
|
|
||
| async def async_set_mode(self, mode: str) -> None: | ||
| """Set the mode of the thermostat.""" | ||
| await self.coordinator.client.read_scheduling() |
| _attr_supported_features = HumidifierEntityFeature.MODES | ||
| _attr_device_class = HumidifierDeviceClass.DEHUMIDIFIER | ||
| _attr_available_modes = [MODE_MANUAL] | ||
| _attr_min_humidity = 10 |
|
|
||
| available = self.coordinator.data.get(Attribute.HUMIDIFICATION_AVAILABLE) | ||
|
|
||
| if (available == 1): |
There was a problem hiding this comment.
@nberardi As far as I can tell, there is not a case where only auto OR manual is available. In all cases, it should be [MODE_AUTO, MODE_MANUAL]
| setpoint = self.coordinator.data.get(Attribute.HUMIDIFICATION_SETPOINT) | ||
| """Don't set last target humidity if off.""" | ||
| self._last_is_on = setpoint != 0 | ||
| self._last_target_humidity = setpoint if self._last_is_on else self._last_target_humidity |
There was a problem hiding this comment.
@nberardi I think I see where you're going with this, which is storing the last humidity so that if the device is turned off and then on, that it uses the last humidity to turn it back on. This has an edge case which you didn't consider which is that if the integration starts with the device off (eg humidity == 0) then it won't be able to turn on. Since there's no way for us to know the previous setpoint in that case, I think we need to set a reasonable default humidity to restore to in that case.
| """Return the target humidity.""" | ||
| setpoint = self.coordinator.data.get(Attribute.DEHUMIDIFICATION_SETPOINT) | ||
| """Don't set last target humidity if off.""" | ||
| self._last_is_on = setpoint != 0 |
There was a problem hiding this comment.
@nberardi This doesn't need to be stored, we never read it outside of this function. This can just be
self._last_target_humidity = setpoint if setpoint != 0 else self._last_target_humidity
| config_entry: ConfigEntry, | ||
| async_add_entities: AddEntitiesCallback, | ||
| ) -> None: | ||
| """Add humidifier and dehumdifier for passed config_entry in HA.""" |
I am going to start this off by saying, I am not as comfortable in Python as other languages, so if you see something say something. That being said, I have been wanting to control my dehumidifier as a separate entity when I export to HomeKit, and the current setup under the climate domain doesn't expose all the services that are available in order to control my dehumidifier. Which is why I am creating the below pull request. Let me know your thoughts.