@@ -35,13 +35,10 @@ async def async_setup_entry(
35
35
switchlist : list = []
36
36
for switch in switches :
37
37
name = await sector_hub .get_name (switch , "switch" )
38
- identification = await sector_hub .get_id (switch )
39
38
description = SwitchEntityDescription (
40
39
key = switch , name = name , device_class = DEVICE_CLASS_OUTLET
41
40
)
42
- switchlist .append (
43
- SectorAlarmSwitch (sector_hub , coordinator , description , identification )
44
- )
41
+ switchlist .append (SectorAlarmSwitch (sector_hub , coordinator , description ))
45
42
46
43
if switchlist :
47
44
async_add_entities (switchlist )
@@ -50,7 +47,12 @@ async def async_setup_entry(
50
47
class SectorAlarmSwitch (CoordinatorEntity , SwitchEntity ):
51
48
"""Sector Switch."""
52
49
53
- def __init__ (self , hub , coordinator , description , identification ) -> None :
50
+ def __init__ (
51
+ self ,
52
+ hub : SectorAlarmHub ,
53
+ coordinator : DataUpdateCoordinator ,
54
+ description : SwitchEntityDescription ,
55
+ ) -> None :
54
56
"""Initialize Switch."""
55
57
self ._hub = hub
56
58
super ().__init__ (coordinator )
@@ -59,7 +61,7 @@ def __init__(self, hub, coordinator, description, identification) -> None:
59
61
self ._attr_unique_id : str = "sa_switch_" + str (description .key )
60
62
self .entity_description = description
61
63
self ._attr_is_on = self ._hub .switch_state [self ._serial ]
62
- self ._id = identification
64
+ self ._id : str = self . _hub . get_id [ self . _serial ]
63
65
64
66
@property
65
67
def device_info (self ) -> DeviceInfo :
0 commit comments