diff --git a/custom_components/hon/binary_sensor.py b/custom_components/hon/binary_sensor.py index 0a44cd9..469ee17 100644 --- a/custom_components/hon/binary_sensor.py +++ b/custom_components/hon/binary_sensor.py @@ -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}" diff --git a/custom_components/hon/button.py b/custom_components/hon/button.py index b9063d0..c627131 100644 --- a/custom_components/hon/button.py +++ b/custom_components/hon/button.py @@ -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 ")) diff --git a/custom_components/hon/climate.py b/custom_components/hon/climate.py index 29b7764..e8b55b1 100644 --- a/custom_components/hon/climate.py +++ b/custom_components/hon/climate.py @@ -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() diff --git a/custom_components/hon/hon.py b/custom_components/hon/hon.py index ea171db..c88283b 100644 --- a/custom_components/hon/hon.py +++ b/custom_components/hon/hon.py @@ -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 diff --git a/custom_components/hon/manifest.json b/custom_components/hon/manifest.json index 2b1cb6a..206782d 100644 --- a/custom_components/hon/manifest.json +++ b/custom_components/hon/manifest.json @@ -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" } diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py index 81e8d21..bf1d8f3 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py @@ -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}" diff --git a/custom_components/hon/select.py b/custom_components/hon/select.py index 6f66cf4..b413ff3 100644 --- a/custom_components/hon/select.py +++ b/custom_components/hon/select.py @@ -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}" diff --git a/custom_components/hon/sensor.py b/custom_components/hon/sensor.py index 72520d3..d963427 100644 --- a/custom_components/hon/sensor.py +++ b/custom_components/hon/sensor.py @@ -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}" diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py index cf71aed..8fca28a 100644 --- a/custom_components/hon/switch.py +++ b/custom_components/hon/switch.py @@ -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}"