@@ -51,12 +51,23 @@ class FloorRegistryStoreData(TypedDict):
5151 floors : list [_FloorStoreData ]
5252
5353
54- class EventFloorRegistryUpdatedData (TypedDict ):
54+ class _EventFloorRegistryUpdatedData_Create_Remove_Update (TypedDict ):
5555 """Event data for when the floor registry is updated."""
5656
57- action : Literal ["create" , "remove" , "update" , "reorder" ]
58- floor_id : str | None
57+ action : Literal ["create" , "remove" , "update" ]
58+ floor_id : str
59+
60+
61+ class _EventFloorRegistryUpdatedData_Reorder (TypedDict ):
62+ """Event data for when the floor registry is updated."""
5963
64+ action : Literal ["reorder" ]
65+
66+
67+ type EventFloorRegistryUpdatedData = (
68+ _EventFloorRegistryUpdatedData_Create_Remove_Update
69+ | _EventFloorRegistryUpdatedData_Reorder
70+ )
6071
6172type EventFloorRegistryUpdated = Event [EventFloorRegistryUpdatedData ]
6273
@@ -200,7 +211,9 @@ def async_create(
200211
201212 self .hass .bus .async_fire_internal (
202213 EVENT_FLOOR_REGISTRY_UPDATED ,
203- EventFloorRegistryUpdatedData (action = "create" , floor_id = floor_id ),
214+ _EventFloorRegistryUpdatedData_Create_Remove_Update (
215+ action = "create" , floor_id = floor_id
216+ ),
204217 )
205218 return floor
206219
@@ -211,7 +224,7 @@ def async_delete(self, floor_id: str) -> None:
211224 del self .floors [floor_id ]
212225 self .hass .bus .async_fire_internal (
213226 EVENT_FLOOR_REGISTRY_UPDATED ,
214- EventFloorRegistryUpdatedData (
227+ _EventFloorRegistryUpdatedData_Create_Remove_Update (
215228 action = "remove" ,
216229 floor_id = floor_id ,
217230 ),
@@ -253,7 +266,7 @@ def async_update(
253266 self .async_schedule_save ()
254267 self .hass .bus .async_fire_internal (
255268 EVENT_FLOOR_REGISTRY_UPDATED ,
256- EventFloorRegistryUpdatedData (
269+ _EventFloorRegistryUpdatedData_Create_Remove_Update (
257270 action = "update" ,
258271 floor_id = floor_id ,
259272 ),
@@ -280,7 +293,7 @@ def async_reorder(self, floor_ids: list[str]) -> None:
280293 self .async_schedule_save ()
281294 self .hass .bus .async_fire_internal (
282295 EVENT_FLOOR_REGISTRY_UPDATED ,
283- EventFloorRegistryUpdatedData (action = "reorder" , floor_id = None ),
296+ _EventFloorRegistryUpdatedData_Reorder (action = "reorder" ),
284297 )
285298
286299 async def async_load (self ) -> None :
0 commit comments