homebridge-denon-marantz-avr icon indicating copy to clipboard operation
homebridge-denon-marantz-avr copied to clipboard

Power On/Standby

Open danbridgland opened this issue 6 years ago • 44 comments

Any way to read and control the current power state?

Having read the PR’s, I saw an option for a http call, { http://10.0.0.14:8080/goform/formiPhoneAppDirect.xml?PWSTANDBY }, this worked great in the browser, but I really want it as a switch in HomeBridge.

danbridgland avatar Jan 04 '19 00:01 danbridgland

I believe this is meant to work actually... looking at index.js there is getPowerState etc.

However, I am having issues with this too -

It can't seem to find whether it's on or off:

[2019-1-4 20:31:18] [Denon] Initializing DenonMarantzAVR accessory... [2019-1-4 20:31:18] [Denon] start polling.. [2019-1-4 20:31:18] [Denon] do poll.. [2019-1-4 20:31:20] [Denon] Can't connect to device: null [2019-1-4 20:31:20] [Denon] poll end, state: false [2019-1-4 20:32:18] [Denon] do poll.. [2019-1-4 20:32:19] [Denon] Can't connect to device: null [2019-1-4 20:33:18] [Denon] do poll.. [2019-1-4 20:33:31] [Denon] Can't connect to device: null

This is what happens when I toggle the switch: [2019-1-4 20:33:37] [Denon] denon avr powered undefined [2019-1-4 20:33:39] [Denon] denon avr powered undefined [2019-1-4 20:33:45] [Denon] denon avr powered undefined [2019-1-4 20:33:51] [Denon] denon avr powered undefined

The Denon stays on, but it does display on my TV screen the default volume of 35 when I toggle the switch on, so it's clearly receiving something...

The following commands do turn the receiver on/off if sent from the browser: 192.168.1.9:8080/goform/formiPhoneAppDirect.xml?PWON 192.168.1.9:8080/goform/formiPhoneAppDirect.xml?PWSTANDBY

My config is: { "accessory": "DenonMarantzAVR", "name": "Denon", "ip": "192.168.1.9", "port": 8080, "defaultInput": "CBL/SAT", "defaultVolume": 35, "doPolling": true, "pollingInterval": 60 }

Edit: Volume etc. works via Eve app. So they're definitely talking.

If the device is already on I toggle on within the app, it sets it back to the default volume, but toggling off does nothing.

Toggling on when the device is off does nothing/doesn't turn it on.

lswee avatar Jan 04 '19 20:01 lswee

Any news on this?

danbridgland avatar Jan 09 '19 16:01 danbridgland

I started rewriting the entire plugin today. I will add the new speaker service (#16) and support for the second zone (#19). I will also try to support as many models as possible. This will take a few days.

stfnhmplr avatar Jan 09 '19 18:01 stfnhmplr

Great news! Thank you.

danbridgland avatar Jan 09 '19 19:01 danbridgland

I know 3D is nolonger a part of TV’s, and that you can’t test it, but could you consider adding it as an option, and defining a default option.

I’ll be happy to test for you.

Siobhan www.lambrettaconcessionaires.comhttp://www.lambrettaconcessionaires.com

From: stfnhmplr [email protected] Reply-To: stfnhmplr/homebridge-denon-marantz-avr [email protected] Date: Wednesday, January 9, 2019 at 11:15 AM To: stfnhmplr/homebridge-denon-marantz-avr [email protected] Cc: Subscribed [email protected] Subject: Re: [stfnhmplr/homebridge-denon-marantz-avr] Power On/Standby (#22)

I started rewriting the entire plugin today. I will add the new speaker service (#16https://github.com/stfnhmplr/homebridge-denon-marantz-avr/issues/16) and support for the second zone (#19https://github.com/stfnhmplr/homebridge-denon-marantz-avr/issues/19). I will also try to support as many models as possible. This will take a few days.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/stfnhmplr/homebridge-denon-marantz-avr/issues/22#issuecomment-452804720, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AfoHhUXPqPHiHkPvrggsz9r-oVWbJXo8ks5vBj_ggaJpZM4Zo9Sz.

siobhanellis avatar Jan 09 '19 21:01 siobhanellis

Ignore my last 😃 wrong plug in.

Siobhan www.lambrettaconcessionaires.comhttp://www.lambrettaconcessionaires.com

From: stfnhmplr [email protected] Reply-To: stfnhmplr/homebridge-denon-marantz-avr [email protected] Date: Wednesday, January 9, 2019 at 11:15 AM To: stfnhmplr/homebridge-denon-marantz-avr [email protected] Cc: Subscribed [email protected] Subject: Re: [stfnhmplr/homebridge-denon-marantz-avr] Power On/Standby (#22)

I started rewriting the entire plugin today. I will add the new speaker service (#16https://github.com/stfnhmplr/homebridge-denon-marantz-avr/issues/16) and support for the second zone (#19https://github.com/stfnhmplr/homebridge-denon-marantz-avr/issues/19). I will also try to support as many models as possible. This will take a few days.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/stfnhmplr/homebridge-denon-marantz-avr/issues/22#issuecomment-452804720, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AfoHhUXPqPHiHkPvrggsz9r-oVWbJXo8ks5vBj_ggaJpZM4Zo9Sz.

siobhanellis avatar Jan 09 '19 21:01 siobhanellis

Just had a read up on the HomeKit speaker service, however it seems the long since pledged service is still not present in HomeKit as of iOS 12.1.2

@stfnhmplr, Have you found a way to add this speaker service?

danbridgland avatar Jan 14 '19 22:01 danbridgland

I believe it is there, just not exposed in the Homekit app. Can’t you use it in the Eve App?

Anyway, it must be coming for the new TV services that were announced in CES.

Siobhan www.lambrettaconcessionaires.comhttp://www.lambrettaconcessionaires.com

From: danbridgland [email protected] Reply-To: stfnhmplr/homebridge-denon-marantz-avr [email protected] Date: Monday, January 14, 2019 at 2:34 PM To: stfnhmplr/homebridge-denon-marantz-avr [email protected] Cc: siobhanellis [email protected], Comment [email protected] Subject: Re: [stfnhmplr/homebridge-denon-marantz-avr] Power On/Standby (#22)

Just had a read up on the HomeKit speaker service, however it seems the long since pledged service is still not present in HomeKit as of iOS 12.1.2

@stfnhmplrhttps://github.com/stfnhmplr, Have you found a way to add this speaker service?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/stfnhmplr/homebridge-denon-marantz-avr/issues/22#issuecomment-454187459, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AfoHhZnFIQAUF2MRAg2UBboeSirh8v3oks5vDQX3gaJpZM4Zo9Sz.

siobhanellis avatar Jan 14 '19 22:01 siobhanellis

How’s the rewrite going? In need of any beta testers?

danbridgland avatar Jan 21 '19 21:01 danbridgland

I’d be willing to help test too.

Also worth noting that with the new iOS beta a lot of TV features have been enabled:

https://twitter.com/KhaosT/status/1088678984970162176

Does the Speaker Service support selecting inputs like the TV Service does?

lswee avatar Jan 26 '19 12:01 lswee

I just released a first update in the dev branch. any testers are welcome.

The Speaker Service is still not supported by Apple's Home App, but works for example with the EVE App. Selecting inputs is not possible, but the volume can be adjusted.

To test the version, you have to take the following steps:

git clone --single-branch --branch dev https://github.com/stfnhmplr/homebridge-denon-marantz-avr.git
cd homebridge-denon-marantz-avr
npm install
rollup -c

Then change your config (see readme) and restart homebridge.

stfnhmplr avatar Feb 01 '19 21:02 stfnhmplr

Thank you!

The last command didn't work for me on macOS SSH'ing into a Pi:

-bash: rollup: command not found

So I'm assuming it's not properly installed for me, because when I added it to the config (changing it to a platform as described), my homebridge crashed and said:

Error: The requested platform 'DenonMarantzAVR' was not registered by any plugin.

lswee avatar Feb 02 '19 00:02 lswee

I'm sorry. You should install rollup globally by typing npm install -g rollup and execute the command again.

stfnhmplr avatar Feb 02 '19 08:02 stfnhmplr

Great, thank you.

It doesn't seem to be working or registering for me:

rollup -c

src/index.js → dist/index.js... (!) node-resolve plugin: The onwrite hook used by plugin node-resolve is deprecated. The generateBundle hook should be used instead. created dist/index.js in 6.1s

src/accessories/MainZoneAccessory.js → dist/accessories/MainZoneAccessory.js... (!) node-resolve plugin: The onwrite hook used by plugin node-resolve is deprecated. The generateBundle hook should be used instead. created dist/accessories/MainZoneAccessory.js in 3.5s

src/accessories/SecondZoneAccessory.js → dist/accessories/SecondZoneAccessory.js... (!) node-resolve plugin: The onwrite hook used by plugin node-resolve is deprecated. The generateBundle hook should be used instead. created dist/accessories/SecondZoneAccessory.js in 1.8s

This seems to be relevant: https://github.com/egoist/rollup-plugin-postcss/issues/147

I can't find where it says onwrite to change it though.

Edit: Before this I was having access permission issues with npm install -g rollup which I fixed after seeing this comment: https://github.com/tldr-pages/tldr/issues/820#issuecomment-193847014

That issue is outlined here: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

It's solved by installing a Node version manager: https://github.com/creationix/nvm#installation

lswee avatar Feb 02 '19 13:02 lswee

I just added the dist files so that testing should be easier. You don't have to install rollup now. Just delete the folder and clone the dev branch again. Or switch into the folder and fetch the latest update.

stfnhmplr avatar Feb 04 '19 20:02 stfnhmplr

Thanks @stfnhmplr .

I've cloned the latest version, npm install:

added 166 packages from 152 contributors and audited 1542 packages in 26.344s found 0 vulnerabilities

I feel like I'm missing something.. With the correct config, when I launch homebridge I get:

The requested platform 'DenonMarantzAVR' was not registered by any plugin.

lswee avatar Feb 05 '19 00:02 lswee

What directory did you clone it to? It must be the global npm modules folder. Or you have to run it in development mode, see the Homebridge ReadMe for instructions.

stfnhmplr avatar Feb 05 '19 05:02 stfnhmplr

I literally found out about HomeBridge on Sunday. I just a couple of hours ago got it up and installed on my Synology NAS using Docker, with my first working platform for my Sony Bravia TV, and now my Denon S930H is next up. So happy I found out about this. Thank you so much for developing this and staying up to date on these HomeKit integrations <3

paulseiler avatar Feb 05 '19 08:02 paulseiler

What directory did you clone it to? It must be the global npm modules folder. Or you have to run it in development mode, see the Homebridge ReadMe for instructions.

So I've been tinkering with Denon plugins for a few hours. I'm working with yours at the moment. Been struggling with the getting the volume to work right. It kept crashing in a loop, unable to garnish a proper result for the "Receiver MainZone Volume power state" which was always broken at "0" ... Needed to share this ...

screen shot 2019-02-05 at 4 07 32 am copy

... literally immediately after installing this dev version, it works!

Now I am having a different hiccup ... but everything I want this accessory button to do is working on some level. Haha. It's bugging out a bit but I can send logs if you're interested.

It turns my Denon S930H On & Off, as well as changes the volume! I left out the "...max100" option as my entire family is used to the Denon based volume numbers on our receivers already. IT ALL WORKS WITH ONE BUTTON 💃 !

Here's a screenshot of the logs when it died ... ha.

screen shot 2019-02-05 at 4 35 13 am screen shot 2019-02-05 at 4 35 25 am

My config:

    {
      "accessory": "marantz-volume",
      "name": "Denon Volume",
      "host": "static.denon.ip.address:8080",
      "maxVolume":  75,
      "controlPower": true,
      "controlMute": true
}

–––––

Off:

img_3961

img_3970

–––––

On: img_3967

img_3973

img_3974

–––––

Change Volume to 20%: img_3976

img_3975

–––––

Going to play around with the options for ...

      "doPolling": true,
      "pollingInterval": 60

... and see if that won't fix some connection quirks.

Cheers <3

paulseiler avatar Feb 05 '19 09:02 paulseiler

What directory did you clone it to? It must be the global npm modules folder. Or you have to run it in development mode, see the Homebridge ReadMe for instructions.

Thanks @stfnhmplr, getting this up and running has actually helped me improve my setup in general!

I'm now getting this:

[2/5/2019, 8:17:13 PM] Loaded plugin: homebridge-denon-marantz-avr [2/5/2019, 8:17:13 PM] Registering platform 'homebridge-denon.DenonMarantzAVR' [2/5/2019, 8:17:14 PM] [Speakers] Initializing DenonMarantzAVR platform... [2/5/2019, 8:17:14 PM] [Speakers] Not connected to AVR. Trying again...

throw err; // Unhandled 'error' event
^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Cannot connect') at Telnet.emit (events.js:186:17) at Socket.socket.setTimeout (/home/pi/.nvm/versions/node/v11.9.0/lib/node_modules/homebridge-denon-marantz-avr/node_modules/telnet-client/lib/index.js:76:16) at Object.onceWrapper (events.js:285:13) at Socket.emit (events.js:197:13) at Socket._onTimeout (net.js:447:8) at listOnTimeout (timers.js:327:15) at processTimers (timers.js:271:5)

lswee avatar Feb 05 '19 20:02 lswee

@paulseiler Thanks for trying.

{ "accessory": "marantz-volume", "name": "Denon Volume", "host": "static.denon.ip.address:8080", "maxVolume": 75, "controlPower": true, "controlMute": true }

This config is not for this plugin 😉 Take a look at the readme of the dev branch for an example.

"doPolling": true, "pollingInterval": 60

Since the new version connects over telnet, there's no polling needed anymore. If you change the volume by hand, your accessories should receive the new state immediately.

stfnhmplr avatar Feb 11 '19 19:02 stfnhmplr

@lswee Looks like an connection issue. Did you update your config as shown in the example? Is the Denon accessible in the network? You can try it with ping. You can also check if port 23 is open. It should report something like Open TCP Port: 23 telnet

stfnhmplr avatar Feb 11 '19 19:02 stfnhmplr

Thanks for your reply @stfnhmplr

My config is:

        {
          "platform": "DenonMarantzAVR",
          "name": "Speakers",
          "host": "192.168.1.9",
          "maxVolume": 70
        }

Should that work?

My Denon should be available over the network... the AVR Remote works and I can AirPlay to it.

Also the following commands work: 192.168.1.9:8080/goform/formiPhoneAppDirect.xml?PWON 192.168.1.9:8080/goform/formiPhoneAppDirect.xml?PWSTANDBY

I'm unsure how to check if port 23 is open however... I've done a simple ping and it worked.

I've also tried my config with :8080 following the IP.

lswee avatar Feb 11 '19 20:02 lswee

I've looked into this further, it seems telnet does not come as standard with Raspbian...

I've now installed it using: sudo apt-get install telnet

I can connect to the Denon, although it kicks me off after a few seconds, I'm not sure as to why.

telnet 192.168.1.9 8080

Trying 192.168.1.9... Connected to 192.168.1.9. Escape character is '^]'. Connection closed by foreign host.

I'm still getting the following error when running homebridge:

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Cannot connect') at Telnet.emit (events.js:186:17) at Socket.socket.setTimeout (/home/pi/.nvm/versions/node/v11.9.0/lib/node_modules/homebridge-denon-marantz-avr/node_modules/telnet-client/lib/index.js:76:16)

Edit: I don't get booted off when I don't use the port i.e. telnet 192.168.1.9

I'm not sure exactly what I'm looking at when that's running. There a lines changing quickly, two I saw started with OPINFASP and SSAST followed by a long string.

However, again when I launch homebridge (whether I include the port or not), I get the above error.

I've also since tried npm install -g telnet, but I'm not sure if I should have done that. It doesn't seem to have made a difference.

lswee avatar Feb 11 '19 21:02 lswee

@stfnhmplr I've looked at this again. Using telnet 192.168.1.9 I can connect to my receiver. Sending PWON turns it on and PWSTANDBY turns it off. So it seems telnet is working on my Pi 3.

However, running homebridge with the config as mentioned (in my second my recent post above), I'm still getting the error as described in the most recent post above.

Edit: I've found these two posts which reference a similar error - https://github.com/mkozjak/node-telnet-client/issues/121 https://github.com/cgarwood/mpc-control/issues/12

I'm not sure if that'll be helpful? I'm a bit stumped now. Willing to help and test, but not sure where else to look with this one.

lswee avatar Feb 15 '19 23:02 lswee

@lswee Thanks, but there's no need for you to pick out those links. They don't help me. Installing other packages doesn't help either. Your config looks fine.

The default telnet port is 23, so you don't need to specify a port. Are you using another application on the network that might be blocking the connection? For example, an app for your smartphone that also uses Telnet to connect to your Denon.

Anyway, I pushed a few small changes, maybe they will help with troubleshooting. Please show the full log so I can better see when the error occurs. This should look something like this

[...]
[2019-2-17 10:31:20] [Denon LivingRoom] Initializing DenonMarantzAVR platform...
[2019-2-17 10:31:20] [Denon LivingRoom] Not connected to AVR. Trying again...
[2019-2-17 10:31:22] [Denon LivingRoom] Cannot connect
[2019-2-17 10:31:22] [Denon LivingRoom] lost connection to 192.168.1.11
[2019-2-17 10:31:22] [Denon LivingRoom] connected to 192.168.1.11
[2019-2-17 10:31:22] [Denon LivingRoom] connected to AVR (192.168.1.11)
[2019-2-17 10:31:22] [Denon LivingRoom] send command PW?
[2019-2-17 10:31:22] [Denon LivingRoom] send command MU?
[2019-2-17 10:31:22] [Denon LivingRoom] send command MV?
[2019-2-17 10:31:22] [Denon LivingRoom] send command Z2?
[2019-2-17 10:31:22] [Denon LivingRoom] send command Z2MU?
[2019-2-17 10:31:22] [Denon LivingRoom] send command Z2?
[2019-2-17 10:31:22] [Denon LivingRoom] Initializing platform accessory 'Denon LivingRoom Main Zone'...
[2019-2-17 10:31:22] [Denon LivingRoom] Initializing platform accessory 'Denon LivingRoom 2nd Zone'...
[2019-2-17 10:31:23] [Denon LivingRoom] received response: PWON
[2019-2-17 10:31:23] [Denon LivingRoom] received response: MUOFF
[2019-2-17 10:31:23] [Denon LivingRoom] received response: MV345
[...]

stfnhmplr avatar Feb 17 '19 09:02 stfnhmplr

Hey Stfnhmplr,

With the latest HomeKit offerings from Apple for TV support in the iOS 12.2 betas, would it be feasible to present Denon/Marantz AV amps as a TV, thereby allowing the switching of the device on/off and selecting a source all within the same HomeKit accessory?

danbridgland avatar Feb 17 '19 10:02 danbridgland

@stfnhmplr thank you very much.

Telnet works for me as expected: telnet 192.168.1.9

Trying 192.168.1.9... Connected to 192.168.1.9. Escape character is '^]'. PWON PWSTANDBY

But running homebridge doesn't:

[2/18/2019, 10:11:01 PM] --- [2/18/2019, 10:11:01 PM] [Speakers] Initializing DenonMarantzAVR platform... [2/18/2019, 10:11:01 PM] [Speakers] Not connected to AVR. Trying again... [2/18/2019, 10:11:02 PM] [Speakers] Cannot connect [2/18/2019, 10:11:02 PM] [Speakers] Cannot connect [2/18/2019, 10:11:03 PM] [Speakers] Not connected to AVR. Trying again... [2/18/2019, 10:11:03 PM] [Speakers] Cannot connect [2/18/2019, 10:11:04 PM] [Speakers] Cannot connect [2/18/2019, 10:11:05 PM] [Speakers] Not connected to AVR. Trying again... [2/18/2019, 10:11:05 PM] [Speakers] Cannot connect [2/18/2019, 10:11:06 PM] [Speakers] Cannot connect [2/18/2019, 10:11:06 PM] [Speakers] Cannot connect [2/18/2019, 10:11:07 PM] [Speakers] Not connected to AVR. Trying again... And that repeats over and over.

I've turned off my phone and rebooted everything, so don't think anything else will be taking up that communication channel and running telnet on its own does work and turns my Denon on/off etc.

In an above comment you can see that when I ran homebridge, the error referred to

/home/pi/.nvm/versions/node/v11.9.0/lib/node_modules/homebridge-denon-marantz-avr/node_modules/telnet-client/lib/index.js:76:16

Could this be a different version of telnet (or one with different settings/permissions) than the one it uses when just running telnet?

lswee avatar Feb 18 '19 22:02 lswee

Yeah, it's differnet but Telnet was just a test if your AVR is addressable. Did you already fetch the latest update? Which AVR model do you have?

stfnhmplr avatar Feb 24 '19 19:02 stfnhmplr

Yes, I just installed the latest version again, getting the same results with "Not connected to AVR. Trying again..." and "Cannot connect"

I have a Denon AVRX2500H

lswee avatar Feb 24 '19 19:02 lswee