Use chip id in Konnected pro boards (#36940)

* use chip id in pro boards

* cleaner failover
This commit is contained in:
Kit Klein authored and GitHub committed 2020-06-20 08:39:04 +02:00
1 parent 2fd6431cff
commit a074cf4afd
3 files changed
+13 -8

No files matched your search

@@ -185,7 +185,7 @@ class KonnectedFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
self.data[CONF_PORT] = port
try:
status = await get_status(self.hass, host, port)
self.data[CONF_ID] = status["mac"].replace(":", "")
self.data[CONF_ID] = status.get("chipId", status["mac"].replace(":", ""))
except (CannotConnect, KeyError):
raise CannotConnect
else:
@@ -293,7 +293,9 @@ class KonnectedFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
except CannotConnect:
errors["base"] = "cannot_connect"
else:
self.data[CONF_ID] = status["mac"].replace(":", "")
self.data[CONF_ID] = status.get(
"chipId", status["mac"].replace(":", "")
)
self.data[CONF_MODEL] = status.get("model", KONN_MODEL)
# save off our discovered host info
+1 -1
View File
@@ -76,7 +76,7 @@ class AlarmPanel:
@property
def device_id(self):
"""Device id is the MAC address as string with punctuation removed."""
"""Device id is the chipId (pro) or MAC address as string with punctuation removed."""
return self.config.get(CONF_ID)
@property