elad-bar / ha-edgeos

Integration with EdgeOS (Ubiquiti)
134 stars 23 forks source link

Error when adding second EdgeRouter: "Platform edgeos does not generate unique IDs" #152

Open jtmusson opened 2 months ago

jtmusson commented 2 months ago

Really appreciate the awesome features of this HA integration.

I am crazy enough to have 2 EdgeRouter Xs on my network for redundancy. I can add the first using this integration, and all data is displayed as expected. When I add the second, no devices or entities are created and these errors appear in the system log:

2024-05-18 11:54:57.769 ERROR (MainThread) [homeassistant.components.sensor] Platform edgeos does not generate unique IDs. ID edgeos_sensor_ram_usage already exists - ignoring sensor.neptune_ram_usage
2024-05-18 11:54:57.769 ERROR (MainThread) [homeassistant.components.sensor] Platform edgeos does not generate unique IDs. ID edgeos_sensor_last_restart already exists - ignoring sensor.neptune_last_restart
2024-05-18 11:54:57.769 ERROR (MainThread) [homeassistant.components.sensor] Platform edgeos does not generate unique IDs. ID edgeos_sensor_unknown_devices already exists - ignoring sensor.neptune_unknown_devices
2024-05-18 11:54:57.769 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_firmware already exists - ignoring binary_sensor.neptune_firmware_upgrade
2024-05-18 11:54:57.770 ERROR (MainThread) [homeassistant.components.switch] Platform edgeos does not generate unique IDs. ID edgeos_switch_log_incoming_messages already exists - ignoring switch.neptune_log_incoming_messages
2024-05-18 11:54:57.770 ERROR (MainThread) [homeassistant.components.number] Platform edgeos does not generate unique IDs. ID edgeos_number_consider_away_interval already exists - ignoring number.neptune_consider_away_interval
2024-05-18 11:54:57.770 ERROR (MainThread) [homeassistant.components.number] Platform edgeos does not generate unique IDs. ID edgeos_number_update_entities_interval already exists - ignoring number.neptune_update_entities_interval
2024-05-18 11:54:57.770 ERROR (MainThread) [homeassistant.components.number] Platform edgeos does not generate unique IDs. ID edgeos_number_update_api_interval already exists - ignoring number.neptune_update_api_interval
2024-05-18 11:54:57.770 ERROR (MainThread) [homeassistant.components.select] Platform edgeos does not generate unique IDs. ID edgeos_select_unit already exists - ignoring select.neptune_unit
2024-05-18 11:54:57.771 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_connected_eth0 already exists - ignoring binary_sensor.neptune_interface_eth0_connected
2024-05-18 11:54:57.771 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_status_eth0 already exists - ignoring binary_sensor.neptune_interface_eth0_status
2024-05-18 11:54:57.771 ERROR (MainThread) [homeassistant.components.switch] Platform edgeos does not generate unique IDs. ID edgeos_switch_interface_monitored_eth0 already exists - ignoring switch.neptune_interface_eth0_monitored
2024-05-18 11:54:57.771 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_connected_eth1 already exists - ignoring binary_sensor.neptune_interface_eth1_connected
2024-05-18 11:54:57.771 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_status_eth1 already exists - ignoring binary_sensor.neptune_interface_eth1_status
2024-05-18 11:54:57.772 ERROR (MainThread) [homeassistant.components.switch] Platform edgeos does not generate unique IDs. ID edgeos_switch_interface_monitored_eth1 already exists - ignoring switch.neptune_interface_eth1_monitored
2024-05-18 11:54:57.772 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_connected_eth2 already exists - ignoring binary_sensor.neptune_interface_eth2_connected
2024-05-18 11:54:57.772 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_status_eth2 already exists - ignoring binary_sensor.neptune_interface_eth2_status
2024-05-18 11:54:57.772 ERROR (MainThread) [homeassistant.components.switch] Platform edgeos does not generate unique IDs. ID edgeos_switch_interface_monitored_eth2 already exists - ignoring switch.neptune_interface_eth2_monitored
2024-05-18 11:54:57.772 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_connected_eth3 already exists - ignoring binary_sensor.neptune_interface_eth3_connected
2024-05-18 11:54:57.772 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_status_eth3 already exists - ignoring binary_sensor.neptune_interface_eth3_status
2024-05-18 11:54:57.772 ERROR (MainThread) [homeassistant.components.switch] Platform edgeos does not generate unique IDs. ID edgeos_switch_interface_monitored_eth3 already exists - ignoring switch.neptune_interface_eth3_monitored
2024-05-18 11:54:57.773 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_connected_eth4 already exists - ignoring binary_sensor.neptune_interface_eth4_connected
2024-05-18 11:54:57.773 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_status_eth4 already exists - ignoring binary_sensor.neptune_interface_eth4_status
2024-05-18 11:54:57.773 ERROR (MainThread) [homeassistant.components.switch] Platform edgeos does not generate unique IDs. ID edgeos_switch_interface_monitored_eth4 already exists - ignoring switch.neptune_interface_eth4_monitored
2024-05-18 11:54:57.773 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_connected_vtun0 already exists - ignoring binary_sensor.neptune_interface_vtun0_connected
2024-05-18 11:54:57.773 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_status_vtun0 already exists - ignoring binary_sensor.neptune_interface_vtun0_status
2024-05-18 11:54:57.773 ERROR (MainThread) [homeassistant.components.switch] Platform edgeos does not generate unique IDs. ID edgeos_switch_interface_monitored_vtun0 already exists - ignoring switch.neptune_interface_vtun0_monitored
2024-05-18 11:54:57.774 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_connected_switch0 already exists - ignoring binary_sensor.neptune_interface_switch0_connected
2024-05-18 11:54:57.774 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_status_switch0 already exists - ignoring binary_sensor.neptune_interface_switch0_status
2024-05-18 11:54:57.774 ERROR (MainThread) [homeassistant.components.switch] Platform edgeos does not generate unique IDs. ID edgeos_switch_interface_monitored_switch0 already exists - ignoring switch.neptune_interface_switch0_monitored
2024-05-18 11:55:01.177 ERROR (MainThread) [homeassistant.components.sensor] Platform edgeos does not generate unique IDs. ID edgeos_sensor_cpu_usage already exists - ignoring sensor.neptune_cpu_usage
2024-05-18 11:58:18.853 ERROR (MainThread) [homeassistant.config_entries] Error calling entry remove callback Mercury for edgeos

Am I able to add {some code} to my configuration.yaml to address this or is this effectively an improvement request for this integration?

Thanks in advance!

EDIT: neptune is the hostname of the ER X already added, mercury is the hostname of the ER X I added second.

jtmusson commented 2 months ago

Versions:

Both ER-Xs on firmware v2.0.9-hotfix.7

elad-bar commented 2 months ago

can you pls provide diagnostic file for both integrations? over an email as it might contain sensitive data (elad.bar@hotmail.com)

thanks

jtmusson commented 2 months ago

@elad-bar Thank you - I've emailed the diagnostic files over

benjycov commented 2 months ago

Hi Elad,

Okay I've been experimenting since release 2.1.7 trying to bottom out my problems. I think I now have some useful information for you. In summary - when multiple routers exist, entities created by the addon aren't unique across multiple routers.

I have 3 edgerouters per home. I would find that if I deleted all routers then the first I added would be fine and then I would have problems with missing interfaces on subsequent ones, or if they did add I wouldn't be able to access the interfaces to for example turn monitoring on.

Anyway I finally realised that when the routers have the same interfaces for example ETH0, the second router added wouldn't add ETH0, and in fact would only have the interfaces that were unique from the first router.

This can be seen in the logs as:

Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_connected_eth0 already exists - ignoring binary_sensor.wicked_france_2_interface_eth0_connected
Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_connected_eth1 already exists - ignoring binary_sensor.wicked_france_2_interface_eth1_connected
Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_connected_eth2 already exists - ignoring binary_sensor.wicked_france_2_interface_eth2_connected
Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_connected_eth3 already exists - ignoring binary_sensor.wicked_france_2_interface_eth3_connected
Platform edgeos does not generate unique IDs. ID edgeos_binary_sensor_interface_connected_eth4 already exists - ignoring binary_sensor.wicked_france_2_interface_eth4_connected

So in this example interfaces eth0 to eth4 can't be created (though they are in the diagnostic file) because they have already been created for router_1.

The same applies for:

Platform edgeos does not generate unique IDs. ID edgeos_sensor_ram_usage already exists - ignoring sensor.wicked_france_2_ram_usage
Platform edgeos does not generate unique IDs. ID edgeos_sensor_last_restart already exists - ignoring sensor.wicked_france_2_last_restart
Platform edgeos does not generate unique IDs. ID edgeos_sensor_unknown_devices already exists - ignoring sensor.wicked_france_2_unknown_devices
Platform edgeos does not generate unique IDs. ID edgeos_sensor_cpu_usage already exists - ignoring sensor.wicked_france_2_cpu_usage

All these router level stats have already been created for router_1.

I also run primary/secondary DHCP across 2 routers, which means Edgeos replicates the DHCP leases across routers, which means the addon then tries to create duplicate entities for the leases (honestly I would prefer to have the option to disable this functionality totally). This then generates duplicate ID logs for each device in the DHCP lease table:

Platform edgeos does not generate unique IDs. ID edgeos_switch_device_monitored_78_f8_b8_00_01_78 already exists - ignoring switch.wicked_france_2_device_rako_monitored
Platform edgeos does not generate unique IDs. ID edgeos_switch_device_monitored_20_50_e7_3b_41_c6 already exists - ignoring switch.wicked_france_2_device_scout_moorebot_downstairs_monitored
Platform edgeos does not generate unique IDs. ID edgeos_switch_device_monitored_b8_13_32_b7_70_d2 already exists - ignoring switch.wicked_france_2_device_scout_moorebot_upstairs_monitored
Platform edgeos does not generate unique IDs. ID edgeos_switch_device_monitored_00_a0_de_b3_17_a2 already exists - ignoring switch.wicked_france_2_device_spa_yamaha_amp_monitored
Platform edgeos does not generate unique IDs. ID edgeos_switch_device_monitored_00_01_45_08_05_b6 already exists - ignoring switch.wicked_france_2_device_tesla_powerwall_monitored

This is more difficult to fix as obviously you are trying to create the mac uniquely, so maybe just the option to ignore DHCP leases for a given router.

I hope thats helpful! Thanks again.

benjycov commented 1 month ago

Hi Elad,

Any progress on this problem, it still persists in 2.1.8.

In summary - if you have multiple Edgerouters and they all have ETH0 (for example) then integration will only work correctly with one of the routers ETH0, the others will either not be found or not show any entities for that device.