ElkM1 fix auto-configure. (#42064)
The elkm1-lib autoconfigure set the `configured` flag based on an attribute of the element being changed. This approach misses counters and thermostats. It also does not work well well an "unconfigured" element's default value is different from what is on the panel. This was the case for zones (the `area` attribute was different). The fix in the library is to mark an element as `configured` when the element has a name associated with it. This change is technically breaking, although I imagine, few if any people will be affected as (1) they configure names on all elements (2) the functionality was not working properly, so element would not be missing. The HA docs will be updated to add a section on autoconfigure. It will describe that to have an element automatically configured then the element must be configured on the ElkM1 panel with a name. This particular patch is required for ElkM1 areas. The existing logic assumes that an area is configured if it has an associated keypad. Not all areas have keypads (I have an area only armable with HA). The library fix should catch all configured areas.pull/42067/head
parent
59a3add24a
commit
304b9f47b4
|
@ -60,18 +60,9 @@ SERVICE_ALARM_CLEAR_BYPASS = "alarm_clear_bypass"
|
||||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up the ElkM1 alarm platform."""
|
"""Set up the ElkM1 alarm platform."""
|
||||||
elk_data = hass.data[DOMAIN][config_entry.entry_id]
|
elk_data = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
entities = []
|
|
||||||
|
|
||||||
elk = elk_data["elk"]
|
elk = elk_data["elk"]
|
||||||
areas_with_keypad = set()
|
entities = []
|
||||||
for keypad in elk.keypads:
|
create_elk_entities(elk_data, elk.areas, "area", ElkArea, entities)
|
||||||
areas_with_keypad.add(keypad.area)
|
|
||||||
|
|
||||||
areas = []
|
|
||||||
for area in elk.areas:
|
|
||||||
if area.index in areas_with_keypad or elk_data["auto_configure"] is False:
|
|
||||||
areas.append(area)
|
|
||||||
create_elk_entities(elk_data, areas, "area", ElkArea, entities)
|
|
||||||
async_add_entities(entities, True)
|
async_add_entities(entities, True)
|
||||||
|
|
||||||
platform = entity_platform.current_platform.get()
|
platform = entity_platform.current_platform.get()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"domain": "elkm1",
|
"domain": "elkm1",
|
||||||
"name": "Elk-M1 Control",
|
"name": "Elk-M1 Control",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/elkm1",
|
"documentation": "https://www.home-assistant.io/integrations/elkm1",
|
||||||
"requirements": ["elkm1-lib==0.8.3"],
|
"requirements": ["elkm1-lib==0.8.4"],
|
||||||
"codeowners": ["@gwww", "@bdraco"],
|
"codeowners": ["@gwww", "@bdraco"],
|
||||||
"config_flow": true
|
"config_flow": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -535,7 +535,7 @@ elgato==0.2.0
|
||||||
eliqonline==1.2.2
|
eliqonline==1.2.2
|
||||||
|
|
||||||
# homeassistant.components.elkm1
|
# homeassistant.components.elkm1
|
||||||
elkm1-lib==0.8.3
|
elkm1-lib==0.8.4
|
||||||
|
|
||||||
# homeassistant.components.mobile_app
|
# homeassistant.components.mobile_app
|
||||||
emoji==0.5.4
|
emoji==0.5.4
|
||||||
|
|
|
@ -278,7 +278,7 @@ eebrightbox==0.0.4
|
||||||
elgato==0.2.0
|
elgato==0.2.0
|
||||||
|
|
||||||
# homeassistant.components.elkm1
|
# homeassistant.components.elkm1
|
||||||
elkm1-lib==0.8.3
|
elkm1-lib==0.8.4
|
||||||
|
|
||||||
# homeassistant.components.mobile_app
|
# homeassistant.components.mobile_app
|
||||||
emoji==0.5.4
|
emoji==0.5.4
|
||||||
|
|
Loading…
Reference in New Issue