File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change 96
96
STATE_OFF ,
97
97
STATE_ON ,
98
98
)
99
+ from homeassistant .const import __version__ as ha_version
99
100
from homeassistant .core import Context , Event , HomeAssistant , State
100
101
from homeassistant .helpers import area_registry as ar
101
102
from homeassistant .helpers import entity_registry
@@ -1340,17 +1341,20 @@ def mock_area_registry(
1340
1341
"""Mock the Area Registry."""
1341
1342
registry = ar .AreaRegistry (hass )
1342
1343
registry ._area_data = {}
1343
- area_in_floor = ar .AreaEntry (
1344
- id = "test-area" ,
1345
- name = "Test area" ,
1346
- aliases = {},
1347
- normalized_name = "test-area" ,
1348
- floor_id = "test-floor" ,
1349
- icon = None ,
1350
- picture = None ,
1351
- )
1344
+ area_kwargs = {
1345
+ "name" : "Test Area" ,
1346
+ "normalized_name" : "test-area" ,
1347
+ "aliases" : {},
1348
+ "id" : "test-area" ,
1349
+ "picture" : None ,
1350
+ }
1351
+ year , month = (int (x ) for x in ha_version .split ("." )[:2 ])
1352
+ if year >= 2024 and month >= 3 :
1353
+ area_kwargs ["icon" ] = None
1354
+ area_kwargs ["floor_id" ] = "test-floor"
1355
+ area = ar .AreaEntry (** area_kwargs )
1352
1356
registry .areas = ar .AreaRegistryItems ()
1353
- registry .areas [area_in_floor .id ] = area_in_floor
1357
+ registry .areas [area .id ] = area
1354
1358
hass .data [ar .DATA_REGISTRY ] = registry
1355
1359
return registry
1356
1360
You can’t perform that action at this time.
0 commit comments