@@ -102,8 +102,7 @@ async def async_setup_entry(
102102class BaseSensor (SensorEntity ):
103103 """Representation of an APsystem sensor."""
104104
105- _attr_available = True
106- _attributes = {}
105+ _attr_available = False
107106
108107 def __init__ (
109108 self , api : APsystemsEZ1M , device_name : str , sensor_name : str , sensor_id : str
@@ -138,16 +137,11 @@ def device_info(self) -> DeviceInfo:
138137 model = "EZ1-M" ,
139138 )
140139
141- @property
142- def extra_state_attributes (self ):
143- """Return entity specific state attributes."""
144- return self ._attributes
145-
146140 async def async_update_data (self ):
147141 try :
148142 data = await self ._api .get_output_data ()
149143 self .update_state (data )
150- self ._attr_available = True
144+ self ._attr_available = False
151145 except (client_exceptions .ClientConnectionError , asyncio .TimeoutError ):
152146 self ._attr_available = False
153147
@@ -164,7 +158,6 @@ class BasePowerSensor(BaseSensor):
164158
165159class PowerSensorTotal (BasePowerSensor ):
166160 def update_state (self , data ):
167- self ._attributes = None
168161 self ._state = data .p1 + data .p2
169162
170163 async def async_update (self ):
@@ -173,7 +166,6 @@ async def async_update(self):
173166
174167class PowerSensorTotalP1 (BasePowerSensor ):
175168 def update_state (self , data ):
176- self ._attributes = None
177169 self ._state = data .p1
178170
179171 async def async_update (self ):
@@ -182,7 +174,6 @@ async def async_update(self):
182174
183175class PowerSensorTotalP2 (BasePowerSensor ):
184176 def update_state (self , data ):
185- self ._attributes = None
186177 self ._state = data .p2
187178
188179 async def async_update (self ):
@@ -199,7 +190,6 @@ class LifetimeEnergy(BaseEnergySensor):
199190 _attr_state_class = SensorStateClass .TOTAL
200191
201192 def update_state (self , data ):
202- self ._attributes = {"p1" : data .te1 , "p2" : data .te2 }
203193 self ._state = data .te1 + data .te2
204194
205195 async def async_update (self ):
@@ -210,7 +200,6 @@ class LifetimeEnergyP1(BaseEnergySensor):
210200 _attr_state_class = SensorStateClass .TOTAL
211201
212202 def update_state (self , data ):
213- self ._attributes = None
214203 self ._state = data .te1
215204
216205 async def async_update (self ):
@@ -221,7 +210,6 @@ class LifetimeEnergyP2(BaseEnergySensor):
221210 _attr_state_class = SensorStateClass .TOTAL
222211
223212 def update_state (self , data ):
224- self ._attributes = None
225213 self ._state = data .te2
226214
227215 async def async_update (self ):
@@ -232,7 +220,6 @@ class TodayEnergy(BaseEnergySensor):
232220 _attr_state_class = SensorStateClass .TOTAL_INCREASING
233221
234222 def update_state (self , data ):
235- self ._attributes = None
236223 self ._state = data .e1 + data .e2
237224
238225 async def async_update (self ):
@@ -243,7 +230,6 @@ class TodayEnergyP1(BaseEnergySensor):
243230 _attr_state_class = SensorStateClass .TOTAL_INCREASING
244231
245232 def update_state (self , data ):
246- self ._attributes = None
247233 self ._state = data .e1
248234
249235 async def async_update (self ):
@@ -254,7 +240,6 @@ class TodayEnergyP2(BaseEnergySensor):
254240 _attr_state_class = SensorStateClass .TOTAL_INCREASING
255241
256242 def update_state (self , data ):
257- self ._attributes = None
258243 self ._state = data .e2
259244
260245 async def async_update (self ):
0 commit comments