Using a audio file from the hub

Right now I use a command similar to playTrack('http://192.168.1.52/local/doorbell-1.mp3') Isn't there a way to not use the IP of the hub? I tried playTrack('/local/doorbell-1.mp3') and my rule locked up and I had to delete it.
Thanks

I haven't try it, since I'm not currently local, but you can try to change the IP address by localhost (http://localhost/local/...).

http://hubitat.local/ perhaps?

1 Like

Have you tried using the alternate port, 8080, versus the default (of 80)? That is sometimes necessary for things like this. Your URL would look like http://<hubIP>:8080/whatever.

That being said, hubitat.local as suggested above should work if mDNS works on your network and it's your only hub (or there may be a hunger (autocorrect?!) number at the end). I'd just be sure you're chasing the right problem. :slight_smile:

1 Like

hubitat.local works while localhost does not work. I had the chance to try it.

Well, it appears that I must use the IP version. Not a big deal just thought using localhost would keep some internal traffic minimized. Thanks for the ideas guys

@elentz did you ever figure this out?

Neither of the following work for me…

http://hubitat.local/doorbell-1.mp3
http://hubitat.local/local/doorbell-1.mp3

While using the ip as you’ve described works fine.

@bertabcd1234 you mentioned something about mDNS. Are you able to elaborate as to how I can check on that and/or set that up?

A way to test mDNS would be to visit hubitat.local in a web browser (on a device connected to the same network as all of these other devices). If that works, mDNS is working. This should be the case for most home networks.

If that still doesn't work for your application, is there a reason you can't use the IP address instead? You'd need to make a DHCP reservation for it in your router (or a static IP on the hub, but I prefer the former), but it should be a reliable method.

Navigating to Hubitat.local works as expected. In fact, navigating to the parameter…

http://hubitat.local/local/Ba_Dum_Tss.mp3

…pulls up an audio player and plays the sound as expected. However, it does NOT play in the rule unless I use the ip like so…

http://10.0.021/local/Ba_Dum_Tss.mp3

As for your other question, I actually originally simply tried to make a DHCP reservation for the hub assigned to 10.0.0.50. I’m no expert here but I have various other devices reserved (I.e my google homes and my frame tv) and they all work fine. When I tried it with the hub, despite multiple hub and router resets, the hub never resolved to the IP and I couldn’t find it through the portal any longer.

Then I read this post and got nervous about fooling around too much: Give the hub a static IP? - #6 by bravenel

Then, I saw Hubitat has some native support for a static IP…
https://docs.hubitat.com/index.php?title=Network_Setup#Static_IP_address

However, setting that up again prevented me from finding my hub through the portal and I had to use the physical switch to set the hub back to DHCP mode.

Which is then when I posted here :slight_smile:

@bertabcd1234 any thoughts based on all that?

It just occurred to me that the default DNS for Hubitat might be 8.8.8.8--or at least it was at one point rather than getting it from DHCP, and I'm not sure if that changed. Perhaps that is causing the problem, since Google, unlike your local network, would not be able to resolve this local name. I think you can change this in Settings > Networking (perhaps your router or whatever your network normally uses as a DNS server) without setting a static IP or any other options, though I'm still not sure why either that or a DHCP reservation wouldn't be working on your network...

False alarm I guess. I tried to set up the DHCP reservation again (used 10.0.0.200 instead of 10.0.0.50 this time) and everything worked fine.

¯_(ツ)_/¯

Thanks for weighing in.