diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fdeef1..1835947 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.1.5 + +- Handling undefined interface types [#137](https://github.com/elad-bar/ha-edgeos/issues/137) + ## 2.1.4 - Update supported interfaces, including interface type [#137](https://github.com/elad-bar/ha-edgeos/issues/137) diff --git a/custom_components/edgeos/data_processors/interface_processor.py b/custom_components/edgeos/data_processors/interface_processor.py index a43f2ac..ef44823 100644 --- a/custom_components/edgeos/data_processors/interface_processor.py +++ b/custom_components/edgeos/data_processors/interface_processor.py @@ -46,6 +46,7 @@ def __init__(self, config_data: ConfigData): self.processor_type = DeviceTypes.INTERFACE self._interfaces: dict[str, EdgeOSInterfaceData] = {} + self._supported_interface_types = list(InterfaceTypes) def get_interfaces(self) -> list[str]: return list(self._interfaces.keys()) @@ -102,11 +103,17 @@ def _process_api_data(self): if interfaces is not None: for interface_name in interfaces: interface_data = interfaces.get(interface_name, {}) - int_type = InterfaceTypes(interface_type) - self._extract_interface( - interface_name, interface_data, int_type - ) + if interface_type in self._supported_interface_types: + int_type = InterfaceTypes(interface_type) + + self._extract_interface( + interface_name, interface_data, int_type + ) + else: + _LOGGER.info( + f"Skip loading interface {interface_name}, Type: {interface_type} is not supported" + ) except Exception as ex: exc_type, exc_obj, tb = sys.exc_info() diff --git a/custom_components/edgeos/manifest.json b/custom_components/edgeos/manifest.json index 59ef62b..f64fbe4 100644 --- a/custom_components/edgeos/manifest.json +++ b/custom_components/edgeos/manifest.json @@ -8,5 +8,5 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/elad-bar/ha-edgeos/issues", "requirements": ["aiohttp"], - "version": "2.1.4" + "version": "2.1.5" }