nitaybz / homebridge-onkyo-pioneer

Homebridge Plugin for Onkyo & Pioneer Audio Receivers
MIT License
8 stars 2 forks source link

Device state zone 2 after power off not updated #6

Open Albatros2409 opened 3 years ago

Albatros2409 commented 3 years ago

Again, thank you very much for the great plugin.

One issue I have is that the zone 2 in home app shows On when it is off. This is what happens: turn on zone 2 works fine, home app show on. Turning Zone 2 off does switch zone 2 off. For one second the Home app shows zone 2 off but than it shows on but actually zone 2 is off.

Do you know what the issue could be. Thanks in advance.

[2/9/2021, 8:04:22 PM] [OnkyoPioneer] Onkyo - Getting State [2/9/2021, 8:04:23 PM] [OnkyoPioneer] Onkyo - Got New State: {"power":1,"volume":47,"mute":false,"source":3} [2/9/2021, 8:04:26 PM] [OnkyoPioneer] Onkyo Zone 2 - Getting State [2/9/2021, 8:04:27 PM] [OnkyoPioneer] Error: Onkyo does not support ZVL command [2/9/2021, 8:04:27 PM] [OnkyoPioneer] ERROR OCCURRED: RX: unknown event: Error: Onkyo does not support ZVL command [2/9/2021, 8:04:31 PM] [OnkyoPioneer] SubError [TimeoutError]: Timeout when sending: !1ZVLQSTN at afterTimeout (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:49:15) at Timeout.timeoutTimeout [as _onTimeout] (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:76:13) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7) [2/9/2021, 8:04:31 PM] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZVLQSTN [2/9/2021, 8:04:31 PM] [OnkyoPioneer] Could NOT get state from "Onkyo Zone 2" : Timeout when sending: !1ZVLQSTN [2/9/2021, 8:04:31 PM] [OnkyoPioneer] Onkyo Zone 2 - found cached state in storage [2/9/2021, 8:04:31 PM] [OnkyoPioneer] Onkyo Zone 2 - Turning OFF [2/9/2021, 8:04:33 PM] [OnkyoPioneer] Onkyo Zone 2 - Getting State [2/9/2021, 8:04:33 PM] [OnkyoPioneer] Error: Onkyo does not support ZVL command [2/9/2021, 8:04:33 PM] [OnkyoPioneer] ERROR OCCURRED: RX: unknown event: Error: Onkyo does not support ZVL command [2/9/2021, 8:04:37 PM] [OnkyoPioneer] SubError [TimeoutError]: Timeout when sending: !1ZVLQSTN at afterTimeout (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:49:15) at Timeout.timeoutTimeout [as _onTimeout] (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:76:13) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7) [2/9/2021, 8:04:37 PM] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZVLQSTN [2/9/2021, 8:04:37 PM] [OnkyoPioneer] Could NOT get state from "Onkyo Zone 2" : Timeout when sending: !1ZVLQSTN [2/9/2021, 8:04:37 PM] [OnkyoPioneer] Onkyo Zone 2 - found cached state in storage [2/9/2021, 8:04:49 PM] [OnkyoPioneer] Onkyo Zone 2 - Turning OFF [2/9/2021, 8:04:51 PM] [OnkyoPioneer] Onkyo Zone 2 - Getting State [2/9/2021, 8:04:51 PM] [OnkyoPioneer] Error: Onkyo does not support ZVL command [2/9/2021, 8:04:51 PM] [OnkyoPioneer] ERROR OCCURRED: RX: unknown event: Error: Onkyo does not support ZVL command [2/9/2021, 8:04:53 PM] [OnkyoPioneer] Onkyo - Getting State [2/9/2021, 8:04:53 PM] [OnkyoPioneer] Onkyo - Got New State: {"power":1,"volume":47,"mute":false,"source":3} [2/9/2021, 8:04:55 PM] [OnkyoPioneer] SubError [TimeoutError]: Timeout when sending: !1ZVLQSTN at afterTimeout (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:49:15) at Timeout.timeoutTimeout [as _onTimeout] (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:76:13) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7) [2/9/2021, 8:04:55 PM] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZVLQSTN [2/9/2021, 8:04:55 PM] [OnkyoPioneer] Could NOT get state from "Onkyo Zone 2" : Timeout when sending: !1ZVLQSTN [2/9/2021, 8:04:55 PM] [OnkyoPioneer] Onkyo Zone 2 - found cached state in storage [2/9/2021, 8:04:57 PM] [OnkyoPioneer] Onkyo Zone 2 - Getting State [2/9/2021, 8:04:57 PM] [OnkyoPioneer] Error: Onkyo does not support ZVL command [2/9/2021, 8:04:57 PM] [OnkyoPioneer] ERROR OCCURRED: RX: unknown event: Error: Onkyo does not support ZVL command [2/9/2021, 8:05:01 PM] [OnkyoPioneer] SubError [TimeoutError]: Timeout when sending: !1ZVLQSTN at afterTimeout (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:49:15) at Timeout.timeoutTimeout [as _onTimeout] (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:76:13) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7) [2/9/2021, 8:05:01 PM] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZVLQSTN [2/9/2021, 8:05:01 PM] [OnkyoPioneer] Could NOT get state from "Onkyo Zone 2" : Timeout when sending: !1ZVLQSTN [2/9/2021, 8:05:01 PM] [OnkyoPioneer] Onkyo Zone 2 - found cached state in storage

iondarie commented 3 years ago

same problem here, status is not updating but the funny thing is that it worked for 1-2 days.

[2/20/2021, 10:03:35 PM] [OnkyoPioneer] NR-636 - Getting State
[2/20/2021, 10:03:39 PM] [OnkyoPioneer] SubError [TimeoutError]: Timeout when sending: !1ZPWQSTN
    at afterTimeout (/homebridge/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:49:15)
    at Timeout.timeoutTimeout [as _onTimeout] (/homebridge/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:76:13)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)
[2/20/2021, 10:03:39 PM] [OnkyoPioneer] Could NOT get state from "NR-636 Zone2" : Timeout when sending: !1ZPWQSTN
[2/20/2021, 10:03:39 PM] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZPWQSTN
[2/20/2021, 10:03:39 PM] [OnkyoPioneer] NR-636 Zone2 - found cached state in storage
[2/20/2021, 10:03:39 PM] [OnkyoPioneer] SubError [TimeoutError]: Timeout when sending: !1PWRQSTN
    at afterTimeout (/homebridge/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:49:15)
    at Timeout.timeoutTimeout [as _onTimeout] (/homebridge/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:76:13)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)
[2/20/2021, 10:03:39 PM] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1PWRQSTN
[2/20/2021, 10:03:39 PM] [OnkyoPioneer] Could NOT get state from "NR-636" : Timeout when sending: !1PWRQSTN
[2/20/2021, 10:03:39 PM] [OnkyoPioneer] NR-636 - found cached state in storage
nitaybz commented 3 years ago

Make sure the IP hasn't changed and that the "network standby" mode is enabled in the receiver settings.

iondarie commented 3 years ago

IP is set as fixed and network standby is enabled.

Albatros2409 commented 3 years ago

The same for me but not updating zone 2. Zone 1 is updated correctly.

toshibochan commented 3 years ago

Use this instead https://github.com/ToddGreenfield/homebridge-onkyo#readme

iondarie commented 3 years ago

does the homekit icon show a receiver ? :D

toshibochan commented 3 years ago

Unfortunately not but every things working

iondarie commented 3 years ago

ok so the plugin started working perfectly after i enable debug in the config... I have no ideea why it started working but it works.

It seems to be a good fix even for #5

{
            "statePollingInterval": 30,
            "debug": true,
            "receivers": [
                {
                    "ip": "xxx.xxx.xxx.xxx",
                    "name": "TX-NR636",
                    "maxVolume": 100,
                    "enableZone2": true
                }
            ],
            "platform": "OnkyoPioneer"
        },
nitaybz commented 3 years ago

I'm working on a fix... hang on guys

nitaybz commented 3 years ago

Latest version v0.0.18 should fix the issue

Albatros2409 commented 3 years ago

Thanks very much for the update. I tried the update but the problem still exists. This is the message while installing:

pm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated @types/multimatch@4.0.0: This is a stub types definition. multimatch provides its own type definitions, so you do not need this installed. [ ...............] \ loadDep:strip-ansi: sill resolveWithNewModule string-width@3.1.0 checking installable status

This is the message currently in the HB log:

6/2021, 11:59:20 AM] [OnkyoPioneer] SubError [TimeoutError]: Timeout when sending: !1ZVLQSTN at afterTimeout (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:49:15) at Timeout.timeoutTimeout [as _onTimeout] (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:76:13) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7) [6/6/2021, 11:59:20 AM] [OnkyoPioneer] Trying to reconnect... [6/6/2021, 11:59:20 AM] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZVLQSTN [6/6/2021, 11:59:20 AM] [OnkyoPioneer] Could NOT get state from "Onkyo Zone 2" : Timeout when sending: !1ZVLQSTN [6/6/2021, 11:59:20 AM] [OnkyoPioneer] Onkyo Zone 2 - found cached state in storage [6/6/2021, 11:59:41 AM] [OnkyoPioneer] Onkyo - Getting State [6/6/2021, 11:59:42 AM] [OnkyoPioneer] Onkyo - Got New State: {"power":0,"volume":52,"mute":false,"source":3} [6/6/2021, 11:59:46 AM] [OnkyoPioneer] Onkyo Zone 2 - Getting State [6/6/2021, 11:59:46 AM] [OnkyoPioneer] Error: Onkyo does not support ZVL command [6/6/2021, 11:59:46 AM] [OnkyoPioneer] Trying to reconnect... [6/6/2021, 11:59:46 AM] [OnkyoPioneer] ERROR OCCURRED: RX: unknown event: Error: Onkyo does not support ZVL command [6/6/2021, 11:59:50 AM] [OnkyoPioneer] SubError [TimeoutError]: Timeout when sending: !1ZVLQSTN at afterTimeout (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:49:15) at Timeout.timeoutTimeout [as _onTimeout] (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:76:13) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7) [6/6/2021, 11:59:50 AM] [OnkyoPioneer] Trying to reconn

nitaybz commented 3 years ago

It seems like it's not installing the latest onkyo.js lib. Maybe try to uninstall the plugin and install again

On 6 Jun 2021, at 13:00, Albatros2409 @.***> wrote:

 Thanks very much for the update. I tried the update but the problem still exists. This is the message while installing:

pm WARN deprecated @.: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated @@.: This is a stub types definition. multimatch provides its own type definitions, so you do not need this installed. [ ...............] \ loadDep:strip-ansi: sill resolveWithNewModule @.*** checking installable status

This is the message currently in the HB log:

6/2021, 11:59:20 AM] [OnkyoPioneer] SubError [TimeoutError]: Timeout when sending: !1ZVLQSTN at afterTimeout (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:49:15) at Timeout.timeoutTimeout [as _onTimeout] (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:76:13) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7) [6/6/2021, 11:59:20 AM] [OnkyoPioneer] Trying to reconnect... [6/6/2021, 11:59:20 AM] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZVLQSTN [6/6/2021, 11:59:20 AM] [OnkyoPioneer] Could NOT get state from "Onkyo Zone 2" : Timeout when sending: !1ZVLQSTN [6/6/2021, 11:59:20 AM] [OnkyoPioneer] Onkyo Zone 2 - found cached state in storage [6/6/2021, 11:59:41 AM] [OnkyoPioneer] Onkyo - Getting State [6/6/2021, 11:59:42 AM] [OnkyoPioneer] Onkyo - Got New State: {"power":0,"volume":52,"mute":false,"source":3} [6/6/2021, 11:59:46 AM] [OnkyoPioneer] Onkyo Zone 2 - Getting State [6/6/2021, 11:59:46 AM] [OnkyoPioneer] Error: Onkyo does not support ZVL command [6/6/2021, 11:59:46 AM] [OnkyoPioneer] Trying to reconnect... [6/6/2021, 11:59:46 AM] [OnkyoPioneer] ERROR OCCURRED: RX: unknown event: Error: Onkyo does not support ZVL command [6/6/2021, 11:59:50 AM] [OnkyoPioneer] SubError [TimeoutError]: Timeout when sending: !1ZVLQSTN at afterTimeout (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:49:15) at Timeout.timeoutTimeout [as _onTimeout] (/usr/local/lib/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:76:13) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7) [6/6/2021, 11:59:50 AM] [OnkyoPioneer] Trying to reconn

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Albatros2409 commented 3 years ago

Still no luck. Did a uninstall and install and same message during installation and now this in the log:

[6/6/2021, 12:31:47 PM] [OnkyoPioneer] Onkyo Zone 2 - Turning OFF [6/6/2021, 12:31:49 PM] [OnkyoPioneer] Onkyo Zone 2 - Turning ON [6/6/2021, 12:31:59 PM] [OnkyoPioneer] Onkyo Zone 2 - Turning OFF [6/6/2021, 12:32:01 PM] [OnkyoPioneer] ERROR OCCURRED: RX: unknown event: Error: Onkyo does not support ZVL command [6/6/2021, 12:32:05 PM] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZVLQSTN [6/6/2021, 12:32:05 PM] [OnkyoPioneer] Could NOT get state from "Onkyo Zone 2" : Timeout when sending: !1ZVLQSTN [6/6/2021, 12:32:22 PM] [OnkyoPioneer] Onkyo Zone 2 - Turning OFF [6/6/2021, 12:32:24 PM] [OnkyoPioneer] ERROR OCCURRED: RX: unknown event: Error: Onkyo does not support ZVL command [6/6/2021, 12:32:28 PM] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZVLQSTN [6/6/2021, 12:32:28 PM] [OnkyoPioneer] Could NOT get state from "Onkyo Zone 2" : Timeout when sending: !1ZVLQSTN [6/6/2021, 12:32:35 PM] [OnkyoPioneer] ERROR OCCURRED: RX: unknown event: Error: Onkyo does not support ZVL command [6/6/2021, 12:32:39 PM] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZVLQSTN

Albatros2409 commented 3 years ago

And this message during restart:

6/6/2021, 12:38:05 PM] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZVLQSTN [6/6/2021, 12:38:05 PM] [OnkyoPioneer] Could NOT get state from "Onkyo Zone 2" : Timeout when sending: !1ZVLQSTN Preparing Advertiser for 'Onkyo Zone 2 6BD5' using bonjour-hap backend! Starting to advertise 'Onkyo Zone 2 6BD5' using bonjour-hap backend! [6/6/2021, 12:38:05 PM] Onkyo Zone 2 6BD5 is running on port 60766. [6/6/2021, 12:38:05 PM] Please add [Onkyo Zone 2 6BD5] manually in Home app. Setup Code: 819-64-700

Albatros2409 commented 3 years ago

Removed and added in home app but not a fix

adriaanb commented 1 year ago

I believe I have been having a related issue. I only use a single zone on an amplifier that is networked but does not support network standby.

Anyhow - for me the issue was that the getState function in stateManager.js would return the last cached state for the device/zone, not taking into account the possibility that the device might be unreachable because it is powered off.

This code is way above my head so I am unsure which edge-cases the solution that worked for me does not take into consideration, but I made changes to the folling bit of code starting at line 24:

if (this.id in this.cachedStates) {
    this.log.easyDebug(`${this.name} - found cached state in storage`)
    return this.cachedStates[this.id]
} else ....

was replaced by

if (this.id in this.cachedStates) {
    this.log.easyDebug(`${this.name} - found cached state in storage`)
    return {
        power: 0,
        volume: 0,
        mute: this.cachedStates[this.id].mute,
        source: this.cachedStates[this.id].source
    }
}  else ....

A possibly better way would be to check if the IP address is reachable or not before deciding whether or not to return the cached states for power and volume as well, but I was unable to figure out how to access the IP address from within stateManager without having to hardcode it.

I hope this info turns out to be helpful at all to others as well.

I suspect the errors I have been getting are merely warnings that can be ignored, but I'll share them for the sake of completeness nonetheless.

After turning off the device I get :

Unhandled rejection TimeoutError: Timeout when sending: !1PWR00
    at afterTimeout (/var/lib/homebridge/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:49:15)
    at Timeout.timeoutTimeout [as _onTimeout] (/var/lib/homebridge/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:76:13)
    at listOnTimeout (node:internal/timers:564:17)
    at processTimers (node:internal/timers:507:7)

Whereas if I boot HomeBridge with the amplifier already in Standby I get:

ERROR OCCURRED: connect ECONNREFUSED 192.168.xxx.xxx:port
Unhandled rejection Error: connect ECONNREFUSED 192.168.xxx.xxx:port
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1487:16)
vmarks commented 2 months ago

I am having zone2 problems on onkyo TX-NR646 - when zone2 is off, Home App shows it as on.

[19/06/2024, 14:27:10] [OnkyoPioneer] Could NOT get state from "Onkyo Zone2" : Timeout when sending: !1ZVLQSTN [19/06/2024, 14:27:37] [OnkyoPioneer] ERROR OCCURRED: RX: unknown event: Error: Onkyo does not support ZVL command [19/06/2024, 14:27:40] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZVLQSTN [19/06/2024, 14:27:40] [OnkyoPioneer] Could NOT get state from "Onkyo Zone2" : Timeout when sending: !1ZVLQSTN (node:20432) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 ZVL listeners added to [Onkyo]. Use emitter.setMaxListeners() to increase limit (Usenode --trace-warnings ...to show where the warning was created)

These messages are filling up the log. If I disable zone2, they go away. Zone 2 functions correctly from Apple's Home app, but I'm concerned about these log messages.

[19/06/2024, 15:50:08] [OnkyoPioneer] ERROR OCCURRED: Timeout when sending: !1ZVLQSTN [19/06/2024, 15:50:08] [OnkyoPioneer] Trying to reconnect... [19/06/2024, 15:50:08] [OnkyoPioneer] Could NOT get state from "Onkyo Zone2" : Timeout when sending: !1ZVLQSTN [19/06/2024, 15:50:08] [OnkyoPioneer] Onkyo Zone2 - found cached state in storage [19/06/2024, 15:50:32] [OnkyoPioneer] Onkyo - Getting State [19/06/2024, 15:50:32] [OnkyoPioneer] Onkyo - Got New State: {"power":0,"volume":38,"mute":false,"source":11} [19/06/2024, 15:50:36] [OnkyoPioneer] Onkyo Zone2 - Getting State [19/06/2024, 15:50:36] [OnkyoPioneer] Error: Onkyo does not support ZVL command [19/06/2024, 15:50:36] [OnkyoPioneer] ERROR OCCURRED: RX: unknown event: Error: Onkyo does not support ZVL command [19/06/2024, 15:50:36] [OnkyoPioneer] Trying to reconnect... [19/06/2024, 15:50:40] [OnkyoPioneer] SubError [TimeoutError]: Timeout when sending: !1ZVLQSTN at afterTimeout (/var/lib/homebridge/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:49:15) at Timeout.timeoutTimeout [as _onTimeout] (/var/lib/homebridge/node_modules/homebridge-onkyo-pioneer/node_modules/bluebird/js/release/timers.js:76:13) at listOnTimeout (node:internal/timers:573:17) at processTimers (node:internal/timers:514:7)

it would be nice to have the errors resolved and power state fixed. the rest of the plugin works amazingly well.