Use default None for voltage property of FritzDevice in Fritz!Smarthome (#73141)
use default None for device.voltagepull/73203/head
parent
d587e4769a
commit
eca6768016
|
@ -96,7 +96,9 @@ SENSOR_TYPES: Final[tuple[FritzSensorEntityDescription, ...]] = (
|
|||
device_class=SensorDeviceClass.VOLTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suitable=lambda device: device.has_powermeter, # type: ignore[no-any-return]
|
||||
native_value=lambda device: device.voltage / 1000 if device.voltage else 0.0,
|
||||
native_value=lambda device: device.voltage / 1000
|
||||
if getattr(device, "voltage", None)
|
||||
else 0.0,
|
||||
),
|
||||
FritzSensorEntityDescription(
|
||||
key="electric_current",
|
||||
|
@ -106,7 +108,7 @@ SENSOR_TYPES: Final[tuple[FritzSensorEntityDescription, ...]] = (
|
|||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suitable=lambda device: device.has_powermeter, # type: ignore[no-any-return]
|
||||
native_value=lambda device: device.power / device.voltage
|
||||
if device.power and device.voltage
|
||||
if device.power and getattr(device, "voltage", None)
|
||||
else 0.0,
|
||||
),
|
||||
FritzSensorEntityDescription(
|
||||
|
|
Loading…
Reference in New Issue