Skip to content

Commit

Permalink
update interface type
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-bar committed May 13, 2024
1 parent 674f7d6 commit 22b3a0d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
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.4

- Update supported interfaces, including interface type [#137](https://github.com/elad-bar/ha-edgeos/issues/137)

## 2.1.3

- Update supported interfaces [#137](https://github.com/elad-bar/ha-edgeos/issues/137)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ def _extract_interface(
if data is not None:
if interface is None:
interface = EdgeOSInterfaceData(name, interface_type)
else:
interface.update_interface_type(interface_type)

interface.description = data.get(INTERFACE_DATA_DESCRIPTION)
interface.duplex = data.get(INTERFACE_DATA_DUPLEX)
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.3"
"version": "2.1.4"
}
8 changes: 8 additions & 0 deletions custom_components/edgeos/models/edge_os_interface_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ def __init__(self, name: str, interface_type: InterfaceTypes):
def unique_id(self) -> str:
return self.name

def update_interface_type(self, interface_type: InterfaceTypes):
if (
self.interface_type == InterfaceTypes.DYNAMIC
and self.interface_type != interface_type
):
self.interface_type = interface_type
self.is_supported = self._get_is_supported()

def to_dict(self):
obj = {
INTERFACE_DATA_NAME: self.name,
Expand Down

0 comments on commit 22b3a0d

Please sign in to comment.