unfoldedcircle / feature-and-bug-tracker

Feature and bug tracker repository for Unfolded Circle products
25 stars 0 forks source link

[bug] Denon integration never seems to reconnect after receiver was offline #207

Open leoschweizer opened 10 months ago

leoschweizer commented 10 months ago

Is there an existing issue for this?

Description

I may be in the minority but I completely power off my devices when not in use, i.e. I completely disconnect the power input. I could successfully add the Denon integration and control my receiver. However, once the reveiver went offline for some time, the remote never seems to be able to connect again (this is still the case when I can access the web interface of the receiver, so I really don't see a reason why the remote wouldn't be able to reconnect). Once I reboot the remote, the connection works immediately. I have configured the integration to use Telnet.

How to Reproduce

  1. Add Denon integration
  2. Completely power down the Denon receiver
  3. Power on the receiver
  4. The remote will not execute any commands from the Denon integration
  5. Reboot the remote
  6. Commands will work again

Expected behavior

The remote should be able to connect to a Denon receiver that was offline for some time.

System version

v1.4.8

What part of the system affected by the problem?

Integration

Additional context

Two logs from before and after the reboot (I have enabled the Denon integration in the log output, yet there don't appear to be any logs at all from that integration?):

UCR2_logs_2023-11-21.txt UCR2_logs_2023-11-212.txt

zehnm commented 10 months ago

I handle my receiver exactly the same with a myStrom WiFi switch, since it draws way too much power in standby for my taste. Therefore, I made sure that the remote can reconnect again. Let's find out why it doesn't work for you.

image image

It's very well possible that there's still a bug in the integration and it somehow "gave up" reconnecting. The logs should tell me more.

leoschweizer commented 10 months ago

@zehnm that's good to hear 😅 How long does it typically take for you after restoring power supply before the connection can be established? I can confirm that network control is configured to be "always on".

Here is a log of the same scenario (including integration logs this time): UCR2_logs_2023-11-22.txt

I noticed I see two different error messages, first it is "service unavailable" and then after some time "internal server error".

zehnm commented 10 months ago

My AVR-X2700 takes around 45 seconds after restoring power to be able to connect with telnet. But this is mainly used for getting events from the AVR. It takes around 1m 20s until http connections can be established. After the remote wakes up, it starts with a 0.5s delay for the next reconnection attempt to the receiver and then starts increasing it with a backoff factor of 1.5, up to a maximum of 30s. That means, worst case is an additional 30 seconds after the receiver would be ready.

I'm using DHCP on the receiver and have to check if setting a static address will speed it up.

I still need to take a deeper look at your logs, but what I see is that it took around 1m 22s until your AVR was finally connected:

Most likely the receiver would have been ready after 15:06:42. I'll take another look at the integration driver if it doesn't block command requests or reports an invalid state back. As long as it's not connected, it should report "service not available" and not another confusing error.

leoschweizer commented 10 months ago

This time I waited for ~half an hour after restoring power before interacting with the remote and this time the integration did work without issue; maybe it gets into a broken state when attempting too many failed commands while the receiver is not yet available?