elad-bar / ha-edgeos

Integration with EdgeOS (Ubiquiti)
133 stars 24 forks source link

Monitored device sensors report 'Disconnected' when devices are connected, and device traffic sensors sent/received still update #65

Closed Timeteo closed 1 year ago

Timeteo commented 2 years ago

Not sure when my monitored devices stopped reporting 'Connected'. Monitored interface show correct status, but devices show 'Disconnected' even though the traffic sent/received sensors are updating. I see this in the logs:

Logger: unifi_discovery
Source: /usr/local/lib/python3.9/site-packages/unifi_discovery/__init__.py:434
First occurred: 9:40:13 AM (2 occurrences)
Last logged: 9:40:13 AM

Failed to get system info for xx.xx.xxx.xx [I redacted this. was WAN IP of router]
Failed to get system info for xx.xx.xxx.xx [I redacted this. was LAN IP of router]
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/unifi_discovery/__init__.py", line 432, in _probe_services_and_system
    system = await system_response.json()
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://xx.xx.xx.xx/api/system')  [I redacted this. was WAN IP of router]

I tried to bump logging to debug and then this appeared in the logs:

Logger: homeassistant
Source: core.py:1574
First occurred: 8:58:51 AM (12 occurrences)
Last logged: 10:02:41 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/edgeos/__init__.py", line 59, in async_options_updated
    await handle_log_level(hass, entry)
  File "/config/custom_components/edgeos/helpers/__init__.py", line 66, in handle_log_level
    await hass.services.async_call(DOMAIN_LOGGER, SERVICE_SET_LEVEL, log_level_data)
  File "/usr/src/homeassistant/homeassistant/core.py", line 1574, in async_call
    raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Unable to find service logger.set_level
elad-bar commented 2 years ago

are you sure you are working with edgeos component? the logs are for unifi_discovery

thanks

Timeteo commented 2 years ago

Thanks for the reply @elad-bar, and thanks for sharing this integration.

Below is the integration I am using and following the "Known Issues" link under the 3 dots brought me to this repo, so I believe I am using the edgeos component.

I may have shared an incorrect log entry. This integration is the only Unifi/Edge integration I have so I thought the entry with unifi_discovery was just a library that is being used with this integration. I don't have any other addons or integrations for Unifi. The only Unifi hardware I have is this one Edgerouter.

20220605_152457173_iOS

When I try to change the log level in the set-up to "debug", I get this:

This error originated from a custom integration.

Logger: custom_components.edgeos
Source: custom_components/edgeos/__init__.py:40
Integration: Ubiquiti EdgeOS Routers (documentation, issues)
First occurred: 8:29:58 AM (1 occurrences)
Last logged: 8:29:58 AM

Failed to load EdgeOS, error: Unable to find service logger.set_level, line: 27

And the integration shows as failed with that 'debug' log level set. Screenshot 2022-06-05 084202

When trying to reconfigure the integration, the areas to select what to monitor is no longer a selectable field but just a static label: Screenshot 2022-06-05 084051

Trying to reset the logging back to 'default' and 'Save', throws an error for the devices (but not interfaces) that were previously selected to monitor: Screenshot 2022-06-05 084042

The only way to get back from this point is to uninstall/reinstall the integration. If you can guide me to get more helpful logs, then I'll share those. Thanks.

elad-bar commented 2 years ago

Did you set static ips or is it dynamically being set by the dhcp?

In regards to the logs, pls try to set it manually:

logger:
  default: warning
  logs:
    custom_components.edgeos: debug

Thanks

Timeteo commented 2 years ago

I am only attempting to monitor devices with static IPs. Actually, DHCP assigned devices don't even appear under 'monitored devices'. For now I am limiting to a single device 'Tims-Rig' Here is the edgeos.log . Thanks

elad-bar commented 1 year ago

can you please update if it happens with v2.x?

thanks

Timeteo commented 1 year ago

I checked it against the data showing in the EdgeRouter and it matches :-). Thanks! I like how the new version allows me to add/remove the tracked devices on the fly without having to go into the integration configuration screen. Thanks again.

elad-bar commented 1 year ago

Thanks for the feedback