StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
615 stars 110 forks source link

[BUG] Bad IP used in case of unicast messages from other LAN #650

Open bigboban opened 2 years ago

bigboban commented 2 years ago

Environment

Describe the bug

I have two LANs A and B connected using Mikrotik. Communication is routed fine in both directions A->B and B->A. HA is in LAN A shelly is in LAN B. I set unicast communication on shelly and set IP to HA instance on A LAN.

When i turn on Shelly using for example mobile app state is propagated into HA immediately = unicast messaging works fine. But i cannot turn on/off shelly using HA. And i know why. In entity details on lovelace frontend i see:

At this point you may admit problem is on my LAN setting, maybe on Mikrotik's routing. BUT - when i go to HA integrations, Shelly, point to this shelly, look at "visit device" link there is right IP address from LAN B. So HA knows right IP some way.

Steps to Reproduce

Expected behavior

HA use right IP to communicate with shelly entity.

Screenshots

Traceback/Error logs

Additional context

My shelly is discovered using this part of config:

discover_by_ip:
  - '<shelly-ip-on-LAN-B>'

I think someone from dev team should explain, why there are two different IPs on one shelly at two different places in HA.