elad-bar / ha-edgeos Goto Github PK
View Code? Open in Web Editor NEWIntegration with EdgeOS (Ubiquiti)
Integration with EdgeOS (Ubiquiti)
Can't seem to find integration in home assistant integration pane. I'm guessing I need to somehow manually pull and run separately if i want a chance of this working?
I updated to Home Assistant 2021.3.0 today and I am now getting this warning at startup:
2021-03-04 15:57:32 WARNING (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'edgeos'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'edgeos'
After reading #15 , I saw you mention the sensors update every second (!)
For those using the recorder, this will generate a lot of data there.
I suggest allowing a configurable update frequency on this? Maybe:
For reference, in 2.5 hours (with 2 interfaces and 6 devices) that was 10174 recorded states (85%). It logs the same sort of stuff into the events
table as well.
MariaDB [homeassistant]> select NOW();
+---------------------+
| NOW() |
+---------------------+
| 2020-04-16 17:43:55 |
+---------------------+
1 row in set (0.000 sec)
MariaDB [homeassistant]> SELECT COUNT(last_updated) FROM states WHERE last_updated > "2020-04-16 15:08:55";
+---------------------+
| COUNT(last_updated) |
+---------------------+
| 11793 |
+---------------------+
1 row in set (0.075 sec)
MariaDB [homeassistant]> SELECT COUNT(last_updated) FROM states WHERE last_updated > "2020-04-16 15:08:55" AND entity_id LIKE "%edgeos%";
+---------------------+
| COUNT(last_updated) |
+---------------------+
| 10174 |
+---------------------+
1 row in set (0.191 sec)
MariaDB [homeassistant]> SELECT DISTINCT entity_id FROM states WHERE last_updated > "2020-04-16 15:08:55" AND entity_id LIKE "%edgeos%";
+-------------------------------------+
| entity_id |
+-------------------------------------+
| binary_sensor.edgeos_system_status |
| sensor.edgeos_system_uptime |
| sensor.edgeos_unknown_devices |
| binary_sensor.edgeos_interface_eth0 |
| binary_sensor.edgeos_interface_eth1 |
| binary_sensor.edgeos_device_name1 |
| binary_sensor.edgeos_device_name2 |
| binary_sensor.edgeos_device_name3 |
| binary_sensor.edgeos_device_name4 |
| binary_sensor.edgeos_device_name5 |
| binary_sensor.edgeos_device_name6 |
+-------------------------------------+
11 rows in set (0.283 sec)
I understand part of the data is the transfer rates, but I doubt many need such granularity? (they should probably export it into Prometheus or something if they wanted proper tracking of it).
edit: It might also be worth documenting this will put a lot of data into the recorder. Maybe mention that users can also exclude the entities from the recorder
when upgrading to 0.113.x ... HA would not complete startup with edgeos integration ... in version 0.113.1, a debug message was added to log showing which integration was causing the issue ... upon removal HA completed startup
device_state_attributes
seems to be deprecated a few months ago.
With 2021.12 backwards compatibility is gone.
extra_state_attributes
seems to be the new name.
Logs:
Entity binary_sensor.edgeos_interface_eth0 (<class 'custom_components.edgeos.binary_sensor.EdgeOSBinarySensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity binary_sensor.edgeos_system_status (<class 'custom_components.edgeos.binary_sensor.EdgeOSBinarySensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.edgeos_unknown_devices (<class 'custom_components.edgeos.sensor.EdgeOSSensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.edgeos_system_uptime (<class 'custom_components.edgeos.sensor.EdgeOSSensor'>) implements device_state_attributes. Please report it to the custom component author.
This now is not showing up in a fresh install under supervisor > Add-on Store. The repository shows a url of https://addons.community, and there is no mention of this add on there.
I'm new enough to HA that I haven't quite figured out how to manually install these addons, but I'm working to figure that out. Figured you'd like to know it seems to have been removed from HACS.
Hi,
Thanks for the nice integration. I'm using it with Edgerouter X.
I got basic dual WAN setup on eth0 and eth1. I just run the wizard. Nothing special. However other WAN port is still waiting for connection and the cable there is actually (also physically) disconnected. EdgeOS dashboard shows also disconnected.
The issue is that in aforementioned case binary sensor for disconnected eth0 shows connected.
I have a few phones i track in order to trigger home and not_home events in HA. All but one device are working as expected. The troubled device has following behavior: when leaving home it triggers HA and not_home is registered. In 3-5min the phone is "seen" as connected to the router and thus HA "thinks" i arrived home. 3-5 minutes later the phone appears again as not connected to the router and HA again triggers the not_home event. This happens only to 1 device (iphone XS) where all other devices work correctly and as expected. The device has static IP lease. Any ideas where to start to debug this? All other devices are set up in exactly the same way.
running core 110.4, when installed, I don't find EdgeOs when trying to add integrations.
I just set up the integration today, and it seemed to work. Then I modified (added a few monitored devices
, and changed log_level
to warning
. The next time I looked at the integrations page, it said there was an error. I get this in my logs:
This error originated from a custom integration.
Logger: custom_components.edgeos
Source: custom_components/edgeos/__init__.py:42
Integration: Ubiquiti EdgeOS Routers (documentation)
First occurred: 21:14:54 (1 occurrences)
Last logged: 21:14:54
Failed to load EdgeOS, error: Unable to find service logger.set_level, line: 29
I pressed Configure
, and changed the log level back to Default
, but when clicking submit, it throws an error at the top:
User input malformed
Set up your monitored devices / interfaces and tracked devices, use comma separated values, to clear existing value, use the checkbox.
The problem is, now I can't open any of the Monitored devices
, Monitored interfaces
, or Tracked devices
drop-down menus, so I can't try to uncheck the devices.
System info:
Component | Version |
---|---|
Home Assistant | core-2021.8.8 |
Home Assistant OS | 6.2 |
HACS | 1.15.1 |
EdgeOS HACS integration | 1.1.5 |
EdgeOS | v2.0.9-hotfix.2 |
2021-01-18 11:46:40 WARNING (MainThread) [custom_components.edgeos.clients.web_socket] Failed to connect EdgeOS WS, Error: 400, message='Invalid response status', url=URL('wss://192.168.10.1/ws/stats')
As per latest HA version (core-2021.1.4)
Not able to access options of the integration to add tracked devices
When the router is rebooted while HASS in running the log will start filling with this error almost every minute:
Failed to get devices data, Error: 403, message='Forbidden', url='https://192.168.1.1/api/edge/get.json, Line: 80
The component seems to be working and I can see the uptime of my Edgerouter X.
What does not seem to be working is the connected status of my devices. It can read the correct Mac and IP address of the devices, but it always shows disconnected. In device_tracker
it always shows away
. The screenshots below provide more details:
I got some errors in my error log while using this component:
2020-05-13 19:49:06 ERROR (MainThread) [custom_components.edgeos.clients.web_api] Failed to connect https://192.168.2.1/api/edge/get.json, Error: None, Line: 147
2020-05-13 19:49:06 ERROR (MainThread) [custom_components.edgeos.clients.web_api] Invalid response, not contain success status
2020-05-13 19:49:06 ERROR (MainThread) [custom_components.edgeos.managers.data_manager] Failed to load devices data, Error: 'NoneType' object has no attribute 'get', Line: 323
I noticed that my EdgeOS integration didn't work after a couple of updates of the component. So I decided to reinstall the integration.
First I removed the integration and after that I deinstalled it from HACS. Next I rebooted home assistant core.
After that I installed EdgeOS again in HACS. Next I went to the integration and filled in all information. Name, IP-address of the router, the special made user with operator rights, the password of this user.
Still I cannot configure EdgeOS. Everytime I get the message: 'Invalid credentials to EdgeOS Router'. Although on the web admin panel of the router I see the number of active sessions for this user increasing.
Any idea what I'm doing wrong?
It would be nice to add in the Configuration instructions secction, that, before you can find the integration you need to:
HACS --> Settings --> Add: "https://github.com/elad-bar/ha-edgeos" as "Integration"
I would like to use the disconnected/connected state to trigger events when I leave/arrive home. However, the disconnected state is usually delayed by half an hour or so. Is there a way to fix this?
Thanks!
Hi guys, the integration worked fine for me until I moved all devices and HA raspberry in a VLAN without access to the router. I'd like to add a firewall rule for this purpose so can you please tell which port and protocol should be accepted?
Thanks for your consideration,
Argoeng
When I try to remove the edgeos integration, it doesn't clean my integration. And after a reboot I cannot install the edgeos integration again.
I must say: in the past I have changed the name of my router, thus I have two entries in the edgeos integration. But if I try to remove both of them (trash bin in the right upper corner), it fails.
Now I can't activate/re-install the edgeos integration.
Supervisor: 217
HassOS: v3.13
Home Assistant Core: 0.108.6
ha-edgeos: v 2020-04-18
Just commenting that there should probably be a disclaimer in the repo and the HASS information screen that this only works with v1.x
I have found some documentation that someone is putting together for the API, https://github.com/matthew1471/EdgeOS-API/tree/master/Documentation.
Not sure if this is valid for both versions.
Looking at an enhancement and willing to contribute, but just wanted to share the idea first
I use my ER to setup a vpn for "out of country" access for my smart TV, etc which can't host their own vpn client. I enable it and disable it by activating a particular modify firewall rule.
Do you think it would be possible to do this through this integration? so that I can enable my vpn through HA?
thanks a million!
Not able to find integration in HACS and Supervisor add-ons store
Is this the intended functionality?
I see all my devices as unknown, and I can only list the ones in my Static table.
Hi,
I used this component on two seperate installations (docker on synology) and now docker on a PI4. But both times the component stop refreshing information after a couple of hours. Any idea how to solve this
Hi Elad
firstly thank you for your work here it really amazing!
I have a small problem.
Picture Entity Card Configuration allows you to show a picture for each state.
in my instance when i am 'home' my picture changes to a thumbs up emoji
when i'm 'away' my emjoi gives a thumbs down.
The 'Home' state works fine, though the 'Away' state doesn't pic up.
This syntax below is what i have used and it is good i have tested it on a few other entities and it works flawlessly
entity: device_tracker.edge_router_dans_iphone
name: Dan
show_state: true
state_image:
home: 'https://i.ibb.co/pr3DW5F/Dan-Home.jpg'
away: 'https://i.ibb.co/k4fk1t4/Dan-Away.jpg'
type: picture-entity
so if take this and change the 'entitie' and the 'states' it works
entity: switch.hallway
name: Light
show_state: true
state_image:
on: 'https://i.ibb.co/pr3DW5F/Dan-Home.jpg'
off: 'https://i.ibb.co/k4fk1t4/Dan-Away.jpg'
type: picture-entity
I have a feeling that the 'away' state is not registering properly with HA.
TIA
Dan
Why this has not been integrated into HA core?
Hi,
After the recent upgrade to HA core-2021.1.5 several parameters of the integration stop working.
binary_sensor.edgeos_system_status and sensor.edgeos_unknown_devices still work.
However the sensors or the individuals ports (eth0 ..) and system uptime no longer work.
Any idea how to resolve?
Logger: custom_components.edgeos.clients.web_socket
Source: custom_components/edgeos/clients/web_socket.py:91
Integration: Ubiquiti EdgeOS Routers (documentation)
First occurred: 16:06:24 (261 occurrences)
Last logged: 16:43:09
Failed to connect EdgeOS WS, Error: 400, message='Invalid response status', url=URL('wss://192.168.88.1/ws/stats')
Some suggestions for more sensors if it is possible to add.
"show dns dynamic status"
"show vpn remote-access"
"show system memory"
I like the Mbps in and out sensor but thinking is there any impacts
Is there a way to change uptime from seconds to days or even hours?
Hi, I would like to use my edgerouter to track who is home. I have read and tried a lot to get it to work, but I think I'm missing something.
Is the intent correct, shouldn't "edgeos:" and "device_tracker:" start on the same indent ?
what name should I use for the monitored_devices? The name as stated in the static DHCP map? or another name?
Thank You :)
In the "options for EdgeOS" dialog, the two dropdowns for "monitored devices" and "tracked devices"
only show a fixed number of devices with checkboxes (I see 7 in each). However, I have more than 7 devices, and don't seem to have a way to select/add them. There's a reference to using a CSV list, but nowhere to put that. The component sees all of my devices (they're listed in the "unknown devices" sensor).
I'm guessing this is just a UI bug to not have the full list of devices to select for monitoring+tracking? I'm happy to manually add them to a file, but it would help if the options dialog would describe where to do that, if it can't be done there.
When they are in fact connected to the router. So wondering if I have to change some setting somewhere?
Failed to connect EdgeOS WS, Error: 400, message='Invalid response status', url=URL('wss://192.168.1.1/ws/stats')
is the message that i am getting. Worked perfectly before this update!
Extra info:
Logger: custom_components.edgeos.clients.web_socket
Source: custom_components/edgeos/clients/web_socket.py:91
Integration: Ubiquiti EdgeOS Routers (documentation)
First occurred: 4:41:13 PM (14 occurrences)
Last logged: 4:42:53 PM
Failed to connect EdgeOS WS, Error: 400, message='Invalid response status', url=URL('wss://192.168.1.1/ws/stats')
Hi, I keep getting "General failure, please try again"
edgemax - EdgeRouter X v2.0.8-hotfix.1
v.1.1.4 of integration.
made new user/password
rebooted device.
it would be great to have bandwidth usage sensors so we could visualize them in charts. currently it's only tracked as attributes which don't have history by themself.
When i run this integration it works ok but there is a problem with automations in home assistant.
When i try to create an automation, the drop down list refreshes fast, scrolls up by itself and causing lag. I am runnning hass.io 0.107.8. I tried disabling one by one my integrations and plugins and the problem solved when i removed the edge os integration. Do you know how can this be fixed?
I was using another custom edgeos component and it allowed me to specify track_new_devices
and not specify a list to track.
I want it to track every device even when new devices get added which it currently does not support.
I am trying to setup the integration and I keep getting the "EdgeOS URL not found" error and cannot get past the Integration setup screen.
I've used the same exact URL that I use in the browser to connect to my EdgeRouter 4 (v2.0.9-hotfix.2).
Sorry about not getting back about issue #8. My iPhone will now show switch between disconnected and connected every few minutes. This can be seen in the picture below:
My laptop and desktop do not have the same problem. Could it be that the iPhone is somehow closing the connection or something to save battery? Thank you.
The connection retry logic should attempt 3 times (or MAXIMUM_RECONNECT
), then wait for X (eg. 5) minutes before re-starting the loop. Currently it seems to be a global limit since HA started up.
edit: Though this would still cause "errors" with the disconnects every 10 minutes I see (which I believe/assume is normal)
Previously "working fine" while running bce36c3:
2020-04-20 03:37:57 INFO (MainThread) [custom_components.edgeos.web_socket] Connection attempt #184
2020-04-20 03:37:57 INFO (MainThread) [custom_components.edgeos.web_socket] Starting to listen connected
2020-04-20 03:37:57 INFO (MainThread) [custom_components.edgeos.web_socket] Subscribed to WS payloads
2020-04-20 03:47:59 INFO (MainThread) [custom_components.edgeos.web_socket] Stop listening
2020-04-20 03:48:09 INFO (MainThread) [custom_components.edgeos.web_socket] Connection attempt #185
2020-04-20 03:48:09 INFO (MainThread) [custom_components.edgeos.web_socket] Starting to listen connected
2020-04-20 03:48:09 INFO (MainThread) [custom_components.edgeos.web_socket] Subscribed to WS payloads
2020-04-20 03:58:10 INFO (MainThread) [custom_components.edgeos.web_socket] Stop listening
2020-04-20 03:58:20 INFO (MainThread) [custom_components.edgeos.web_socket] Connection attempt #186
2020-04-20 03:58:20 INFO (MainThread) [custom_components.edgeos.web_socket] Starting to listen connected
2020-04-20 03:58:20 INFO (MainThread) [custom_components.edgeos.web_socket] Subscribed to WS payloads
2020-04-20 04:08:22 INFO (MainThread) [custom_components.edgeos.web_socket] Stop listening
2020-04-20 04:08:32 INFO (MainThread) [custom_components.edgeos.web_socket] Connection attempt #187
2020-04-20 04:08:32 INFO (MainThread) [custom_components.edgeos.web_socket] Starting to listen connected
2020-04-20 04:08:32 INFO (MainThread) [custom_components.edgeos.web_socket] Subscribed to WS payloads
2020-04-20 04:18:34 INFO (MainThread) [custom_components.edgeos.web_socket] Stop listening
It seems the something kills off my connection every 10 mins (it's local network, so must be either the HA device or EdgeOS (most likely - probably part of the webserver config?). This seems "normal" though. Never noticed anything strange.
edit: I am running v2.0.1 (out of date). I'll check release notes / update to see if that helps with the 10 minute lifetime - BUT, this still wouldn't fix the issue of the global retry limit.
I believe since the following change to custom_components/edgeos/clients/web_socket.py
:
7babbc4#diff-e6d02f813fe6c6ceded59e6e32e0aa89L63-R76
The flow reaches the 3rd connection, and then repeats the failure every 10 seconds without connection attempt.
2020-04-20 08:57:04 INFO (MainThread) [custom_components.edgeos.clients.web_socket] Connection attempt #1
2020-04-20 08:57:04 INFO (MainThread) [custom_components.edgeos.clients.web_socket] Starting to listen connected
2020-04-20 08:57:04 INFO (MainThread) [custom_components.edgeos.clients.web_socket] Subscribed to WS payloads
2020-04-20 09:09:08 INFO (MainThread) [custom_components.edgeos.clients.web_socket] Stop listening
2020-04-20 09:09:18 INFO (MainThread) [custom_components.edgeos.clients.web_socket] Connection attempt #2
2020-04-20 09:09:18 INFO (MainThread) [custom_components.edgeos.clients.web_socket] Starting to listen connected
2020-04-20 09:09:18 INFO (MainThread) [custom_components.edgeos.clients.web_socket] Subscribed to WS payloads
2020-04-20 09:19:20 INFO (MainThread) [custom_components.edgeos.clients.web_socket] Stop listening
2020-04-20 09:19:30 ERROR (MainThread) [custom_components.edgeos.clients.web_socket] Failed to connect on retry #3
2020-04-20 09:19:40 ERROR (MainThread) [custom_components.edgeos.clients.web_socket] Failed to connect on retry #3
2020-04-20 09:19:50 ERROR (MainThread) [custom_components.edgeos.clients.web_socket] Failed to connect on retry #3
2020-04-20 09:20:00 ERROR (MainThread) [custom_components.edgeos.clients.web_socket] Failed to connect on retry #3
2020-04-20 09:20:10 ERROR (MainThread) [custom_components.edgeos.clients.web_socket] Failed to connect on retry #3
2020-04-20 09:20:20 ERROR (MainThread) [custom_components.edgeos.clients.web_socket] Failed to connect on retry #3
2020-04-20 09:20:30 ERROR (MainThread) [custom_components.edgeos.clients.web_socket] Failed to connect on retry #3
2020-04-20 09:20:40 ERROR (MainThread) [custom_components.edgeos.clients.web_socket] Failed to connect on retry #3
2020-04-20 09:20:50 ERROR (MainThread) [custom_components.edgeos.clients.web_socket] Failed to connect on retry #3
Having retry logic makes sense, but it should not be a permanent failure. Restarting the EdgeOS device might also cause similar problems.
it works perfectly for about an hour and than fails. In the log i see this ;
Entity id already exists - ignoring: sensor.edgeos_unknown_devices. Platform edgeos does not generate unique IDs
Please help
Every day the edgeOS component stops working at 00:16.
My bandwidth graphs flatline and logs report
Failed to get devices data, Error: 403, message='Forbidden', Line: 89
Failed to perform heartbeat, Error: 403, message='Forbidden', Line: 68
Perhaps I set things up incorrectly? I'm using it internally so no TLS.
PS: thanks so much for making this, I really look forward to settings up automations based on this data.
Started happening right after upgrading to v1.1.4
All devices appear as disconnected, seems that the integration is failing to load.
2021-08-23 22:26:06 ERROR (MainThread) [custom_components.edgeos.managers.data_manager] Failed to initialize EdgeOS Manager, Error: 'NoneType' object is not subscriptable, Line: 122
2021-08-23 22:26:12 ERROR (MainThread) [custom_components.edgeos.clients.web_api] Failed to login, Error: Server disconnected, Line: 109
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.