torandreroland / homebridge-sony-audio-control

Sony Audio Control of STR-DN1080 for Homebridge: https://github.com/nfarina/homebridge
ISC License
12 stars 10 forks source link

Hostname configurable #2

Open perote2000 opened 4 years ago

perote2000 commented 4 years ago

Hello, is there any way to set hostname instead of IP address? My 1080 unit change IP often after a power outage, When it change I have to set on homebridge and restart it. My sony unit register on network as Chromecast.local (and is not configurable as fa as I seen) so, perhaps a new parameter to setup this hostname or perhaps a boolean option to try to resolve default Chromecast.local hostname and not set ipaddress manually in homebridge config.

torandreroland commented 4 years ago

Have you tried to use Chromecast.local as ip? I think looking up the name server is out of control of homebridge and is handled by your network...

perote2000 commented 4 years ago

plugin crash when I set hostname (chromecast.local) instead IP. (192.168.0.237)

log: [7/27/2020, 9:02:12 AM] [Amplificador] Connect Error: Error: getaddrinfo ENOTFOUND chromecast.local

Inside Pi console name is resolved just fine. pi@raspberrypi:~ $ ping chromecast.local PING chromecast.local (192.168.0.237) 56(84) bytes of data. 64 bytes from 192.168.0.237 (192.168.0.237): icmp_seq=1 ttl=64 time=2.26 ms 64 bytes from 192.168.0.237 (192.168.0.237): icmp_seq=2 ttl=64 time=1.15 ms ^C --- chromecast.local ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 1.152/1.710/2.269/0.560 ms

El lun., 27 jul. 2020 a las 5:34, Tor André Roland (< notifications@github.com>) escribió:

Have you tried to use Chromecast.local as ip? I think looking up the name server is out of control of homebridge and is handled by your network...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/torandreroland/homebridge-sony-audio-control/issues/2#issuecomment-664202052, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHGDIONDEBT3MOKSHFFF5G3R5U3YZANCNFSM4OMX7JLA .

perote2000 commented 4 years ago

Ive searched about getaddrinfo ENOTFOUND error message and made additional test and I found that plugin have to be using some function that uses DNS to get address info. It does not try to resolve name locally, so it will never resolve a local name. Also Ive set a internet available hostname (www.clarin.com) in config.json and it works,

{
        "name": "Amplificador",
        "ip": "www.clarin.com",

This means that plugins resolves hostname, and of course cannot connect to it, but it resolves fine. see log message...

[7/28/2020, 9:08:22 AM] [Amplificador] getPowerState() failed: connect ETIMEDOUT 104.18.19.22:10000 [7/28/2020, 9:08:22 AM] [Amplificador] getPowerState() failed: connect ETIMEDOUT 104.18.19.22:10000 [7/28/2020, 9:08:22 AM] [Amplificador] getVolume() failed: connect ETIMEDOUT 104.18.19.22:10000 [7/28/2020, 9:08:37 AM] [Amplificador] Connect Error: Error: connect ETIMEDOUT 104.18.19.22:10000 [7/28/2020, 9:08:37 AM] [Amplificador] Connect Error: Error: connect ETIMEDOUT 104.18.18.22:10000

So, I think plugin shuld resolve address using local mDNS, due all devices are local. There is not need to resolve internet names due Sony devices will allways locally. There are others plugins that has options to discover devices.. like Broadlink-RM perhaps the same function could be implemented here.