Prepare for Ihc config flow (#64852)
* Extracting group and extra info from ihc products * Make suggested area not optional * Revert back to assignment expression := * Make auto setup show device info for all platforms * Change code comment to # * Add return typing * Remove device_info key without value * get_manual_configuration typings for everything * Adding IHCController typings * Remove "ihc" from unique id * Remove device_info * Separator in unique id * Return typing on ihc_setup Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/ihc/ihcdevice.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/ihc/ihcdevice.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Raise ValueError instead of logging an error * Update homeassistant/components/ihc/service_functions.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Catch up with dev Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
43671da7cf
commit
a644baf3cd
10 changed files with 122 additions and 68 deletions
|
@ -120,19 +120,25 @@ def get_discovery_info(platform_setup, groups, controller_id):
|
|||
for product_cfg in platform_setup:
|
||||
products = group.findall(product_cfg[CONF_XPATH])
|
||||
for product in products:
|
||||
product_id = int(product.attrib["id"].strip("_"), 0)
|
||||
nodes = product.findall(product_cfg[CONF_NODE])
|
||||
for node in nodes:
|
||||
if "setting" in node.attrib and node.attrib["setting"] == "yes":
|
||||
continue
|
||||
ihc_id = int(node.attrib["id"].strip("_"), 0)
|
||||
name = f"{groupname}_{ihc_id}"
|
||||
# make the model number look a bit nicer - strip leading _
|
||||
model = product.get("product_identifier", "").lstrip("_")
|
||||
device = {
|
||||
"ihc_id": ihc_id,
|
||||
"ctrl_id": controller_id,
|
||||
"product": {
|
||||
"id": product_id,
|
||||
"name": product.get("name") or "",
|
||||
"note": product.get("note") or "",
|
||||
"position": product.get("position") or "",
|
||||
"model": model,
|
||||
"group": groupname,
|
||||
},
|
||||
"product_cfg": product_cfg,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue