@@ -103,14 +103,14 @@ def __init__(self, coordinator: CoordinatorEntity, idx: str) -> None:
103103 """Initialize."""
104104 super ().__init__ (coordinator )
105105 self .idx = idx
106+ self .data = self .coordinator .data .get (self .idx )
106107
107108 self .entity_description = LoadSheddingSensorDescription (
108109 key = f"{ DOMAIN } stage" ,
109110 icon = "mdi:lightning-bolt-outline" ,
110111 name = f"{ DOMAIN } stage" ,
111112 entity_registry_enabled_default = True ,
112113 )
113- self .data = self .coordinator .data .get (self .idx )
114114 self ._attr_unique_id = f"{ self .coordinator .config_entry .entry_id } _{ self .idx } "
115115 self .entity_id = f"{ DOMAIN } .{ DOMAIN } _stage_{ idx } "
116116
@@ -191,7 +191,7 @@ def extra_state_attributes(self) -> dict[str, list, Any]:
191191 def _handle_coordinator_update (self ) -> None :
192192 """Handle updated data from the coordinator."""
193193 if data := self .coordinator .data :
194- self .data = data
194+ self .data = data . get ( self . idx )
195195 self .async_write_ha_state ()
196196
197197
@@ -205,8 +205,8 @@ class LoadSheddingAreaSensorEntity(
205205 def __init__ (self , coordinator : CoordinatorEntity , area : Area ) -> None :
206206 """Initialize."""
207207 super ().__init__ (coordinator )
208- self .data = self .coordinator .data .get (area .id )
209208 self .area = area
209+ self .data = self .coordinator .data .get (self .area .id )
210210
211211 self .entity_description = LoadSheddingSensorDescription (
212212 key = f"{ DOMAIN } schedule { area .id } " ,
@@ -297,7 +297,7 @@ def extra_state_attributes(self) -> dict[str, list, Any]:
297297 def _handle_coordinator_update (self ) -> None :
298298 """Handle updated data from the coordinator."""
299299 if data := self .coordinator .data :
300- self .data = data
300+ self .data = data . get ( self . area . id )
301301 self .async_write_ha_state ()
302302
303303
0 commit comments