C-8, Platform 2.3.7.145. I have a few apps that require the specific local IP address of the hub (like http://192.168.1.xxx/local) to access a local MP3 file I want to use to send to some of my Sonos devices. Since once in a while the hub URL gets changed in the last area (xxx above), it breaks those apps. Is there anyway to refer to the address in a generic way so that the app doesn't break when the hard coded URL changes? I think I used to make the IP address for the hub fixed, but as I recall there was some recommendation not to do that. Comments?
Is there a reason why you donโt reserve a specific IP address for your hub? This is what I do.
Alternatively, within Settings -> Hub Details, you can specify the โHub name on LANโ. Then you can use http://hub-name.local.
Setup a DHCP reservation on your router so the hub gets a reserved IP address that doesn't change.
Alternatively, use "http://127.0.0.1/local". That will always work.
I too was a little surprised by you comment about the fixing of the IP Address. Could it be you have read peoples comments about fixing it via the setting on the hub? I think the general recommendation is to reserve it through your router rather than on the hub itself, perhaps that was what you have seen?
My other question is when you talking about references to the hub's IP address, are you talking about Device and/or App preferences a user enters, or details within the code for an App or driver?
I don't remember where I heard that fixing the IP address for the hub was not advised; once I hear about something and confirm it to my satisfaction, I promptly forget the rationale. But, I used to have the hub's address fixed in my router and then later let it be set by DHCP. I was and am unaware of any way to fix the address from the hub side.
As to how I use the hub address, I have an app under Rule Machine where I control a sound device (one of my Sonos speakers) using a Play Track and Restore command that requires the IP address of the MP3 file I want to play. So, the command is "Living Room Sonos: Play Track And Restore: 'http://192.xxx.x.xxx/local/barkingdogs01.mp3'"
I certainly can fix/reserve the IP address at my router, but was wondering whether the IP address could be made as a "reference" (for lack of a better word) to something else set elsewhere. Sorta like Sebastien's comment above, which I haven't yet figured out.
In my Hub Details, the Hub name on LAN is hubitat.local, and in the box below is the word hubitat. I assume what you mean is to change in that box to the characters 192.xxx.xxx.xxx (where I have the current OR reserved IP address instead of the word hubitat. I haven't tried that. If that is what you mean, it seems it would just move the problem to the Hub Details page, which admittedly is better than the app being broken. It's too bad I can just refer to the field IP address three lines above on the Hub Details page.
To keep things simple, replace the DHCP assigned address โ192.168.x.xโ with the loopback IP address โ127.0.0.1โ. This will never change, and therefore your rules will never need to be amended.
I will create a test routine with your solution and report back.
I will also create a test routine with your alternative solution and report back.
This is the section of the Getting Started documentation that talks about reserving an IP address. Doing this on the hub is an option, but doing it on the router is preferred.
Best to leave it at hubitat in that box. I would not recommend changing that ton 192.xxxโฆ in the Hubitat settings box.
However, if you go to the http://hubitat.local, you will go to the Hubitat screen.
So, terminology matters. "Fixed IP" can be done one of two ways: Static IP assigned on the hub, or DHCP reservation on your router.
I have seen recommendations that a Reserved IP (DHCP Reservation) is preferred in most situations over a Static IP (Set on the hub) because if you do not know what you are doing, it can cause issues.
That said, reserving IP on the router is specifically something you SHOULD do and is stated as such in the getting started guide.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.