Custom component: EdgeOS

Just commenting to say I am on the EdgeOS Custom Component bandwagon now.

It is quite impressive and you can see that alot of work has been put into it. Setting it up this afternoon to hopefully finally after all these years with a EdgeRouter to get some decent traffic charts in a simple way. The plan is to use Grafana which I can see is mentioned!

Having the same issue as thoughton

Hi!

For me it’s not necessary to poll every second data from edgeos. So I have the poll settings for now on every 15 minutes. But, because the sensor only updates at this time when I restart HA there isn’t any attribute info available when HA starts for my template sensor. This results in wrong data for my Influx and Graphana. Is it an option to let the sensor from the custom component poll the data when HA starts without setting the update frequency lower? Or is there an other way to solve this?

Thanks for the feedback, happy to see that it useful and answers your needs…

The activity time is being updated once there is a message from the edge router with that device part of it, using the last activity the component calculates the home / away state of device tracker, activity time is HA time

That process of listen to events is parallel to 2 other processes in the component:

  • Update data via API call - heartbeat to prolong the session (once logged in), collect system and devices additional information - takes place every 1 minute (3 different HTTP requests)

  • Update HA components - based on the data gathered by API request and messages received from the edge router creating / updating / deleting entities and devices of the integration - take place every X seconds depends on your configuration in integration’s options

Currently there is an issue that causes the update to fail from running completely, fixed it partially but still need to run tests for several hours to make sure it’s bullet proof

I’m wondering if I am doing anything wrong.

  • Using the HASSIO platform
  • InfluxDB and Grafana installed via addons
  • EdgeOS addon installed via custom components

Graphing of Eth0 (internet traffic in/out) works fine for a bit then stops.

Log file has:

2020-05-14 08:18:48 ERROR (MainThread) [custom_components.edgeos.clients.web_api] Failed to connect https://192.168.1.1/api/edge/get.json, Error: None, Line: 147
2020-05-14 08:18:48 ERROR (MainThread) [custom_components.edgeos.clients.web_api] Invalid response, not contain success status
2020-05-14 08:18:48 ERROR (MainThread) [custom_components.edgeos.managers.data_manager] Failed to load devices data, Error: 'NoneType' object has no attribute 'get', Line: 323

Working on that issue

1 Like

Ok - glad you know what is causing the data loss!

Happy to assist/test in any way!

Hello
I’ve got EdgeRouterX and today I’ve installed component: EdgeOS. It is working but I don’t know why some of my wifi entities are in permanently in state “off” like for expample [binary_sensor.edgeos_device_xiaomi_gateway_2] or [binary_sensor.edgeos_device_yeelink_light_ct2_miap7890, but alexa is always “on”.


Such situation is also with wired entities: [binary_sensor.edgeos_device_synologyds215] is always “on”, but my managed switch tp link is always “off” - [binary_sensor.edgeos_device_tl_sg108e].

What is wrong?

1 Like

2020-05-14

Implemented enhancements:

  • Integration’s options - Renamed Update interval to Update entities interval (will reset the value to default in the first run)

  • Integration’s options - Added Update API interval to set the interval in seconds of the component to access EdgeOS API to get new devices and router settings, default=60 #27

  • Improved the logic of heartbeat to take place every 30 seconds for both WebSocket and API connections

Fixed bugs:

  • Fix API disconnection that causes “Failed to load devices data” errors #29

  • Fix error message on HA termination

can you check if those devices are being updated (rx/tx) in EdgeOS admin UI?

thanks

I tried searching this thread and didn’t see anything mentioned yet: my system uptime isn’t matching. The seconds reported by the integration isn’t even close to the time listed in the EdgeOS management panel.

In order to understand the issue can you please provide more details?
Time is being taken from the router messages (web socket) same as being implemented in the UI of EdgeOS

Can you please go to integration’s options and check the save debug files and send it to my mail:
[email protected]

Instructions of how to extract the files are available in the readme (Link in OP)

Thanks

I’ve installed the new version and will let you know if it drops out - if it does, I’ll change to debug and grab the logs

Some of them - yes like xiaomi gateway


but some of them no - like TP-LINK TL-SG108E


I had some kind of template error, so it does seem it’s getting the correct time, however trying to enable debug log is still crashing the integration, which I emailed the core log.

thanks for the update, answered in the mail regarding the save debug files issue,
if it still happen, I suggest to move it to here, maybe others encountered it

thanks

OK. It seems that checking “save debug file” is not carrying through after submitting and re-opening options. If I change log level to “debug” and check “save debug file” I then get an error in the core logs:

2020-05-15 12:46:37 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/edgeos/__init__.py", line 61, 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 1206, in async_call
    raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Unable to find service logger/set_level
2020-05-15 12:46:37 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/edgeos/__init__.py", line 61, 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 1206, in async_call
    raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Unable to find service logger/set_level

and on server restart I cannot access integration options and get “Please wait while the integration is being installed”

image
And the following log:

2020-05-15 12:52:56 INFO (MainThread) [custom_components.edgeos.config_flow] Starting additional settings step: None
2020-05-15 12:52:56 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 125, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 186, in post
    return await super().post(request)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 54, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 63, in post
    handler, context={"source": config_entries.SOURCE_USER}
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 124, in async_init
    flow, flow.init_step, data, init_done
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 196, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/config/custom_components/edgeos/config_flow.py", line 93, in async_step_init
    return await self.async_step_edge_os_additional_settings(user_input)
  File "/config/custom_components/edgeos/config_flow.py", line 123, in async_step_edge_os_additional_settings
    schema = self._config_flow.get_default_options()
  File "/config/custom_components/edgeos/managers/config_flow_manager.py", line 167, in get_default_options
    all_interfaces = self._get_available_options(system_data, INTERFACES_KEY)
  File "/config/custom_components/edgeos/managers/config_flow_manager.py", line 359, in _get_available_options
    for item_key in all_items:
TypeError: 'NoneType' object is not iterable

Can you provide me steps to reproduce how did you install the integration?
Didn’t manage to reproduce it with hassio / ha docker, clean or existing integration,
If you upgraded, how did you do that?

Thanks

I have to remove and re-add the integration once it hangs after setting “Debug” option, and I believe I’m following the normal method. Add the integration, fill all initial fields available (switching unit to MBytes), submit. Re-opening options and and filling all other fields except log options initially, submit. Re-open options and set log level.

I did previously have the version that required configuration in configuration.yaml, but that’s all commented out currently, and hasn’t been used for months. My recorder is writing to an network server, not sure if that would have anything to do with it either.

I just wanted to say the recent change to fix the disconnecting seems to be working well so far!