ol-iver / denonavr

Automation Library for Denon AVR receivers.
MIT License
176 stars 67 forks source link

Can't connect to AVR device after home-assistant 2021.5.0 update #205

Closed fstap closed 3 years ago

fstap commented 3 years ago

Hey there,

after the home-assistant update to 2021.5.0 (stable), the denonavr integration cannot connect to AVR devices anymore. It looks like the script is aborted if it cannot find the Deviceinfo.xml whereas before, it continued assuming the device is of type AVR. Here is the error I see in home-assistant:

2021-05-05 20:33:20 DEBUG (MainThread) [denonavr.foundation] Request error when identifying receiver Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/denonavr/foundation.py", line 131, in async_identify_receiver xml = await self.api.async_get_xml( File "/usr/local/lib/python3.8/site-packages/denonavr/decorators.py", line 90, in wrapper return await func(*args, **kwargs) File "/usr/local/lib/python3.8/site-packages/async_lru.py", line 237, in wrapped return (yield from asyncio.shield(fut, loop=_loop)) File "/usr/local/lib/python3.8/site-packages/denonavr/decorators.py", line 44, in wrapper return await func(*args, **kwargs) File "/usr/local/lib/python3.8/site-packages/denonavr/api.py", line 143, in async_get_xml self.check_xml_validity(request, xml_root) File "/usr/local/lib/python3.8/site-packages/denonavr/api.py", line 246, in check_xml_validity raise AvrInvalidResponseError( denonavr.exceptions.AvrInvalidResponseError: Returned document contains HTML 2021-05-05 20:33:20 DEBUG (MainThread) [httpx._client] HTTP Request: GET http://192.168.178.32:8080/goform/Deviceinfo.xml "HTTP/1.1 404 Not Found"

It should just accept this error and continue without a Deviceinfo.xml. Everything worked fine before the async rewrite. This leads to the whole integration not functioning, deleting the entity and reconfiguring the integration doesn't help as it displays an error saying that the connection failed.

bwynants commented 3 years ago

Same here AVR-3312

Config entry 'Denon AVR' for denonavr integration not ready yet: TimeoutException: ; Retrying in background 22:15:27 – (WAARSCHUWING) config_entries.py

ol-iver commented 3 years ago

@fstap are there other messages? The ones you posted are just debugging messages, which are ok on an AVR device

@bwynants is it a real timeout or can you confirm that your receiver is reachable via network?

fstap commented 3 years ago

@scarface-4711 unfortunately not, these are the only messages. I downgraded to the previous version to confirm the error is not on my side, I'll have a look into the code, maybe I can fix it myself!

ol-iver commented 3 years ago

@bwynants I fixed your issue yesterday most likely. It is available here in github, but now anywhere else yet. I will create a new version soon.

@fstap you could start by testing the commands from README.md manually and see where it fails. What's your model? Maybe you are facing the same issue as @bwynants.

bwynants commented 3 years ago

@bwynants is it a real timeout or can you confirm that your receiver is reachable via network?

I can reach the device with the deremote app...

@bwynants I fixed your issue yesterday most likely. It is available here in github, but now anywhere else yet. I will create a new version soon.

Cool, thx. will have to wait for a new HA release....

fstap commented 3 years ago

@scarface-4711 The new timeout error handling actually fixed my issue! I confirmed that the error was the same as bwynants by using the bare python script without home-assistant. Oh and btw I have the Denon 1912. Thank you so much!!

bwynants commented 3 years ago

@scarface-4711

2021-05-11 10:48:02 INFO (MainThread) [denonavr.foundation] AVR device, AppCommand.xml interface not supported 2021-05-11 10:48:03 ERROR (MainThread) [homeassistant.components.denonavr.receiver] Missing receiver information: manufacturer 'DENON', name 'None', model 'AVR-3312', type 'avr' 2021-05-11 10:48:03 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.denonavr ]2021-05-11 10:48:13 WARNING (MainThread) [homeassistant.components.media_player] Setup of media_player platform denonavr is taking over 10 seconds. 2021-05-11 10:48:18 INFO (MainThread) [denonavr.foundation] AVR device, AppCommand.xml interface not supported 2021-05-11 10:48:18 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up denonavr platform for media_player Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 231, in _async_setup_platform await asyncio.shield(task) File "/usr/src/homeassistant/homeassistant/components/denonavr/media_player.py", line 104, in async_setup_entry DenonDevice( File "/usr/src/homeassistant/homeassistant/components/denonavr/media_player.py", line 153, in init self._supported_features_base |= ( TypeError: unsupported operand type(s) for |=: 'int' and 'NoneType'

still not working in 107

fstap commented 3 years ago

@bwynants Hey, this is an issue which was fixed in the newest version, see https://github.com/home-assistant/core/pull/50428#issuecomment-837965008 The integration will probably start working with home-assistant 2021.5.3, as a temporary fix you could update the component in your ha installation yourself

bwynants commented 3 years ago

thank you i will await the newer version.

ol-iver commented 3 years ago

Patch is included in a PR for HA 2021.5.3 now https://github.com/home-assistant/core/pull/50476