Possible to check for received command from Denon receiver?

I have the Denon Marantz binding configured but I’m struggling to accomplish my goal. I want to check for a certain command sent to the Denon, and then execute a script to send a different command. I’m not sure how to check for a received command. Specifically, I’m not sure which item will receive the commands, I guess.

Things I’ve tried…

Checking for a command sent to the general#command channel (my item linked to that channel is denon_command):

configuration: {}
triggers:
  - id: "4"
    configuration:
      itemName: denon_command
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      itemName: denon_command
      command: MV81
    type: core.ItemCommandAction
  - inputs: {}
    id: "3"
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: logInfo("Denon command received= " + receivedCommand.toString())
    type: script.ScriptAction

Checking for a command sent to the Denon equipment item:

configuration: {}
triggers:
  - id: "2"
    configuration:
      itemName: Denon_AVRX3700H
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      itemName: denon_command
      command: MV81
    type: core.ItemCommandAction
  - inputs: {}
    id: "3"
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: logInfo("Denon command received= " + receivedCommand.toString())
    type: script.ScriptAction

Neither of these rules get fired when I try sending commands to the receiver with the remote. Could anyone provide some guidance?

That’s a write-only channel, per the documentation.

image

I suspect that this is the same for most AV receivers. I use Logitech Harmony Hubs, and they also don’t broadcast commands from remote controls, so you can’t trigger on button pushes.

What exactly are you trying to do? I assume more than posting a message to your openHAB log.

Yes I have Harmony Hub remotes too. The default volume increment for Denons is 0.5db. I want to change volume by 1db (and also 5db) when I press a button on the Harmony.

Then why not use the volume channel?

image

I think the tricky thing you’ll run into is if the Harmony Hub and openHAB are sending volume commands at the same time. It may become very difficult to control with any finesse.

I want to control the Denon with my Harmony remote. When I press the volume button on the remote I want to send a command to change volume by 1db. I know how to send the command. What I can’t figure out is how to trigger that action when I press the button on my Harmony remote.

Well, you started out by asking about the Denon Marantz binding.

As I said earlier:

Right now, I assume that your Harmony Hub is sending commands directly to your Denon receiver. So per my last post, you could monitor the Denon’s volume and react to it, but that would be tricky for a variety of reasons. As far as I’m aware, there’s nothing you can monitor to detect button presses from Denon or Harmony Hub.

The alternative would be for your Harmony Hub to send volume commands directly to openHAB, so that openHab can send two volume commands to your Denon receiver. I don’t know how you would do that.

1 Like

Depending on the use case, latency may be a problem. The scheduler in my Denon receiver does not seem to prioritize the Telnet interface.

Following up in case this is useful to anyone else, or in case anyone can suggest a better way.

Since the following seem to be true:

  • not possible to read a command sent to a Denon AVR via Denon Marantz Binding
  • not possible to read a command sent by Harmony Hub via Logitech Harmony Bindy
  • I can’t find a way to map a Harmony remote button to the Hue Emulation device (see my post on that thread)
  • I so far haven’t been able to get Emulated Roku running on Home Assistant (this would be the answer if I could get it to work, although I prefer OH overall on my Mac)

… I’ve resorted to using the following rule in OH to produce a less than elegant, but functional, 2.0db change with each Volume +/- button press on my remote:

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: Denon_AVRX3700H_MainZone_Volume
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: >-
        val Number step = 1.5  // Adds 1.5db to the default 0.5db command to
        produce a 2.0db change

        var prevVol = previousState

        var newVol = Denon_AVRX3700H_MainZone_Volume.state

        var Number isOddEven = 0.0
          
        logInfo("DenonVol1db", "IN:  prevVol=" + prevVol + ",  newVol=" + newVol + ",  decimal=" + newVol.toString().indexOf(".").toString())


        if ((newVol.toString().indexOf(".")) > 0) {  // New volume is a half step (xx.5) so we should +/- 1.5db
            if (Float::parseFloat(newVol.toString().substring(newVol.toString().indexOf(".")+1)) > 0 ) {
              if ((newVol as Number) > (prevVol as Number)) {
                  Denon_AVRX3700H_MainZone_Volume.sendCommand((newVol as Number) + step)
              } else {
                  Denon_AVRX3700H_MainZone_Volume.sendCommand((newVol as Number) - step)
              }
            }
        } else {
            // If volume somehow becomes an odd whole number (eg. 43.0db) bump it to the next even whole number (eg. 44.0db)
            isOddEven = (newVol as Number)/2
            //logInfo("DenonVol1db", "isOddEven=" + isOddEven.toString())
            if (Float::parseFloat(isOddEven.toString().substring(isOddEven.toString().indexOf(".")+1)) > 0 ) {
              if ((newVol as Number) > (prevVol as Number)) {
                  Denon_AVRX3700H_MainZone_Volume.sendCommand((newVol as Number) + 1)
              } else {
                  Denon_AVRX3700H_MainZone_Volume.sendCommand((newVol as Number) - 1)
              }
            }
        }


        Thread::sleep(100)


        logInfo("DenonVol1db", "OUT:  prevVol=" + prevVol + ",  newVol=" + newVol)
    type: script.ScriptAction

It’s fast enough that you can barely see the xx.5 half-step displayed on screen before it jumps to the next even whole number. It’s a compromise to having the ability to map buttons on my remote to execute 1db and 5db volume changes.

I’ve posted on remotecentral.com requesting discrete IR hex codes for 1db and/or 5db volume change for Denon, since adding that to my Harmony would be much cleaner than using this automation (if they exist). But for now, this is better than pressing the volume buttons repeatedly for indiscernible 0.5db steps.

I have made a fix that works from both harmony and CEC remote: (DSL rule)
Post in thread ‘Volume increments/speed on Denon receivers’ Question - Volume increments/speed on Denon receivers | AVForums