Fix climate not available #52
This commit is contained in:
		@@ -278,8 +278,6 @@ class HonBinarySensorEntity(HonEntity, BinarySensorEntity):
 | 
			
		||||
    def __init__(self, hass, coordinator, entry, device, description) -> None:
 | 
			
		||||
        super().__init__(hass, entry, coordinator, device)
 | 
			
		||||
 | 
			
		||||
        self._coordinator = coordinator
 | 
			
		||||
 | 
			
		||||
        self.entity_description = description
 | 
			
		||||
        self._attr_unique_id = f"{super().unique_id}{description.key}"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -56,8 +56,6 @@ class HonButtonEntity(HonEntity, ButtonEntity):
 | 
			
		||||
    ) -> None:
 | 
			
		||||
        super().__init__(hass, entry, coordinator, device)
 | 
			
		||||
 | 
			
		||||
        self._coordinator = coordinator
 | 
			
		||||
        self._device = device
 | 
			
		||||
        self.entity_description = description
 | 
			
		||||
        self._attr_unique_id = f"{super().unique_id}{description.key}"
 | 
			
		||||
 | 
			
		||||
@@ -77,9 +75,7 @@ class HonButtonEntity(HonEntity, ButtonEntity):
 | 
			
		||||
class HonFeatureRequestButton(HonEntity, ButtonEntity):
 | 
			
		||||
    def __init__(self, hass, coordinator, entry, device: HonAppliance) -> None:
 | 
			
		||||
        super().__init__(hass, entry, coordinator, device)
 | 
			
		||||
        self._hass = hass
 | 
			
		||||
 | 
			
		||||
        self._device = device
 | 
			
		||||
        self._attr_unique_id = f"{super().unique_id}_log_device_info"
 | 
			
		||||
        self._attr_icon = "mdi:information"
 | 
			
		||||
        self._attr_name = "Show Device Info"
 | 
			
		||||
@@ -88,7 +84,9 @@ class HonFeatureRequestButton(HonEntity, ButtonEntity):
 | 
			
		||||
 | 
			
		||||
    async def async_press(self) -> None:
 | 
			
		||||
        pyhon_version = pkg_resources.get_distribution("pyhon").version
 | 
			
		||||
        info = f"Device Info:\n{self._device.diagnose()}pyhOnVersion: {pyhon_version}"
 | 
			
		||||
        info = f"{self._device.diagnose()}pyhOnVersion: {pyhon_version}"
 | 
			
		||||
        title = f"{self._device.nick_name} Device Info"
 | 
			
		||||
        persistent_notification.create(self._hass, f"```\n```{info}```\n```", title)
 | 
			
		||||
        persistent_notification.create(
 | 
			
		||||
            self._hass, f"````\n```\n{info}\n```\n````", title
 | 
			
		||||
        )
 | 
			
		||||
        _LOGGER.info(info.replace(" ", "\u200B "))
 | 
			
		||||
 
 | 
			
		||||
@@ -56,8 +56,8 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
 | 
			
		||||
            for description in descriptions:
 | 
			
		||||
                if description.key not in list(device.commands):
 | 
			
		||||
                    continue
 | 
			
		||||
                appliances.extend(
 | 
			
		||||
                    [HonClimateEntity(hass, coordinator, entry, device, description)]
 | 
			
		||||
                appliances.append(
 | 
			
		||||
                    HonClimateEntity(hass, coordinator, entry, device, description)
 | 
			
		||||
                )
 | 
			
		||||
    async_add_entities(appliances)
 | 
			
		||||
 | 
			
		||||
@@ -67,10 +67,7 @@ class HonClimateEntity(HonEntity, ClimateEntity):
 | 
			
		||||
        self, hass, coordinator, entry, device: HonAppliance, description
 | 
			
		||||
    ) -> None:
 | 
			
		||||
        super().__init__(hass, entry, coordinator, device)
 | 
			
		||||
        self._coordinator = coordinator
 | 
			
		||||
        self._device = device
 | 
			
		||||
        self.entity_description = description
 | 
			
		||||
        self._hass = hass
 | 
			
		||||
        self._attr_unique_id = f"{super().unique_id}climate"
 | 
			
		||||
 | 
			
		||||
        self._attr_temperature_unit = TEMP_CELSIUS
 | 
			
		||||
@@ -96,7 +93,7 @@ class HonClimateEntity(HonEntity, ClimateEntity):
 | 
			
		||||
            | ClimateEntityFeature.SWING_MODE
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        self._handle_coordinator_update()
 | 
			
		||||
        self._handle_coordinator_update(update=False)
 | 
			
		||||
 | 
			
		||||
    async def async_set_hvac_mode(self, hvac_mode):
 | 
			
		||||
        if hvac_mode == HVACMode.OFF:
 | 
			
		||||
@@ -161,4 +158,5 @@ class HonClimateEntity(HonEntity, ClimateEntity):
 | 
			
		||||
            self._attr_swing_mode = SWING_VERTICAL
 | 
			
		||||
        else:
 | 
			
		||||
            self._attr_swing_mode = SWING_OFF
 | 
			
		||||
        self.async_write_ha_state()
 | 
			
		||||
        if update:
 | 
			
		||||
            self.async_write_ha_state()
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,7 @@ class HonEntity(CoordinatorEntity):
 | 
			
		||||
 | 
			
		||||
        self._hon = hass.data[DOMAIN][entry.unique_id]
 | 
			
		||||
        self._hass = hass
 | 
			
		||||
        self._coordinator = coordinator
 | 
			
		||||
        self._device = device
 | 
			
		||||
 | 
			
		||||
        self._attr_unique_id = self._device.unique_id
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,6 @@
 | 
			
		||||
  "documentation": "https://github.com/Andre0512/hon/",
 | 
			
		||||
  "iot_class": "cloud_polling",
 | 
			
		||||
  "issue_tracker": "https://github.com/Andre0512/hon/issues",
 | 
			
		||||
 "requirements": ["pyhOn==0.10.7"],
 | 
			
		||||
  "version": "0.8.0-beta.3"
 | 
			
		||||
 "requirements": ["pyhOn==0.10.9"],
 | 
			
		||||
  "version": "0.8.0-beta.4"
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -200,8 +200,6 @@ class HonNumberEntity(HonEntity, NumberEntity):
 | 
			
		||||
    def __init__(self, hass, coordinator, entry, device, description) -> None:
 | 
			
		||||
        super().__init__(hass, entry, coordinator, device)
 | 
			
		||||
 | 
			
		||||
        self._coordinator = coordinator
 | 
			
		||||
        self._device = device
 | 
			
		||||
        self._data = device.settings[description.key]
 | 
			
		||||
        self.entity_description = description
 | 
			
		||||
        self._attr_unique_id = f"{super().unique_id}{description.key}"
 | 
			
		||||
 
 | 
			
		||||
@@ -158,8 +158,6 @@ class HonSelectEntity(HonEntity, SelectEntity):
 | 
			
		||||
    ) -> None:
 | 
			
		||||
        super().__init__(hass, entry, coordinator, device)
 | 
			
		||||
 | 
			
		||||
        self._coordinator = coordinator
 | 
			
		||||
        self._device = device
 | 
			
		||||
        self.entity_description = description
 | 
			
		||||
        self._attr_unique_id = f"{super().unique_id}{description.key}"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -536,8 +536,6 @@ class HonSensorEntity(HonEntity, SensorEntity):
 | 
			
		||||
    def __init__(self, hass, coordinator, entry, device, description) -> None:
 | 
			
		||||
        super().__init__(hass, entry, coordinator, device)
 | 
			
		||||
 | 
			
		||||
        self._coordinator = coordinator
 | 
			
		||||
 | 
			
		||||
        self.entity_description = description
 | 
			
		||||
        self._attr_unique_id = f"{super().unique_id}{description.key}"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -387,8 +387,7 @@ class HonSwitchEntity(HonEntity, SwitchEntity):
 | 
			
		||||
        description: HonSwitchEntityDescription,
 | 
			
		||||
    ) -> None:
 | 
			
		||||
        super().__init__(hass, entry, coordinator, device)
 | 
			
		||||
        self._coordinator = coordinator
 | 
			
		||||
        self._device = device
 | 
			
		||||
 | 
			
		||||
        self.entity_description = description
 | 
			
		||||
        self._attr_unique_id = f"{super().unique_id}{description.key}"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user