Fix situation where 'model' can be None (string) in Overkiz (#64320)

This commit is contained in:
Mick Vleeshouwer 2022-01-18 19:04:26 -08:00 committed by GitHub
parent 3c7005d4dc
commit 394c6850a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
from __future__ import annotations
from enum import unique
from typing import cast
from pyoverkiz.enums import OverkizAttribute, OverkizState
from pyoverkiz.models import Device
@ -59,23 +60,22 @@ class OverkizEntity(CoordinatorEntity):
)
model = (
str(
self.executor.select_state(
OverkizState.CORE_MODEL,
OverkizState.CORE_PRODUCT_MODEL_NAME,
OverkizState.IO_MODEL,
),
self.executor.select_state(
OverkizState.CORE_MODEL,
OverkizState.CORE_PRODUCT_MODEL_NAME,
OverkizState.IO_MODEL,
)
or self.device.widget
or self.device.widget.value
)
return DeviceInfo(
identifiers={(DOMAIN, self.executor.base_device_url)},
name=self.device.label,
manufacturer=str(manufacturer),
model=model,
sw_version=str(
self.executor.select_attribute(OverkizAttribute.CORE_FIRMWARE_REVISION)
model=str(model),
sw_version=cast(
str,
self.executor.select_attribute(OverkizAttribute.CORE_FIRMWARE_REVISION),
),
hw_version=self.device.controllable_name,
suggested_area=self.coordinator.areas[self.device.place_oid],