Custom component: EdgeOS

After configuiring my edgeos, I ended up with an loop of the following messages:

2019-06-14 17:14:59 INFO (MainThread) [custom_components.edgeos.web_socket] Closing connection
2019-06-14 17:14:59 INFO (MainThread) [custom_components.edgeos.web_socket] Connection closed
2019-06-14 17:14:59 INFO (MainThread) [custom_components.edgeos.web_socket] Connection connected, Subscribing to: {subscription_data}
2019-06-14 17:14:59 INFO (MainThread) [custom_components.edgeos.web_socket] Subscribed
2019-06-14 17:14:59 INFO (MainThread) [custom_components.edgeos.web_socket] Closing connection
2019-06-14 17:14:59 INFO (MainThread) [custom_components.edgeos.web_socket] Connection closed
2019-06-14 17:14:59 INFO (MainThread) [custom_components.edgeos.web_socket] Connection connected, Subscribing to: {subscription_data}
2019-06-14 17:14:59 INFO (MainThread) [custom_components.edgeos.web_socket] Subscribed
2019-06-14 17:14:59 INFO (MainThread) [custom_components.edgeos.web_socket] Closing connection
2019-06-14 17:14:59 INFO (MainThread) [custom_components.edgeos.web_socket] Connection closed

What am I missing?

Here is my config:
edgeos:
host: !secret edge_os_host
ssl: false
username: !secret edge_os_username
password: !secret edge_os_password
monitored_interfaces:
- eth0
- eth1
monitored_devices:
- server
- Oscar-Phone
unit: ‘M’

device_tracker:

  • platform: edgeos
    hosts:
    • Oscar-Phone

I forgot to mention that the version of the file that I am getting has some wrong encoding:
I am getting this error:
File “/home/homeassistant/.homeassistant/custom_components/edgeos/init.py”, line 98
_LOGGER.info(f’Stop begun at {event_time}’)
^
SyntaxError: invalid syntax

So I figure it out, my installation is still using Python 3.5

I would be nice to add a compile check for the required version of python in the extension metadata.

As of version 0.94 Python v3.5 is deprecated. So it’s time to upgrade anyway.

Thank you very much, it’s working here!
The problem is that it is taking a long time for the device to disconnect.
Is there any way to improve this?

Great component :+1:. Thanks for sharing this :smile:.
Also looking for ways to speed up detection.
Maybe could add an option if no data is exchanged for x minutes with a particular device, then consider as disconnected ?

Where does the component pull its client info from? Dhcp leases, arp table, etc? If it pulls from something like that it should be configurable.

I don’t understand how to graph a particular attribute from this now. When I add an “entity” card, it only shows me the connected status, and I can click and see details. I’d really like to show a graph of the current bandwidth usage for example, but I can’t find any docs on how to plot just the one attribute from this device now. Any tips?

1 Like

Create a template sensor that uses the attribute in the template.

value_template: "{{ state_attr('sensor.object_id", 'attribute') }}"

How hard will it be to integrate the “load balancing” feature of the EdgeOS into this cumponent and expose both the “watchdog” status and the “actual wlb status” into Hass?
Bonus if we could get a notification of transition between connections.

I monitor 2 devices and 2 interfaces which work fine for a few hours then they stop updating and I receive the following error in my logs.

Failed to get devices data, Error: 403, message=‘Forbidden’, url='https://192.168.0.1/api/edge/get.json, Line: 89

If I restart Home Assistant it will work again but after a few hours I have the same problem again.

Hello and thanks you for your work !

I’am trying to configure this co)mpoment but i have these errors in hassio:

Failed to get devices data, Error: 403, message=‘Forbidden’, url='https://192.168.2.1/api/edge/get.json, Line: 83
Failed to listen EdgeOS, Error: 400, message=‘Invalid response status’, url='wss://192.168.2.1/ws/stats

This is my configuration file:

# EdgeOS
edgeos:
    host: 192.168.2.1
    ssl: true
    username: admin
    password: mypass
    #cert_file: 
    monitored_interfaces: #List of interfaces
        - eth1
    monitored_devices: #List of network devices to monitor
        - PC-Florent
    unit: 'M' #Optional - Allowed values: '' - represents bytes, 'K' - Kilobytes, 'M' - Megabytes

Do you have an idea where is the problem ?

@stevenhorner and @fmplaw - I didn’t encounter that kind of issue, over the last few days,
I did made some changes that during the way there could of be buggy commit,
Can you try taking the latest version?

few questions:
Are you using HACS to update the component?
is there a configuration in EdgeOS for auto logout?
when it happens, can you check what is the data of component sensor.edgeos_system_uptime (state and attributes)?

Can you please change the log just for edgeos to debug?
that will assist to understand what happened with the component over the time.

thanks

Hi @bar

i dont use hacs to update the component, but i download it from github et copy it via samba share.
About auto logout i dont find any settings on EdgeOS.

This is my data from the ensor.edgeos_system_uptime :

sensor.edgeos_system_uptime - state 0 
unit_of_measurement: seconds 
friendly_name: EdgeOS System Uptime 
API Last Update: 2019-10-19T23:28:56.184442 
WS Last Update: 2019-10-19T23:14:37.692576 

Can you explain me how i set debug mode ?

Thank you.

The Component is working fine fore me…
But now I want to see what the bandwidth is so I want to create a sensor template

# EdgeRouter
- platform: template
  sensors:
    Edge_etho_in:
      friendly_name: "Edgerouter EthO In"
      unit_of_measurement: 'MBytes'
      value_template: "{{ state_attr('binary_sensor.edgeos_interface_eth0', 'MBytes (Received)') }}"

But this is not value, but I can see what

Added that functionality in latest version, will take 10 minutes to identify that the device is disconnected (will try to reduce it to 2-3 minutes).

After deeper investigation of that issue why it takes 30 minutes to notify the device is offline - I found out that the router tries to send requests and count them for the first 30 minutes the device is disconnected.

Thanks :slight_smile: Looking forward to try it.
For the moment using the version of dels78 as a custom components


Detection of disconnected device is fast and pretty reliable but there are some miss from time to time.

I fixed that issue, it usually happens when the authentication is expired due to time passed since login or reboot of router

Also added binary sensor for system status

Added the logic that checks for inactivity, now it takes 3 minutes to report device is offline

Would you or someone be so kind to provide a practical example ?

I got the custom component working and I have a bunch of binary.sensors.

For example binary_sensor.edgeos_device_macbook.
And I would like to have a card that displays the curent downlaod speed.

So I created :

sensor:
 - platform: template
   sensors:
     sensor_Macbook_downspeed:
       friendly_name: "Macbook Download speed"
       unit_of_measurement: 'MB/s'
       value_template: "{{ state_attr('binary_sensor.edgeos_device_macbook', 'MBps (Received)') }}"

I do not know if my template is OK or not but I assumed I should find a “sensor_Macbook_downspeed” sensor to show in a card. But no.

Would you or someone be so kind to provide a practical example ?