Custom component: EdgeOS

Integration with EdgeOS


Provides an integration between EdgeOS (Ubiquiti) routers to Home Assistant.

How to set it up:


  • EdgeRouter User with ‘Operator’ level access or higher
  • Traffic Analysis set to ‘Hosts only’ or ‘Enabled’

Basic configuration

  • Configuration should be done via Configuration -> Integrations.
  • In case you are already using that integration with YAML Configuration - please removed it
  • Integration supports multiple devices
  • In the setup form, the following details are mandatory:
    • Name - Unique
    • Host (or IP)
    • Username (It’s better to create a unique user to identify issues related to the integration)
    • Password
    • Unit (Bytes, Kilebytes, Megabytes)
  • Upon submitting the form of creating an integration login to the EdgeOS device will take place and will cause failure in case:
    • Cannot reach device (404)
    • Invalid credentials (403)
    • General authentication error (when failed to get valid response from device)

Monitoring interfaces, devices and track devices

Configuration -> Integrations -> {Integration} -> Options

Form will open at the first time with 3 fields (Comma Separated Values):

  • Monitored devices
  • Monitored interfaces
  • Track devices

Once details are saved and accessing that form again,
an additional checkbox will appear below each of the fields that has values, why?

Deleting the data from a specific field will not delete it, to delete that data completely in specific field you can:

  • Use the checkbox
  • Use space instead of the text (it will be trimmed and deleted eventually)

* This is a workaround until I will find a nicer solution

By default, following entities will be generated

Binary Sensor
Binary Sensor
Name: {Integration Name} System Status
State: Connected
    API Last Update
    WS Last Update
Name: {Integration Name} System Uptime
State: Up time in seconds
    API Last Update
    WS Last Update
    is alive
Name: {Integration Name} Unknown Devices
State: # of devices connected not set as static IPs
    Unknown Devices

Following components will be generated upon options configuration of the integration:

More details available after this section

Binary Sensor (Per monitored interface)
Name: {Integration Name} Interface {Interface Name}
State: Connected
    Link Speed (Mbps)
    Packets (Sent / Received)
    Errors (Sent / Received)
    Dropped Packets (Sent / Received)
    *Bytes (Sent / Received)
    *Bytes/ps (Sent / Received)
Binary Sensor (Per monitored device)
Name: {Integration Name} Device {Device Name}
State: Connected
    *Bytes/ps (Sent / Received)
    *Bytes (Sent / Received)
Device Tracker (Per tracked device)
Name: {Integration Name} {Device Name}
State: Home / Not home
    Last Activity

Setting up the integration

Setup integration

Edit options - First time

Edit options - With saved fields


Just tried to add this to my custom_components folder. Added the example lines to my configuration.yaml, changing the values to match my system but when restarting I get the following in my log

Setup failed for edgeos: Component not found

Along with another couple of similar lines about not being able to find the edgeos Component.

Inside my custom_components folder I created an edgeos folder and inside is the contents of the custom_components folder on the GitHub repo. Have I missed something, everything looks similar to the other custom_components I have working in HASS.

Any help appreciated, this Component sounds great.

Realised that I needed to copy everything from the custom_components folder of the Github Repo straight to my custom_components folder. So it should contain the file and the device_tracker folder.

Looking at it now that was obvious, it’s late and confused me because the other custom components I have are under sensor or media_center folders.

The next issue I have is around the cert config line, I left it blank and threw an error, removed the whole line from my configuration.yaml and now I get:

Invalid config for [edgeos]: string value is None for dictionary value @ data['edgeos']['cert_file']. Got None. (See /config/configuration.yaml, line 404). Please check the docs at

Do I have to use a certificate on my ERL-3, I said False to SSL in the config of this component. I think I may need to wait until some documentation is written, I’m obviously missing something.

I tried this path for the cert file “/etc/lighttpd/server.pem” but keeps coming back with verify failed:

2019-02-08 10:31:23 ERROR (SyncWorker_15) [custom_components.edgeos] Failed to perform heartbeat, Error: HTTPSConnectionPool(host=‘’, port=443): Max retries exceeded with url: /api/edge/heartbeat.json?t=1549593083 (Caused by SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:847)’),))
2019-02-08 10:31:23 ERROR (SyncWorker_15) [custom_components.edgeos] Failed to load static-devices, Error: HTTPSConnectionPool(host=‘’, port=443): Max retries exceeded with url: /api/edge/get.json (Caused by SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:847)’),))

I added configuration file with details about each settings, your configuration is missing path to the full chain certificate,
Later today i’ll change it to avoid checking the certificate, hopefully it will solve that issue,
Alternatively, you can create full chain certificate (combine cert with key to one file)

Hi @grantc, the path you entered probably is just the certificate, as written in previous post - it requires the full chain

Hi bar, thanks for the reply - any idea how to get that information? Thanks

openssl s_client -showcerts -connect

not sure what part of the output is the full chain :slight_smile:

I’ll find later the article I used to create it, basically you create pem file consisted with the content of:

  1. Key
  2. Intermediate certificate
  3. Certificate

Creating a .pem with the Private Key and Entire Trust Chain:

(Your Private Key: your_domain_name.key)
(Your Primary SSL certificate: your_domain_name.crt)
(Your Intermediate certificate: DigiCertCA.crt)
(Your Root certificate: TrustedRoot.crt)

Updated the component, no SSL verification for HTTPS requests,
please try and let me know if now it works for you

Confused now, so no .pem file path is required

Sorry for that :slight_smile:

I updated it once again (removed the SSL verification from login request as well),
Now you don’t need to fill in the cert_file

No longer getting complaint regarding the certificate, instead now get these 2 which are less friendly error messages.

error from callback <bound method EdgeOSWebSocket.on_error of <custom_components.edgeos.EdgeOSWebSocket object at 0x7fc82b824c18>>: on_error() takes 2 positional arguments but 3 were given
error from callback <bound method EdgeOSWebSocket.on_close of <custom_components.edgeos.EdgeOSWebSocket object at 0x7fc82b824c18>>: on_close() takes 1 positional argument but 2 were given


found out that it can be caused due to incompetible version of websocket-client,
just to be sure, can you run the following command and let me know which version installed in your system (if you are running python virtual environment, please run it from within it):
pip freeze | grep lxml

Mine is 0.54.0, according to forums, it can be caused when it lower than 0.53.0


sorry, wrong past, should be:
pip freeze | grep websocket-client

Anyway, I pushed another fix, added the requirements of websocket-client,
If it’s not working, please post the version of your websocket-client


Unfortunately still not working and I run, which is a docker container. pip isn’t installed, so can’t use that command to get the version.

I imagine lots of other people will have similar issues with more and more people using using now.

Any other idea who to check the version without pip?

in both docker and pip installed, that’s the way it installs python packages,
you can create a command line sensor that you will get the value into its state:

  • platform: command_line
    command: ‘pip freeze | grep websocket-client’

@stevenhorner, any progress with the version / issue?


Sorry away for the weekend, will try on Monday.
Thanks for the help.

Hi bar,

Couple of errors in the log trying to get this up and running;

  1. 2019-02-11 08:44:13 ERROR (MainThread) [homeassistant.config] Invalid config for [edgeos]: string value is None for dictionary value @ data[‘edgeos’][‘cert_file’]. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 134). Please check the docs at
    2019-02-11 08:44:13 ERROR (MainThread) [homeassistant.setup] Setup failed for edgeos: Invalid config.

I added the cert_file line back in (with no value) and then comment the line out still get the same error. I thought you removed this pre-req?

  1. 2019-02-11 08:44:15 ERROR (SyncWorker_13) [custom_components.device_tracker.edgeos] Failed to initialize EdgeOS Scanner, Error: ‘edgeos_ham’, Line: 37
    2019-02-11 08:44:15 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform edgeos