diff --git a/custom_components/kocom_smart_home/climate.py b/custom_components/kocom_smart_home/climate.py index 1170f68..3fa434e 100644 --- a/custom_components/kocom_smart_home/climate.py +++ b/custom_components/kocom_smart_home/climate.py @@ -19,7 +19,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities): for coordinator in coordinators: devices = await coordinator.get_devices() entities_to_add.extend( - KocomClimate(coordinator, device) for device in devices + KocomClimate(coordinator, device) + for device in devices + if device["device_id"] not in hass.data[DOMAIN] ) if entities_to_add: diff --git a/custom_components/kocom_smart_home/const.py b/custom_components/kocom_smart_home/const.py index 3dd220a..f1ec0fe 100644 --- a/custom_components/kocom_smart_home/const.py +++ b/custom_components/kocom_smart_home/const.py @@ -8,7 +8,7 @@ NAME = "Kocom Smart Home" DOMAIN = "kocom_smart_home" -VERSION = "1.1.5" +VERSION = "1.1.7" TIMEOUT_SEC = 10 diff --git a/custom_components/kocom_smart_home/coordinator.py b/custom_components/kocom_smart_home/coordinator.py index daaa433..03426a0 100644 --- a/custom_components/kocom_smart_home/coordinator.py +++ b/custom_components/kocom_smart_home/coordinator.py @@ -185,7 +185,7 @@ async def get_devices(self) -> list: elif self.name in ["gas", "vent", "totalcontrol"]: single_device = await self.get_single_device() entry_device_info = { - "device_id": f"{self.name}_{single_device['data']['attr']['id'].lower()}", + "device_id": f"{single_device['data']['attr']['id'].lower()}_00", "device_name": {"gas": "가스", "vent": "환기", "totalcontrol": "일괄소등"}[self.name], "device_room": "00", "device_type": single_device["data"]["attr"]["type"], diff --git a/custom_components/kocom_smart_home/fan.py b/custom_components/kocom_smart_home/fan.py index 3b5c4e1..18cad98 100644 --- a/custom_components/kocom_smart_home/fan.py +++ b/custom_components/kocom_smart_home/fan.py @@ -24,7 +24,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities): devices = await coordinator.get_devices() entities_to_add: list = [ - KocomFan(coordinator, devices[0]) + KocomFan(coordinator, device) + for device in devices + if device["device_id"] not in hass.data[DOMAIN] ] if entities_to_add: @@ -63,6 +65,8 @@ def supported_features(self) -> int: def percentage(self) -> Optional[int]: """Return the current speed percentage.""" status = self.coordinator.get_device_status(function="wind") + if status == "0": + return 0 return ordered_list_item_to_percentage(SPEED_LIST, status) @property diff --git a/custom_components/kocom_smart_home/light.py b/custom_components/kocom_smart_home/light.py index 746dec4..a24b65a 100644 --- a/custom_components/kocom_smart_home/light.py +++ b/custom_components/kocom_smart_home/light.py @@ -17,7 +17,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities): for coordinator in coordinators: devices = await coordinator.get_devices() entities_to_add.extend( - KocomLight(coordinator, device) for device in devices + KocomLight(coordinator, device) + for device in devices + if device["device_id"] not in hass.data[DOMAIN] ) if entities_to_add: diff --git a/custom_components/kocom_smart_home/manifest.json b/custom_components/kocom_smart_home/manifest.json index 7a3f40e..4721553 100644 --- a/custom_components/kocom_smart_home/manifest.json +++ b/custom_components/kocom_smart_home/manifest.json @@ -7,5 +7,5 @@ ], "config_flow": true, "iot_class": "cloud_polling", - "version": "1.1.5" + "version": "1.1.7" } diff --git a/custom_components/kocom_smart_home/sensor.py b/custom_components/kocom_smart_home/sensor.py index da28c4b..f183388 100644 --- a/custom_components/kocom_smart_home/sensor.py +++ b/custom_components/kocom_smart_home/sensor.py @@ -16,7 +16,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities): for coordinator in coordinators: devices = await coordinator.get_devices() entities_to_add.extend( - KocomSensor(coordinator, device) for device in devices + KocomSensor(coordinator, device) + for device in devices + if device["device_id"] not in hass.data[DOMAIN] ) if entities_to_add: diff --git a/custom_components/kocom_smart_home/switch.py b/custom_components/kocom_smart_home/switch.py index 0719508..aa4eed9 100644 --- a/custom_components/kocom_smart_home/switch.py +++ b/custom_components/kocom_smart_home/switch.py @@ -17,7 +17,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities): for coordinator in coordinators: devices = await coordinator.get_devices() entities_to_add.extend( - KocomSwitch(coordinator, device) for device in devices + KocomSwitch(coordinator, device) + for device in devices + if device["device_id"] not in hass.data[DOMAIN] ) if entities_to_add: diff --git a/release_notes.md b/release_notes.md index c4093d0..072c67b 100644 --- a/release_notes.md +++ b/release_notes.md @@ -1,3 +1,13 @@ +### V1.1.7 +- 환기 오류 수정 +- 중복 엔티티 등록 체크 + +### V1.1.6 +- ... + +### V1.1.5 +- ... + ### V1.1.4 - Climate 경고 로그 해결