Skip to content

Commit

Permalink
Merge pull request #154 from Snuffy2/Don't-show-error-if-OpenVPN-isn'…
Browse files Browse the repository at this point in the history
…t-used-

Don't show error if OpenVPN isn't used
  • Loading branch information
alexdelprete authored Sep 6, 2024
2 parents c121b41 + 25e09ec commit 3708e63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions custom_components/opnsense/pyopnsense/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,12 @@ def _get_telemetry_filesystems(self) -> dict:
def _get_telemetry_openvpn(self) -> dict:
openvpn_info: Mapping[str, Any] = self._post("/api/openvpn/export/providers")
_LOGGER.debug(f"[get_telemetry_openvpn] openvpn_info: {openvpn_info}")
if (
openvpn_info is not None
and isinstance(openvpn_info, list)
and len(openvpn_info) == 0
):
return {}
if (
openvpn_info is None
or not isinstance(openvpn_info, Mapping)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/opnsense/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def native_value(self):
property = self._opnsense_get_interface_property_name()
try:
return interface[property]
except KeyError:
except (KeyError, TypeError):
return STATE_UNKNOWN


Expand Down

0 comments on commit 3708e63

Please sign in to comment.