Custom component: EdgeOS

I’m not controling the internet (yet :slight_smile: ), can’t update all links everytime i’m releasing version, there is a common practice in which you are getting to a link you are checking the details before download and install,
When installing from hacs, the details are from the readme,
If you didn’t use hacs, it is recommended to read the instructions from readme rather install and then try to understand why it’s not working.

I do use hacs and hindsight is the only exact science i.e. I should have … :wink:
Who is the owner of hXXps://community.home-assistant.io/t/custom-component-edgeos/97281?
It might be useful for others if this page is updated.

Link led me to the opening post of the component, so if you are talking about the opening post, will update it later as it represents the original release, but need to be maintained

1 Like

OP updated from latest README

1 Like

This is awesome!

I was hoping to see the sent and received stats, and it appears that should be visible, but I’m not seeing it in the list on the dashboard configuration. Am I missing something?

for each device you have switch component that activates (or disables) monitoring, did you activate it?
Network Device

Network Interface

How can I create automation that would restart my router?

Currently component doesn’t support restart, will try to get to it soon (or someone can post a PR with that functionality)

I have recently replaced my mobile phone, however the old device is still showing up in HA as a device with no entities. The DHCP static mapping was removed from the router, and I don’t see anywhere else in the router config it is showing up. So, how do I remove a legacy item that is no longer attached to my network?

Thanks in advance…

I am getting the following or similar Warning entries in HA Core log. Seems something needs to be changed in the code…

* Entity sensor.edgerouter_x_sfp_6_port_device_asrhq818_sent_traffic from integration edgeos has state class total_increasing, but its state is not strictly increasing. Triggered by state 58747762.0 (58749275.0) with last_updated set to 2023-09-12T00:46:50.856749+00:00. Please report it to the custom integration author.

* Entity sensor.edgerouter_x_sfp_6_port_device_galaxy_a11_received_traffic from integration edgeos has state class total_increasing, but its state is not strictly increasing. Triggered by state 2469599.0 (2483945.0) with last_updated set to 2023-09-12T00:58:25.443695+00:00. Please report it to the custom integration author.

* Entity sensor.edgerouter_x_sfp_6_port_device_galaxy_a11_sent_traffic from integration edgeos has state class total_increasing, but its state is not strictly increasing. Triggered by state 1444249.0 (1447964.0) with last_updated set to 2023-09-12T00:58:25.443977+00:00. Please report it to the custom integration author.

* Entity sensor.edgerouter_x_sfp_6_port_device_in_se3_received_traffic from integration edgeos has state class total_increasing, but its state is not strictly increasing. Triggered by state 29744633.0 (29747777.0) with last_updated set to 2023-09-12T01:04:40.452258+00:00. Please report it to the custom integration author.

* Entity sensor.edgerouter_x_sfp_6_port_device_in_se3_sent_traffic from integration edgeos has state class total_increasing, but its state is not strictly increasing. Triggered by state 18583577.0 (18584902.0) with last_updated set to 2023-09-12T01:04:40.452844+00:00. Please report it to the custom integration author.

Just one thing to add after reading this thread… Excellent work @bar. Thank you for taking my EdgeRouter 4 to another level of useful. :smiling_face_with_three_hearts: :partying_face: :beers:

How does device detection work? What does it look for?

I have an EdgeRouter ER-4. It runs as my DHCP server, but I use DNSMasq. This means when I look at the control panel in the ER-4 there is no list of leases in the GUI.

I have a HA page full of my devices showing their state via this EdgeOS component. It is a little odd as to what is and is not being shown as “home”. Half of the devices are in the wrong state.

For example, there are a number of “always on” devices like managed switches, Pi-Hole, HA. And these rarely show up as “Home”. Also Servers and IoT plugs that are powered up, but no data flowing. And my mobile is flicking back and forth between home and away.

Is this all due to using DNSMasq and therefore not having that leases table?

If I am on the router, via CLI I can check /var/run/dnsmasq-dhcp.leases Currently this is 14 items and when I look at the Device Info for the router it has 14 “Unknown Devices” among the sensor data.

Any thoughts as to how I can get this working? Thanks.

It is based on the last activity of the device, logic is to cache the timestamp when RX or TX > 0 bytes, if timestamp is older than 180 (defulat, configurable) seconds device will apear as not_home, once the RX or TX wil get to more than 0 bytes it will become home again

Thanks… that makes sense with what I am seeing. I may go try tweaking the timestamp a bit, but probably need to find some other trick to monitor the low use devices. Would a ping be enough to be treated as some RX\TX traffic?

I think it will be enough but did test it, I’m using it mainly to identify mobile phones

I’ve been experimenting and see two separate issues for my use.

I used to use a Ping\Arp method when PI Hole looked after my DHCP. That was reliable enough that I could tie the mobile phone’s “when away” to shutting off part of the house when I went out.

As a test, I tied the EdgeOS “home\away” detection of my mobile phone to a house light. And then left it for a few hours while I did other tasks… Light was changing state a little too often. My phone just does not chatter enough.

Note that my old mobile does not connect to social networks and is likely to not be chattering much when sitting on the desk.

=

As to the other devices - I believe it is miss firing in my house due to my network switch. Local traffic does not go through the router.

Did a quick test to confirm this. Copied 5GB from my NAS to my desktop while watching the EdgeOS “Sent Traffic” counter for that device via your HA sensor. The router did not see a single byte of that “sent” from the NAS. Your sensor did not count any data as moving. But sit on the NAS and open a web browser and the sensor’s byte count goes up instantly.

This explains why so many other devices are showing as “away” as they are not accessing the outside world. Only devices that talk to the outside world are seen as “home” as they are the only devices having traffic counted by the Edge router.

This also means pinging everything does not help the EdgeOS counters as most pings just traverse the switch and don’t go near the router’s stats.

=

I may get brave and see if I can get the old Pi-Hole method to work on EdgeOS. Actually may have the job done via SYSLOG as this is in that thread.

Why not try using NMAP instead?

Hi @robfish - funny you should say that, nmap is something I’m currently experimenting with. Just had to tell the PC Anti-virus to not be scared when it saw the scan hit the network. :laughing:

I tried to look at that SYSLOG option, but stumbled at the first step as I could not work out where to put it or how to run it on my HA. Instructions are too minimal for me.

One thing I am still trying to learn in HA is how to teach HA that a single entity is being spotted by various methods. i.e. EdgeOS sees the same device as NMAP and Ping but working out how to tell HA that this is the same object isn’t clear. I assume I have to build up a list in known_devices.yaml

For example, I currently have device_tracker.er4_device_wifiap and device_tracker.wifiap both referring to the same thing.

For multiple trackers picking up the same device you can either

  • create a ‘person’ for the device and link the trackers to them
  • Create a template binary sensor and set that to on when any of the trackers sense the device at home.

There might perhaps be another option with groups but I’ve not tried that myself.

Both options should achieve the same outcome of 1 entity for multiple trackers

1 Like

v2.1.0 - What’s Changed

  • Code cleanup
  • Fix thread safe issues
  • Fix typos
  • Improve performance
  • Removed service - update configuration
  • Add attributes to monitor / switch entities of interfaces & devices
  • Simplified logic to calculate unknown devices
  • Fully localized (supporting for now - English, Norwegian ,Brazilian Portuguese)
  • Add util for automated translations (using Google Translate) per Feature Request (if the language is not there, just ask)

New components:

  • Consider Away Interval - Number
  • Update API Interval - Number
  • Update Entities Interval - Number
  • Log Incoming Messages - Switch

Breaking Changes

Some of the entity names where changed

Full Changelog: Comparing v2.0.32...v2.1.0 · elad-bar/ha-edgeos · GitHub