2222)
2323from homeassistant .helpers .entity import EntityDescription
2424
25- from .const import STICK , USB_MOTION_ID , USB_RELAY_ID
25+ from .const import USB_MOTION_ID , USB_RELAY_ID
2626
2727
2828@dataclass
29- class PlugwiseRequiredKeysMixin :
30- """Mixin for required keys."""
31-
32- plugwise_api : str
33-
34-
35- @dataclass
36- class PlugwiseEntityDescription (EntityDescription , PlugwiseRequiredKeysMixin ):
29+ class PlugwiseEntityDescription (EntityDescription ):
3730 """Generic Plugwise entity description."""
3831
32+ should_poll : bool = False
33+ state_request_method : str = "dummy"
34+
3935
4036@dataclass
4137class PlugwiseSensorEntityDescription (
4238 SensorEntityDescription , PlugwiseEntityDescription
4339):
4440 """Describes Plugwise sensor entity."""
4541
46- should_poll : bool = False
47- state_class : str | None = SensorStateClass .MEASUREMENT
48- state_request_method : str | None = None
49-
5042
5143@dataclass
5244class PlugwiseSwitchEntityDescription (
5345 SwitchEntityDescription , PlugwiseEntityDescription
5446):
5547 """Describes Plugwise switch entity."""
5648
57- should_poll : bool = False
58- state_request_method : str | None = None
59-
6049
6150@dataclass
6251class PlugwiseBinarySensorEntityDescription (
6352 BinarySensorEntityDescription , PlugwiseEntityDescription
6453):
6554 """Describes Plugwise binary sensor entity."""
6655
67- icon_off : str | None = None
68- should_poll : bool = False
69- state_request_method : str | None = None
70-
7156
7257PW_SENSOR_TYPES : tuple [PlugwiseSensorEntityDescription , ...] = (
7358 PlugwiseSensorEntityDescription (
74- plugwise_api = STICK ,
7559 key = "power_1s" ,
7660 name = "Power usage" ,
7761 device_class = SensorDeviceClass .POWER ,
7862 native_unit_of_measurement = UnitOfPower .WATT ,
7963 state_request_method = "current_power_usage" ,
8064 ),
8165 PlugwiseSensorEntityDescription (
82- plugwise_api = STICK ,
8366 key = "energy_consumption_today" ,
8467 name = "Energy consumption today" ,
8568 device_class = SensorDeviceClass .ENERGY ,
@@ -88,7 +71,6 @@ class PlugwiseBinarySensorEntityDescription(
8871 state_request_method = "energy_consumption_today" ,
8972 ),
9073 PlugwiseSensorEntityDescription (
91- plugwise_api = STICK ,
9274 key = "ping" ,
9375 name = "Ping roundtrip" ,
9476 icon = "mdi:speedometer" ,
@@ -98,7 +80,6 @@ class PlugwiseBinarySensorEntityDescription(
9880 entity_category = EntityCategory .DIAGNOSTIC ,
9981 ),
10082 PlugwiseSensorEntityDescription (
101- plugwise_api = STICK ,
10283 key = "power_8s" ,
10384 name = "Power usage 8 seconds" ,
10485 device_class = SensorDeviceClass .POWER ,
@@ -107,7 +88,6 @@ class PlugwiseBinarySensorEntityDescription(
10788 entity_registry_enabled_default = False ,
10889 ),
10990 PlugwiseSensorEntityDescription (
110- plugwise_api = STICK ,
11191 key = "RSSI_in" ,
11292 name = "Inbound RSSI" ,
11393 device_class = SensorDeviceClass .SIGNAL_STRENGTH ,
@@ -117,7 +97,6 @@ class PlugwiseBinarySensorEntityDescription(
11797 entity_category = EntityCategory .DIAGNOSTIC ,
11898 ),
11999 PlugwiseSensorEntityDescription (
120- plugwise_api = STICK ,
121100 key = "RSSI_out" ,
122101 name = "Outbound RSSI" ,
123102 device_class = SensorDeviceClass .SIGNAL_STRENGTH ,
@@ -127,7 +106,6 @@ class PlugwiseBinarySensorEntityDescription(
127106 entity_category = EntityCategory .DIAGNOSTIC ,
128107 ),
129108 PlugwiseSensorEntityDescription (
130- plugwise_api = STICK ,
131109 key = "power_con_cur_hour" ,
132110 name = "Power consumption current hour" ,
133111 icon = "mdi:lightning-bolt" ,
@@ -136,7 +114,6 @@ class PlugwiseBinarySensorEntityDescription(
136114 entity_registry_enabled_default = False ,
137115 ),
138116 PlugwiseSensorEntityDescription (
139- plugwise_api = STICK ,
140117 key = "power_prod_cur_hour" ,
141118 name = "Power production current hour" ,
142119 icon = "mdi:lightning-bolt" ,
@@ -145,7 +122,6 @@ class PlugwiseBinarySensorEntityDescription(
145122 entity_registry_enabled_default = False ,
146123 ),
147124 PlugwiseSensorEntityDescription (
148- plugwise_api = STICK ,
149125 key = "power_con_today" ,
150126 name = "Power consumption today" ,
151127 icon = "mdi:lightning-bolt" ,
@@ -154,7 +130,6 @@ class PlugwiseBinarySensorEntityDescription(
154130 entity_registry_enabled_default = False ,
155131 ),
156132 PlugwiseSensorEntityDescription (
157- plugwise_api = STICK ,
158133 key = "power_con_prev_hour" ,
159134 name = "Power consumption previous hour" ,
160135 icon = "mdi:lightning-bolt" ,
@@ -164,7 +139,6 @@ class PlugwiseBinarySensorEntityDescription(
164139 entity_registry_enabled_default = False ,
165140 ),
166141 PlugwiseSensorEntityDescription (
167- plugwise_api = STICK ,
168142 key = "power_con_yesterday" ,
169143 name = "Power consumption yesterday" ,
170144 icon = "mdi:lightning-bolt" ,
@@ -177,7 +151,6 @@ class PlugwiseBinarySensorEntityDescription(
177151
178152PW_SWITCH_TYPES : tuple [PlugwiseSwitchEntityDescription , ...] = (
179153 PlugwiseSwitchEntityDescription (
180- plugwise_api = STICK ,
181154 key = USB_RELAY_ID ,
182155 device_class = SwitchDeviceClass .OUTLET ,
183156 name = "Relay state" ,
@@ -187,7 +160,6 @@ class PlugwiseBinarySensorEntityDescription(
187160
188161PW_BINARY_SENSOR_TYPES : tuple [PlugwiseBinarySensorEntityDescription , ...] = (
189162 PlugwiseBinarySensorEntityDescription (
190- plugwise_api = STICK ,
191163 key = USB_MOTION_ID ,
192164 name = "Motion" ,
193165 device_class = BinarySensorDeviceClass .MOTION ,
0 commit comments