Skip to content

Commit

Permalink
Merge pull request #148 from elad-bar/fix-unsupported-interfaces
Browse files Browse the repository at this point in the history
handling undefined interface types
  • Loading branch information
elad-bar authored May 14, 2024
2 parents b25d5ea + fba2226 commit 0bc8dae
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
15 changes: 11 additions & 4 deletions custom_components/edgeos/data_processors/interface_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion custom_components/edgeos/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 0bc8dae

Please sign in to comment.