Domi04151309 / HomeApp

HomeApp is a small and easy to use smart home app with a simple framework.
https://f-droid.org/packages/io.github.domi04151309.home/
GNU General Public License v3.0
106 stars 24 forks source link

[Feature Request] mDNS for discovered devices #47

Closed cweiske closed 2 years ago

cweiske commented 2 years ago

When automatically discovering devices via mDNS (since #27), HomeApp resolves the IP address and stores that in its configuration: url=http://192.168.3.71/. This works fine for IoT devices with static IP addresses, but not for those that get a new one everytime from the DHCP server (dynamic IP).

The solution to this problem would be to not resolve the IP address during discovery, but to store the discovered name and then resolve it via mDNS when accessing the device.

This could be integrated into the current structure by saving "http://mdnsname.local/" as path (url=http://shellyplus1-a8032abd1bcc.local/). When trying to access that path, HomeApp would need to check if the domain ends with .local and resolve the domain via mDNS. Then the local domain would need to be replaced in that path, and then the actual HTTP request could be made.

I personally use static IPs for my IoT devices, so I don't have this problem. Others could, though.

Domi04151309 commented 2 years ago

I would like to not implement this until it becomes an issue for someone because a lot of DHCP implementations try to use the same IP addresses for devices whenever possible. I do not use static IP addresses and have not had this issue yet. As far as I know other apps like the "Philips Hue" app or "Hue Essentials" only use the IP as well.

cweiske commented 2 years ago

Fair point.