Denon AVR control?

Is anyone able to set the volume of the receiver via Rule Machine? Setting the volume from the device page works but it does not work when setVolume is called via Rule Machine 4.0 or 3.0. The logs do indicate that the rule machine has triggered the setVolume action but nothing changes. Any ideas?

Logs:
2019-08-05 12:21:43.512 am [info] Action: setVolume(60) on Denon AVR-3500H

2019-08-05 12:21:43.481 am [info]set denon volume: became True

2019-08-05 12:21:43.474 am [info] Denon AVR-3500H mediaInputSource(Input 2) = Input 2 [true]

I can set the volume with RM 4 on my Marantz that uses this driver.

@cstory777 If you don't mind, can you please show me your rule setup? I tried to make the rule as simple as this: Trigger Event: Denon AVR mediaInputSource = Input 2
Action : Set Volume to 60

This triggers the rule when I change the input but does not set the volume even though the log message says so.

Would appreciate any help!

Thanks!

In your rule select the action "Set Mode or Variables, Run Custom Action". Under "Select Which Action" choose "Run Custom Action". For "Select capability of action device" I just chose "switch" and then selected my Marantz as the device. For "Select custom command" choose "setVolume", "parameter type" should be "number" and "integer value" should be the volume you want to set it to. Then click "Done with this action". That's it.

1 Like

Thanks @cstory777 for the instructions! I replicated the same on my end and I couldn't make it work. The rule gets triggered when input changes to "Input 2" but the volume does not change.

I noticed that we can add a delay to the action so I tried setting a delay of 5 seconds and that worked luckily. I guess the setVolume command was being ignored by the receiver while it was working on changing the input.

That's very possible. My rule doesn't do anything else with my Maranatz other than lower the volume after 10pm. Glad the delay worked for you.

@mike.maxwell Looking back you introduced the Onkyo and Denon drivers in the 2.0 release in November 2018. It would be awesome to see Zone 2 support for both drivers. Any chance that is on your short list? I have both brand receivers and happy to work with you if you need a beta tester.

1 Like

Testing isn't the issue right now.

:slightly_frowning_face: maybe that means more cool stuff coming and not that you are slammed fixing broken things. :slight_smile:

@mike.maxwell Just an upvote for additional function, particularly powering on and off Zone 2.
Thanks much for this. It has helped me become a hubitat devotee and I'm about to by a second,

I have been using this driver with a Marantz AVR with great success. I have one problem I can't surmount. I can select the USB input as expected but there is now way to start playback.
While the basic play, pause and stop action would be nice the ability to send the telnet command from RM4 would ultimately be the most powerful way for users to implement what they want.

People have been asking for additional AVR features for > a year, and I just don't think Mike has time to get to it.

And he has clearly said he won't open source the existing driver so the community can extend it - so you are stuck with a driver that does what it does and there is small hope of major changes at this point.

You guys would be a lot better served by just finding/porting over a driver from SmartThings and be done with it. Then you could add whatever feature you think you want.

Yup. Unfortunately, it looks like that's the only way it's going to happen.

So... I have a driver that I wrote. After playing with it for a few weeks (a year ago), I abandoned it. I can understand why there is not an extended (multi-zone) driver.

Here is what I learned.

Sending single commands is easy. It is an IP command, and very straight forward to send the commands. In the driver, it is one line of code. Setting volume, power, source, etc... easy.

Getting status is easy. The Denon AVR updates the status of the AVR after every command sent. For basic commands, interrogation of the message is straightforward.

Controlling multiple zones is much more difficult. Let me explain; Let’s say you want the following setup: Zone 1 and Zone 2 with Stereo Audio and HDMI 1 as the source. You need to turn on the power, turn on zone 1, turn on zone 2, set the source on zone 1 and zone 2. Set the volume on both zones and then set the mode to stereo.

Timing is critical because if zone 1 is not ready and you set the volume, nothing happens. Additionally, every-time you send a command, a status message is sent. Depending on the command sent, it could be a short of very long status message. If you try to send a command and get interrupted by a status message, it can mess things up.

I tried building a state machine that would not continue until status was reported with success. That lead to a mess of repeat messages and many complicated setups taking 30+ seconds. 90% of the time, things worked well. But it took forever just to turn on the AVR in the right mode.

Additionally, sometimes the start state required handling things differently. Example; if zone 1 was on, and zone 2 was off and I wanted zone 2 on with stereo sound, I needed a different set of commands than if I was starting from cold steel.

Lastly, I found it possible to get into a “broken” state; where I was unsure of my “actual” state. This required a query of system state (multiple commands) and ultimately a reset (POR).

Ugh. Just thinking about it gives me a headache. I never got 100% stable, which means the wife never approved insertion into the main system.

I can publish the code for any interested parties. Just understand; its ugly.

2 Likes

I hacked around with the ST DenonAVR driver, which includes some Zone2 stuff. Seems to work for me (I use it with an x2000 and x3300 at home). The driver uses HTTP, which seems more reliable than the telnet interface that Hubitat uses by default.

It's at GitHub - ScottESanDiego/Hubitat_DenonAVR: Device Handler For Denon AVRs if you want to have a different starting point.

2 Likes

Yes I get it, it can't be made foolproof. I thought I'll check power on and wait for the Marantz to respond with a timeout, test how long that takes and if the time elapsed is the timeout value then the telnet is broken and requires an imitation. I stopped when the code was getting big and actual turn on time became too long.

Thanks Scotte, I'll take a look. I guess my New year resolution is to become more groovy.

Back when I was looking at this in ST my thought was to make a separate device for each "zone" to simplify the code. I started it and never finished it. Of course this puts more work on the rules side to do what you want to do ultimately. Eventually it was just easier to program my harmony for the routines I wanted and trigger those from HE.

Agreed; I also went down this path. Issues came up where a command affected both zones....

1 Like

Hi Thomas, I'd be interested in the 'ugly' code. I'd look to strip it down to just send "play NS9A". It's just the ability to send strings that I could use. If this is ok with you I would appreciate it.
Brian