Catch unknown equipment values (#49073)

* Catch unknown equipment values

* Catch unknown equipment values

* Remove warning spam.
pull/49086/head
Kevin Worrel 2021-04-11 15:12:59 -07:00 committed by GitHub
parent 1d28f485d3
commit 41ff6fc278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -195,9 +195,15 @@ class ScreenlogicEntity(CoordinatorEntity):
"""Return device information for the controller."""
controller_type = self.config_data["controller_type"]
hardware_type = self.config_data["hardware_type"]
try:
equipment_model = EQUIPMENT.CONTROLLER_HARDWARE[controller_type][
hardware_type
]
except KeyError:
equipment_model = f"Unknown Model C:{controller_type} H:{hardware_type}"
return {
"connections": {(dr.CONNECTION_NETWORK_MAC, self.mac)},
"name": self.gateway_name,
"manufacturer": "Pentair",
"model": EQUIPMENT.CONTROLLER_HARDWARE[controller_type][hardware_type],
"model": equipment_model,
}