From 721d711762cdfd4fb608b6f6d6a46dc171a0ae05 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 7 Feb 2022 12:23:08 -0600 Subject: [PATCH] Add firmware and hardware version to WiZ (#66017) --- homeassistant/components/wiz/__init__.py | 2 +- homeassistant/components/wiz/entity.py | 7 ++++++- homeassistant/components/wiz/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/wiz/__init__.py b/homeassistant/components/wiz/__init__.py index ce5d92c5f62..15b46a14ae0 100644 --- a/homeassistant/components/wiz/__init__.py +++ b/homeassistant/components/wiz/__init__.py @@ -46,8 +46,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: _LOGGER.debug("Get bulb with IP: %s", ip_address) bulb = wizlight(ip_address) try: - await bulb.getMac() scenes = await bulb.getSupportedScenes() + await bulb.getMac() # ValueError gets thrown if the bulb type # cannot be determined on the first try. # This is likely because way the library diff --git a/homeassistant/components/wiz/entity.py b/homeassistant/components/wiz/entity.py index de0b0e3f947..1ddaced401f 100644 --- a/homeassistant/components/wiz/entity.py +++ b/homeassistant/components/wiz/entity.py @@ -23,11 +23,16 @@ class WizToggleEntity(CoordinatorEntity, ToggleEntity): bulb_type: BulbType = self._device.bulbtype self._attr_unique_id = self._device.mac self._attr_name = name + hw_data = bulb_type.name.split("_") + board = hw_data.pop(0) + model = hw_data.pop(0) self._attr_device_info = DeviceInfo( connections={(CONNECTION_NETWORK_MAC, self._device.mac)}, name=name, manufacturer="WiZ", - model=bulb_type.name, + model=model, + hw_version=f"{board} {hw_data[0]}" if hw_data else board, + sw_version=bulb_type.fw_version, ) @callback diff --git a/homeassistant/components/wiz/manifest.json b/homeassistant/components/wiz/manifest.json index 90a6347dbc5..82e1393dec3 100644 --- a/homeassistant/components/wiz/manifest.json +++ b/homeassistant/components/wiz/manifest.json @@ -8,7 +8,7 @@ ], "dependencies": ["network"], "documentation": "https://www.home-assistant.io/integrations/wiz", - "requirements": ["pywizlight==0.5.1"], + "requirements": ["pywizlight==0.5.2"], "iot_class": "local_push", "codeowners": ["@sbidy"] } diff --git a/requirements_all.txt b/requirements_all.txt index 5e2c0ac5bda..c0cb46ef0ec 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2051,7 +2051,7 @@ pywemo==0.7.0 pywilight==0.0.70 # homeassistant.components.wiz -pywizlight==0.5.1 +pywizlight==0.5.2 # homeassistant.components.xeoma pyxeoma==1.4.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index bf0123fea98..04e53bd6f57 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1276,7 +1276,7 @@ pywemo==0.7.0 pywilight==0.0.70 # homeassistant.components.wiz -pywizlight==0.5.1 +pywizlight==0.5.2 # homeassistant.components.zerproc pyzerproc==0.4.8