Add firmware and hardware version to WiZ (#66017)

pull/66030/head
J. Nick Koston 2022-02-07 12:23:08 -06:00 committed by GitHub
parent 480ce84b8a
commit 721d711762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 5 deletions

View File

@ -46,8 +46,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
_LOGGER.debug("Get bulb with IP: %s", ip_address) _LOGGER.debug("Get bulb with IP: %s", ip_address)
bulb = wizlight(ip_address) bulb = wizlight(ip_address)
try: try:
await bulb.getMac()
scenes = await bulb.getSupportedScenes() scenes = await bulb.getSupportedScenes()
await bulb.getMac()
# ValueError gets thrown if the bulb type # ValueError gets thrown if the bulb type
# cannot be determined on the first try. # cannot be determined on the first try.
# This is likely because way the library # This is likely because way the library

View File

@ -23,11 +23,16 @@ class WizToggleEntity(CoordinatorEntity, ToggleEntity):
bulb_type: BulbType = self._device.bulbtype bulb_type: BulbType = self._device.bulbtype
self._attr_unique_id = self._device.mac self._attr_unique_id = self._device.mac
self._attr_name = name 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( self._attr_device_info = DeviceInfo(
connections={(CONNECTION_NETWORK_MAC, self._device.mac)}, connections={(CONNECTION_NETWORK_MAC, self._device.mac)},
name=name, name=name,
manufacturer="WiZ", 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 @callback

View File

@ -8,7 +8,7 @@
], ],
"dependencies": ["network"], "dependencies": ["network"],
"documentation": "https://www.home-assistant.io/integrations/wiz", "documentation": "https://www.home-assistant.io/integrations/wiz",
"requirements": ["pywizlight==0.5.1"], "requirements": ["pywizlight==0.5.2"],
"iot_class": "local_push", "iot_class": "local_push",
"codeowners": ["@sbidy"] "codeowners": ["@sbidy"]
} }

View File

@ -2051,7 +2051,7 @@ pywemo==0.7.0
pywilight==0.0.70 pywilight==0.0.70
# homeassistant.components.wiz # homeassistant.components.wiz
pywizlight==0.5.1 pywizlight==0.5.2
# homeassistant.components.xeoma # homeassistant.components.xeoma
pyxeoma==1.4.1 pyxeoma==1.4.1

View File

@ -1276,7 +1276,7 @@ pywemo==0.7.0
pywilight==0.0.70 pywilight==0.0.70
# homeassistant.components.wiz # homeassistant.components.wiz
pywizlight==0.5.1 pywizlight==0.5.2
# homeassistant.components.zerproc # homeassistant.components.zerproc
pyzerproc==0.4.8 pyzerproc==0.4.8