bwssytems / ha-bridge

Home automation bridge that emulates a Philips Hue light system and can control other systems such as a Vera, Harmony Hub, Nest, MiLight bulbs or any other system that has an http/https/tcp/udp interface. This is a compact impl to run on small format computers. This is impl started from this project https://github.com/armzilla/amazon-echo-ha-bridge.
Apache License 2.0
1.45k stars 198 forks source link

Http request for Denon Reciever #619

Closed herbiems89 closed 7 years ago

herbiems89 commented 7 years ago

Sadly i´ve run into another problem. Im trying to set the volume of my Denon reciever via a http request. If i put this:

http://denon-ip/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/-30

into my browser it sets the volume to 50 (80-30 = 50).

This is just a simple test case, i actually want to control the volume via the DIM function and intensity.math, if i ever get this working probably. This is what my config looks like, does anybody see my error?

image

I played around with it a bit myself, tried changing the http verb, the map type, the target but nothing works :/

bwssytems commented 7 years ago

Best bet is to turn on logging and see if the request is being interpreted properly. See this link to turn on some debugging, https://github.com/bwssytems/ha-bridge#the-logs-tab, then add com.bwssystems.HABridge.plugins.http as well.

domier commented 7 years ago

Oh hey, I did this exact same thing! Haven't published the whole writeup yet, but here's that section:

It turns out that Marantz and Denon both use the same IP commands to control their receivers. there’s more documentation online about Denon than Marantz, but I was lucky enough to stumble upon some Denon info. I’ve included the major codes below, but you can always sniff more using wireshark and the web interface. (just navigate to the IP of your receiver in a browser to access it) If you are having trouble with this and are looking for a specific code just message me and I can try to look it up for you, assuming I still have my amp.

cmd0=PutZone_OnOff%2FON
cmd0=PutZone_OnOff%2FOFF
cmd0=PutSystem_OnStandby%2FSTANDBY
cmd0=PutMasterVolumeBtn/>
cmd0=PutMasterVolumeBtn/<
cmd0=PutMasterVolumeSet/## (where ## is the volume you want, *minus 80*)
cmd0=PutVolumeMute/on
cmd0=PutVolumeMute/off
cmd0=PutZone_InputFunction%2FSAT%2FCBL
cmd0=PutZone_InputFunction%2FDVD
cmd0=PutZone_InputFunction%2FMPLAY
cmd0=PutZone_InputFunction%2FPHONO
cmd0=PutZone_InputFunction%2FAUX1
cmd0=PutZone_InputFunction%2FCD
cmd0=PutZone_InputFunction%2FGAME
cmd0=PutZone_InputFunction%2FTV

Note: “%2F” and “/” are interchangeable

In order to get ha-bridge to send these commands properly, you need to set up an http device with the following arguments:

Target Item: http://your_receiver_address/MainZone/index.put.asp (where your_receiver_address is the IP of your receiver)

Http Body: The command exactly as listed above, with no quotes, braces, or brackets (except volume, see below)

Content Type: text/plain

Volume is special due to three complications:

So, to get the receiver to set the volume to the number you say, we need to use:

cmd0=PutMasterVolumeSet/${intensity.math(X/255*98-80)}

My ha-bridge currently runs 4.1.2, and it seems that it has some issues handling decimals that were fixed in later versions. Due to this it sometimes gets the number off by 1. I still need to upgrade it to check if this is resolved. Everything else works perfectly though so I’m hesitant to upgrade for fear of breaking things.

Let me know if you have more questions about your amp, might be able to help!

Edit: Added some information I'd left out the first time

domier commented 7 years ago

PS, I think your error is the "?" after .asp, I think it should be a "/", though I prefer to put the command into the body instead of the address.

bwssytems commented 7 years ago

any update?

crsnwby commented 7 years ago

domier im not sure what the instructions you wrote mean and what sections to add it to could you screen shot it please?

domier commented 7 years ago

Here's a screenshot of my setup, let me know if you have any questions!

Note that the "Target Item" field is identical for both the "on" and "dim" commands, but the "Http Body" includes the details of the command I'm actually sending.

I expanded the post above too, maybe it makes things a little clearer.

amp config

crsnwby commented 7 years ago

Thanks works a charm, just need to find a voice command for echo that doesnt change the echo volume instead...

domier commented 7 years ago

The trick is to remember that ha bridge treats it as a light, not a speaker. I use Google home, but commands like "dim the amp to 30" and "set the amp to 30" work for me.

audiofreak9 commented 7 years ago

@crsnwby I've had success setting my device name to "sound". So I'll say "Alexa, set the sound to 30".

crsnwby commented 7 years ago

sound or volume always seems to set the volume of the actual echo for me.

miketunes commented 5 years ago

Oh hey, I did this exact same thing! Haven't published the whole writeup yet, but here's that section:

It turns out that Marantz and Denon both use the same IP commands to control their receivers. there’s more documentation online about Denon than Marantz, but I was lucky enough to stumble upon some Denon info. I’ve included the major codes below, but you can always sniff more using wireshark and the web interface. (just navigate to the IP of your receiver in a browser to access it) If you are having trouble with this and are looking for a specific code just message me and I can try to look it up for you, assuming I still have my amp.

cmd0=PutZone_OnOff%2FON
cmd0=PutZone_OnOff%2FOFF
cmd0=PutSystem_OnStandby%2FSTANDBY
cmd0=PutMasterVolumeBtn/>
cmd0=PutMasterVolumeBtn/<
cmd0=PutMasterVolumeSet/## (where ## is the volume you want, *minus 80*)
cmd0=PutVolumeMute/on
cmd0=PutVolumeMute/off
cmd0=PutZone_InputFunction%2FSAT%2FCBL
cmd0=PutZone_InputFunction%2FDVD
cmd0=PutZone_InputFunction%2FMPLAY
cmd0=PutZone_InputFunction%2FPHONO
cmd0=PutZone_InputFunction%2FAUX1
cmd0=PutZone_InputFunction%2FCD
cmd0=PutZone_InputFunction%2FGAME
cmd0=PutZone_InputFunction%2FTV

Note: “%2F” and “/” are interchangeable

In order to get ha-bridge to send these commands properly, you need to set up an http device with the following arguments:

Target Item: http://your_receiver_address/MainZone/index.put.asp (where your_receiver_address is the IP of your receiver)

Http Body: The command exactly as listed above, with no quotes, braces, or brackets (except volume, see below)

Content Type: text/plain

Volume is special due to three complications:

  • ha-bridge will take the number you say and interpret it as a percent, and then output that percent of 255. For example, if you say 10 ha-bridge will pass 25.5 to the command
  • The volume on Marantz receivers go from 0-98
  • Marantz adds 80 to whatever value you pass it

So, to get the receiver to set the volume to the number you say, we need to use:

cmd0=PutMasterVolumeSet/${intensity.math(X/255*98-80)}

My ha-bridge currently runs 4.1.2, and it seems that it has some issues handling decimals that were fixed in later versions. Due to this it sometimes gets the number off by 1. I still need to upgrade it to check if this is resolved. Everything else works perfectly though so I’m hesitant to upgrade for fear of breaking things.

Let me know if you have more questions about your amp, might be able to help!

Edit: Added some information I'd left out the first time

Do you know the http command for the quick select? I can't seem to find it.

domier commented 5 years ago

Sure! I googled around a bit and came across this PDF that details the spec:

https://www.denon.ro/ro/product/homecinema/avreceiver/avrx1000?docname=AVRX1000_E300_PROTOCOL_1000__V04.pdf

(Note that Marantz and Denon use the same (or nearly identical) specs, and denon is often better documented)

It includes the codes for the quick select options, but I don't think my amp has those, nor do I use ha-bridge anymore since Google Assistant functionality was dropped so I can't test if for you.

Also Note! The memory commands include a space, which you probably will have to replace with something in your command, like %20 or something.

Hope this helps!

Edit: Looks like I can upload the file here as well, just in case denon ever takes in down. AVRX1000_E300_PROTOCOL_1000__V04.pdf

miketunes commented 5 years ago

Thanks,do you know how to translate the commands on that pdf to http commands? For instance I found this command will set the surround sound: http://192.168.1.67/MainZone/index.put.asp?cmd0=PutSurroundMode%2FMCH+STEREO&cmd1=aspMainZone_WebUpdateStatus%2F

On Tue, Nov 27, 2018 at 1:45 AM domier notifications@github.com wrote:

Sure! I googled around a bit and came across this PDF that details the spec:

https://www.denon.ro/ro/product/homecinema/avreceiver/avrx1000?docname=AVRX1000_E300_PROTOCOL_1000__V04.pdf

(Note that Marantz and Denon use the same (or nearly identical) specs, and denon is often better documented)

It includes the codes for the quick select options, but I don't think my amp has those, nor do I use ha-bridge anymore since Google Assistant functionality was dropped so I can't test if for you.

Also Note! The memory commands include a space, which you probably will have to replace with something in your command, like %20 or something.

Hope this helps! AVRX1000_E300_PROTOCOL_1000__V04.pdf https://github.com/bwssytems/ha-bridge/files/2618639/AVRX1000_E300_PROTOCOL_1000__V04.pdf

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bwssytems/ha-bridge/issues/619#issuecomment-441946959, or mute the thread https://github.com/notifications/unsubscribe-auth/ArOGgeeiicJ5mm7V3vR3PbPEDzK95caTks5uzN-agaJpZM4NP1gn .

domier commented 5 years ago

Take a look at the screenshot I posted further up the thread, it shows exactly how you need to format it in ha-bridge.

so, for instance for the stereo command you listed, the "http body" would be: cmd0=PutSurroundMode%2FMCH+STEREO

my educated guess as to hwo to trigger Quick1 would be: cmd0=PutZone_InputFunction%2FQUICK1

Not 10% sure that's it though. You asked about the http command, are you trying to do this in ha-bridge? or just send http commands from the command line or something?

adamyoung3 commented 5 years ago

this is really helpful! How would i send a command to turn on zone 2?

adamyoung3 commented 5 years ago

Figured out the http command for zone 2 on denon avr 2300. Adding &zone2... at end does the trick

I am now able to turn on zone 2 with a http button in smartthings and with an ios shortcut (siri). boom!

Zone 2 on http://192.168.1.95/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FON&ZoneName=ZONE2

Zone 2 off http://192.168.1.95/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FOFF&ZoneName=ZONE2

miketunes commented 5 years ago

Take a look at the screenshot I posted further up the thread, it shows exactly how you need to format it in ha-bridge.

so, for instance for the stereo command you listed, the "http body" would be: cmd0=PutSurroundMode%2FMCH+STEREO

my educated guess as to hwo to trigger Quick1 would be: cmd0=PutZone_InputFunction%2FQUICK1

Not 10% sure that's it though. You asked about the http command, are you trying to do this in ha-bridge? or just send http commands from the command line or something?

After giving up for awhile, I'm coming back to this. I tried PutZone_InputFunction%2FQUICK1` but it didn't work. Any idea how to find what the correct syntax is?

miketunes commented 5 years ago

Found a solution if anyone else is looking: http://[IP]:[PORT]/goform/formiPhoneAppDirect.xml?MSQUICK1 http://[IP]:[PORT]/goform/formiPhoneAppDirect.xml?MSQUICK2

adamyoung3 commented 5 years ago

Very cool and a totally different url structure. Curious how you figured this out but more so if you’ve got more commands working. Seems to work for me (no port number entered) I just don’t have quick select programmed to anything meaningful.

miketunes commented 5 years ago

Someone on reddit figured it out for me:https://www.reddit.com/r/homeassistant/comments/btpkna/denon_http_commands/

ghost commented 4 years ago

Hi all I have a Denon X2100W. WHere i can found all command list to this model ? Which i can use by type in web browser by http. I look in PDF but is it osther structure than by example in http. I want found command to play specific Favorite Station. Thanks for help