zachcheatham / ha-omada

Home Assistant TP-Link Omada Integration
189 stars 26 forks source link

When connecting to multiple sites #32

Open moridew opened 2 years ago

moridew commented 2 years ago

Hello.

When one device connects to multiple sites, there is a duplicate problem with unique_id.

---------------- [ LOG ] ------------------- 2022-06-18 22:54:51 ERROR (MainThread) [homeassistant.components.device_tracker] Platform omada does not generate unique IDs. ID 64-C2-DE-52-C1-A4 already exists - ignoring device_tracker.mom_v50_thinq 2022-06-18 22:55:20 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved ---------------- [ LOG ] -------------------

The device(64-C2-DE-52-C1-A4) of the above LOG is my mother's It was used by connecting to the wifi of 'site A' in a remote location. And recently, she visited my house and connected to the wifi of 'site B'.

I think it would be better to include site name when creating unique_id for each device.

To prevent collisions with previous devices that have already been registered, I think the problem will be solved if only devices registered with the same unique_id are handled exceptionally.

Thank you.