peteS-UK / sonyavr

Home Assistant Media Player for older Sony AVRs
MIT License
1 stars 0 forks source link

Unable to talk to Sony AVR-DN850 #9

Closed falseunity closed 2 months ago

falseunity commented 2 months ago

Hey,

Tried all various ports listed in the docs. A port scan of the DN850 shows many ports open including the ones you listed. None of the 5 has worked for me. Log shows the following. If there's anything else I can provide to help get it working, I'm happy to help out. Thanks!

Logger: homeassistant.config_entries Source: config_entries.py:604 First occurred: 7:49:22 PM (6 occurrences) Last logged: 7:55:20 PM

Error setting up entry Sony AVR for sonyavr Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/sonyavr/init.py", line 32, in async_setup_entry sonyavr = SonyAVR( ^^^^^^^^ File "/config/custom_components/sonyavr/sonyavr.py", line 1169, in init self.device_service = DeviceService() ^^^^^^^^^^^^^^^ File "/config/custom_components/sonyavr/sonyavr.py", line 861, in init for ip in socket.gethostbyname_ex(socket.gethostname())[2] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ socket.gaierror: [Errno -2] Name does not resolve

peteS-UK commented 2 months ago

Hi @falseunity . OK - that's a strange one. It's not getting as far as trying to connect to the AVR - that's failing when the integration is trying to find its own local IP address and subnet. No idea why that would fail - it looks like it doesn't know its own host name. What's your network setup on the HA device?

Having said that, that step is more for info and debugging. I don't actually use it anywhere I think. So, I can easily put that lot in a try/except step so it's just ignored. Might mean something else fails down the line, or it might all work fine since I don't know why it would fail to know its own ip.

peteS-UK commented 2 months ago

Hi @falseunity . I just pushed a new release 1.3.0 - some code formatting changes, but also changed the ip discovery method and added try around it, so you shouldn't get this error, but don't know if it'll work as I don't understand the original cause. Port is likely 33335, so give 1.3.0 a try.

What volume range does it have - the 840 is 0 to 45 in steps of 1, I know the 1050 is a db range - -80 to +20 in .5 steps. We may need to tweak things depending on the debug responses if the volume doesn't behave fully (there's no API for any of this, so we're just looking at the debug to see what works).

falseunity commented 2 months ago

Hey, well unsure what happened but I installed this version and after another HA reboot, it just works. I had rebooted HA 3 times yesterday after the initial install and nothing changed but now it shows up, 1 device and 3 entites. Volume seems perfect, source, sound mode, all there and working. Overnight gremlins or something you changed allowed it to work ?!? Anything else I can provide for you ? Thanks for your help, this is awesome !

peteS-UK commented 2 months ago

If you installed 1.3.0, then yes, it's different in the area you were getting that error message - I just changed that piece to something a little more simple and wrapped it in an error catch just in case. It's actually only there to help generate debug messages if required. The original problem you were having didn't make a load of sense tbh - no idea why it wouldn't be able to find its own IP address so something odd was going on.

So, great news that it's working. What volume range does your AVR use - 0 to 45 or -80 to +20? Just curious to make sure it's picking up the right method to use (there's different ways in there as the required codes are slightly different and I guess which mode to use based on a bit of debug feedback the AVR sends).

falseunity commented 2 months ago

Mine uses - 0 to 74 and seems to be working perfectly. This is super. Thanks for the excellent support!

peteS-UK commented 2 months ago

NP - glad it's working. I'll close this issue now, but feel free to open another one if you come across anything.