Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WAN IP #488

Open
jcallaghan opened this issue Sep 9, 2023 · 12 comments
Open

WAN IP #488

jcallaghan opened this issue Sep 9, 2023 · 12 comments

Comments

@jcallaghan
Copy link

Moving query from home-assistant/core#99307 here as requested.

Could I ask if the IP attribute of my UDM device_tracker entity (the WAN address) is obtained via the same way you're getting the temperature of the device?

The reason I ask is that I recently added an LTE-PRO to my setup. If I force a failover to the LTE, the IP attribute doesn't seem to update. I'm having to use DNS IP integration which is cloud dependant and adds latency as it requires my UDM to update DDNS and then the integration to detect the change in 2 minutes intervals. While I'm notified of the failover event within ~5 minutes I was curious if the WAN IP was available locally in a similar way to this PR?

@Kane610
Copy link
Owner

Kane610 commented Sep 14, 2023

Could I ask if the IP attribute of my UDM device_tracker entity (the WAN address) is obtained via the same way you're getting the temperature of the device?

Yes, its all from the same source, its sent over web socket so what information is available in the controller ui should be reflected in home assistant. Fail over to LTE is that on a different wan port or how does your setup look?

If you want to look at what data you get when falling back to LTE you can enable debug logging for the integration or run the library cli from the terminal.

@ViViDboarder
Copy link
Contributor

I’ve been looking to do something similar here. I’m using a remote rest api for getting my IP as well, but this sounds better.

It sounds like you’re saying it should be available already, but I don’t see a device tracker for my UDMP.

@Kane610
Copy link
Owner

Kane610 commented Oct 12, 2023

It sounds like you’re saying it should be available already, but I don’t see a device tracker for my UDMP.

Device trackers in Home Assistant is disabled by default, it would be automatically enabled if there were other entities for the same device reported. In your case Im assuming you do not have other entities for your UDMP. You can look in your registry for enabling the UDMP device tracker entity.

If that is not the case you might have disabled device entities more explicitly?

@ViViDboarder
Copy link
Contributor

Thanks. I found it after enabling that setting.

Since it only includes the IP, that probably won’t be enough for me to detect that I’m on failover internet. I see more info in the diagnostics download for the device. That shows things like which uplink is active able status for the wan ports. I expect this means the data is available to expose via this library or accessible from HASS already. I’ll take a deeper look later.

I’m really looking to automatically turn on certain traffic rules when I’m on failover internet to better manage my bandwidth. The new patch for traffic rules brings me close with my current way of sensing the outage, but it’d be better if I could get it all from the router.

@ViViDboarder
Copy link
Contributor

ViViDboarder commented Oct 12, 2023

OP, if the UniFi LTE is special in some way, you should be able to do something like I am today using a rest sensor:

- resource: https://ipinfo.io/json
  scan_interval: 90
  sensor:
    - name: Public IP
      icon: mdi:ip
      json_attributes:
        - city
        - region
        - country
        - org
      value_template: "{{ value_json.ip }}"

Is faster than your router updating your ddns and then pulling that back down via another polling interval. This is updated every 90s. Can’t go faster or you hit the free tier daily limit.

@Kane610
Copy link
Owner

Kane610 commented Oct 12, 2023

I’m really looking to automatically turn on certain traffic rules when I’m on failover internet to better manage my bandwidth. The new patch for traffic rules brings me close with my current way of sensing the outage, but it’d be better if I could get it all from the router.

It would be nice once you've achieved this to write up a post about it :)

@ViViDboarder
Copy link
Contributor

Is there already someone working on adding Traffic Rules to Home Assistant? If not, I can start a PR.

@Kane610
Copy link
Owner

Kane610 commented Nov 28, 2023

Is there already someone working on adding Traffic Rules to Home Assistant? If not, I can start a PR.

If anyone it would most probably be @herriejr but I don't know if he's gotten to start that yet.

@ViViDboarder
Copy link
Contributor

Cool. I started one. Wrapping up tests now.

@ViViDboarder
Copy link
Contributor

FYI: home-assistant/core#104671

@herriejr
Copy link
Contributor

I've got a working version locally running, but I hadn't gotten around to writing tests. I'll try commit my changes to my repo today, so we can compare notes. ;-)

@herriejr
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants