1 """Support for WiZ sensors."""
3 from __future__
import annotations
8 SensorEntityDescription,
12 SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
19 from .
import WizConfigEntry
20 from .entity
import WizEntity
21 from .models
import WizData
23 SENSORS: tuple[SensorEntityDescription, ...] = (
26 entity_registry_enabled_default=
False,
27 state_class=SensorStateClass.MEASUREMENT,
28 device_class=SensorDeviceClass.SIGNAL_STRENGTH,
29 entity_category=EntityCategory.DIAGNOSTIC,
30 native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
35 POWER_SENSORS: tuple[SensorEntityDescription, ...] = (
38 state_class=SensorStateClass.MEASUREMENT,
39 device_class=SensorDeviceClass.POWER,
40 native_unit_of_measurement=UnitOfPower.WATT,
47 entry: WizConfigEntry,
48 async_add_entities: AddEntitiesCallback,
50 """Set up the wiz sensor."""
52 WizSensor(entry.runtime_data, entry.title, description)
53 for description
in SENSORS
55 if entry.runtime_data.coordinator.data
is not None:
59 for description
in POWER_SENSORS
66 """Defines a WiZ sensor."""
68 entity_description: SensorEntityDescription
71 self, wiz_data: WizData, name: str, description: SensorEntityDescription
73 """Initialize an WiZ sensor."""
81 """Handle updating _attr values."""
88 """Defines a WiZ power sensor."""
92 """Handle updating _attr values."""
94 watts_push = self.
_device_device.state.get_power()
96 watts_poll = self.coordinator.data
None _async_update_attrs(self)
None _async_update_attrs(self)
None __init__(self, WizData wiz_data, str name, SensorEntityDescription description)
None _async_update_attrs(self)
None async_setup_entry(HomeAssistant hass, WizConfigEntry entry, AddEntitiesCallback async_add_entities)