LinuxMCE Forums

General => Installation issues => Topic started by: cafedumonde on June 30, 2016, 01:46:38 pm

Title: Denon Receiver Control over Ethernet
Post by: cafedumonde on June 30, 2016, 01:46:38 pm
Hi all,

My LMCE system had been dormant and living in a box for the past few years but life will now afford me an opportunity to rebuild. I have been reviewing the wiki and forums for updates and I am planning my new build. Thanks to all of the developers for keeping the project alive, and a special shout to Tschak for all of the great videos.

My new system will use a Denon AVR3310, which allows for both serial and ethernet control. Support for serial is well documented but it seems that ethernet might also be an option. Release note 28682 for 14.04 briefly mentions updates to IP control for Denon. What is the status of ethernet control for Denon? Is it plug & play? Is it better than control over RS-232? Please provide status or experiences.

Thanks,

CDM
Title: Re: Denon Receiver Control over Ethernet
Post by: phenigma on June 30, 2016, 08:09:48 pm
The denon CI series responds to the exact same commands over ethernet as it does over serial.  A few differences, your amp has to be set to not use 'low-power mode' or it will not respond to power on from the ethernet interface.  Use the AVR/AVC (Ethernet) device to control the denon over ethernet.  Your other option is to use HDMI-CEC control, which works great for me here.

J.
Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on August 13, 2016, 03:16:36 am

Phenegma & Community,

It turns out that my receiver is an AVR-2307, which does not support Ethernet or CEC. The only option is RS-232. I have connected the receiver to my hybrid using a PCI serial port card with two ports and a db-9 cable. I do not know the pinout of the cable though there are male and female connectors, matching the genders on the equipment.

The wiki page, which is old, describes that this is plug&play. Trying the setup wizard, it is not detected on either port.

Trying to add the receiver manually, I selected Wizard > AV Equipment > Add Device and picked the AVR/AVC (Ethernet) template. It shows two serial ports, ttyS4 and ttyS5. I am ASSUMING that these correspond to the two on my PCI card. I tried both but still no luck after running AVWizard again to assign the inputs. Sending the "off" command through the Admin tool also does not work.

My normal troubleshooting approach with serial devices is to set up a dumb terminal on one side of the connection, send commands, and see the responses. This is the path I'll go down barring any advice. For starters it would be good to know if the use null modem connectors is typically required. Also, are there linux config files to validate the /dev/tty entries associated with my PCI card?

Thanks,

CDM
Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on August 13, 2016, 02:21:15 pm

I have had some success this morning. I have tested both serial ports using minicom, connecting them to each other and passing characters both ways with two terminal sessions. Connecting one port to the receiver, I am also able to see status change reports when I press buttons on the ir remote. So, I know which serial port I am on and I know that it is working. I am also receiving characters from the AVR-2307. However, typed characters are not echoed and the receiver does not respond to commands.

Connecting the serial port to the terminal and running AVWizard, I also do not see any characters coming out of the port.

Is this device really plug & play? Is there a detection script? If so, where is it? Is there a way I can trigger it manually?

Also, if there is not a script, how can I add the device manually?

CDM
Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on August 13, 2016, 02:58:21 pm

More success but no prize just yet....

I found the detection script which appears to be /usr/pluto/pnp/20_DenonReceiver.sh

Looking at the script, I modified the detection command in order to run from the command line:

Code: [Select]

/usr/pluto/bin/TestSerialPort -p /dev/ttyS5 -P N81 -b 9600 -t "PWSTANDBY\r\s500mPWON\r" -i 1 -s "MON\r"


This works!!! The receiver power cycles as expected.

I now know the following:

1. the serial ports on the PCI card work
2. the serial interface on the receiver works
3. they are communicating in both directions
4. LMCE has a detection script for the Denon over RS-232

However, AVWizard does not seem to trigger this script. Is there another way to trigger? Will it trigger automatically if I wait long enough?

CDM


Title: Re: Denon Receiver Control over Ethernet
Post by: Marie.O on August 13, 2016, 03:42:57 pm
It takes a while.

Also, make sure that the PCI card ports got detected. They should show up in web admin.

A tip from the trenches: After your stuff got detected, go ahead and disable serial detection for the media director. Otherwise, LinuxMCE does sometimes mix up stuff.
Title: Re: Denon Receiver Control over Ethernet
Post by: darkwizard864 on August 13, 2016, 03:53:03 pm
http://www2.aerne.com/Public/dok-sw.nsf/0c6187bc750a16fcc1256e3c005a9740/8dffa5c383bd8897c125740900424b3d/$FILE/AVR2307_AVC1930_PROTOCOL_V4%5B2%5D.8.0.pdf
Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on August 13, 2016, 04:13:21 pm
Posde,

It looks like LMCE has registered the serial ports. Looking in WebAdmin HOME > MyDevices > CORE , the Available Serial Ports box shows both ports and one that I think is my USB UIRT:

/dev/ttyS4,/dev/ttyS5,pci0000:00/0000:00:1d.0+1.2

Does reloading the router trigger detection? Is there a log file I can look at?

--------------------------

Updating the post...

I tried to connect to the port again using minicom. LMCE is running, with a video paused. I get the fiollowing when trying to connect to /dev/ttyS5..

Code: [Select]

Device /dev/ttyS5 is locked.
root@dcerouter:~# ls -la /dev/ttyS5
crw-rw---- 1 root dialout 4, 69 Aug 13 07:46 /dev/ttyS5
root@dcerouter:~#


Not sure if this is good or bad. Does this mean that LMCE has locked the port? Otherwise could this be a file permission issue and LMCE is locked out? Again, an LMCE log file might give a clue.

CDM
Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on August 13, 2016, 09:32:22 pm

More progress but still no prize...

I modified the Denon detection script /usr/pluto/pnp/20_DenonReceiver.sh to create a tool for testing the detection. I found that it only works intermittently on my machine. The detection depends on the contents of "$?" in the script after sending a command over the serial port to the Denon.

The test script, DenonPNPTest.sh

Code: [Select]

#!/bin/bash                                                                                                                             

echo "Denon Detection script queue $2"
echo "Arg1=$1 Arg2=$2 Arg3=$3 Arg4=$4"
/usr/pluto/bin/TestSerialPort -p $3 -P N81 -b 9600 -t "PWSTANDBY\r\s500mPWON\r" -i 1 -s "MON\r"
if [[ "$?" -ne 0 ]]; then
echo "It's not a Denon Receiver Resp=$?"
# /usr/pluto/bin/MessageSend dcerouter -r 0 $1 1 806 224 $2 13 "$4" 44 0                                                               
else
echo "It is a Denon Receiver Resp=$?"
# /usr/pluto/bin/MessageSend dcerouter -r 0 $1 1 806 224 $2 13 "$4" 44 71                                                               
fi


 And the output of several runs, with lines added in between for readability....

Code: [Select]

root@dcerouter:/usr/pluto/pnp# ./DenonPNPTest.sh foo foo /dev/ttyS5 foo
Denon Detection script queue foo
Arg1=foo Arg2=foo Arg3=/dev/ttyS5 Arg4=foo
It's not a Denon Receiver Resp=!!0

root@dcerouter:/usr/pluto/pnp# !!
./DenonPNPTest.sh foo foo /dev/ttyS5 foo
Denon Detection script queue foo
Arg1=foo Arg2=foo Arg3=/dev/ttyS5 Arg4=foo
PWSTANDBY\rZMOFF\rZ2OFF\rPWON\rZMON\rZ2ON\r
It is a Denon Receiver Resp=1

root@dcerouter:/usr/pluto/pnp# !!
./DenonPNPTest.sh foo foo /dev/ttyS5 foo
Denon Detection script queue foo
Arg1=foo Arg2=foo Arg3=/dev/ttyS5 Arg4=foo
It's not a Denon Receiver Resp=0

root@dcerouter:/usr/pluto/pnp# !!
./DenonPNPTest.sh foo foo /dev/ttyS5 foo
Denon Detection script queue foo
Arg1=foo Arg2=foo Arg3=/dev/ttyS5 Arg4=foo
It's not a Denon Receiver Resp=0

root@dcerouter:/usr/pluto/pnp# !!
./DenonPNPTest.sh foo foo /dev/ttyS5 foo
Denon Detection script queue foo
Arg1=foo Arg2=foo Arg3=/dev/ttyS5 Arg4=foo
It's not a Denon Receiver Resp=0

root@dcerouter:/usr/pluto/pnp#


Could it be that the command is somehow taking too long to populate "$?"  ???

I am not a bash scripter but could I just capture the string returned directly from the serial port test and decide the detection on that? It is frustrating that "$?" does not work reliably given that it is a standard bash scripting feature.

Feedback from developers would be appreciated. Thanks.

CDM
Title: Re: Denon Receiver Control over Ethernet
Post by: phenigma on August 13, 2016, 10:41:18 pm
You're issue $? incorrectly.  I'm on my phone an really unable to respond more than that.  I'll try to elaborate whenever I get home.

Sent from my Nexus 5 using Tapatalk

Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on August 17, 2016, 01:35:22 am

Phenegma,

Please follow up on your comment regarding $?. Please check the file for this script in your installation. I did not change this.

After many days, the detection script has not run. Is there a way to trigger?

CDM
Title: Re: Denon Receiver Control over Ethernet
Post by: phenigma on August 17, 2016, 01:54:41 am
As soon as I have a moment to I will have a look.

Sent from my Nexus 5 using Tapatalk

Title: Re: Denon Receiver Control over Ethernet
Post by: phenigma on August 29, 2016, 02:47:31 am
Phenegma,

Please follow up on your comment regarding $?. Please check the file for this script in your installation. I did not change this.

After many days, the detection script has not run. Is there a way to trigger?

CDM
The PNP scripts will run after a router reload on each MD that has an un-allocated (unused) serial port.

First thing I see now that I have some time is that you seem to have added the "Resp=$?" portion to the echo command, it will not give you the output you are expecting, but the output of the IF statement result.  The "$?" returns the exit code of the last command executed. 

Second thing is "PWSTANDBY\rZMOFF\rZ2OFF\rPWON\rZMON\rZ2ON\r", which shows in your testing output is not the same as what the script you posted is sending, you must be testing with a different script.  This script should be short and only enough to confirm that it responds to commands, adding in zone power off/on is adding a lot of extra commands that are not necessary for detecting the receiver.

You also indicate that the script works 'sometimes' but not others.  This is usually a result of serial based devices that decide not to respond, they can get 'confused' usually based on some bad codes or text sent to its' port.  Some serial devices are really susceptible to this.  If the script works 'sometimes' I would suggest that the exact sequence of commands could be altered or more pause/delay after each command.  The receiver needs to have time to respond prior to another command being sent.

The Denon detection script has worked for me here on my Denon 3311CI.  That was when I first purchased the amp, since then it does not need to be re-detected.  Honestly my best recommendation is to add the device manually if the detection script isn't doing its' thing properly.  After that it's never required again.

J.
Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on August 30, 2016, 02:15:10 am

Phenigma,

Thanks very much for looking into this. I will compare my carefully compare my test script to the original in order to appreciate what you have highlighted. My skills are very rusty butI will play with the script some more, and try to adjust the timing of the commands. I would really like to add the device automatically in order to ensure that it is done without error.

Looking at the device templates in WebAdmin, Developers > Device Templates, two are listed: AVC-A1SRA (RS-232) and AVR/AVC series (ethernet). Which should I use? I want to use an AVR device with RS-232.  Is there a device template number?

Sorry to be dense. Obviously if all of the RS-232 commands are the same then it won't matter.

Thanks again.

CDM







Title: Re: Denon Receiver Control over Ethernet
Post by: Marie.O on August 31, 2016, 10:44:00 am
In theory both should work. The RS-232 is the original one, whereas the Ethernet one has been created later.
Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on September 01, 2016, 02:05:15 am

Got it. I will report back this weekend. Thanks Posde.
Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on September 05, 2016, 01:19:06 am

I tried to manually install my Denon receiver this weekend, so far without success. I added the device to my core manually and configured it using the setup wizard. All of the parameters that I selected appear in the device instance in WebAdmin.

Trying to troubleshoot, I can send commands from WebAdmin by going to Devices -> AV Equipment and selecting AV Properties for the device instance. All of the commands shown in the device template appear, with the content fields blank. Clicking on "Test Code" for any command yields the error: "ERROR: Specified command had empty content." Putting in the ASCII commands from the Denon manual, a pop up appears that says: The command was sent to device #1" but nothing happens.

I have two theories:

1. No codes are inherited from the device template.
2. The SendMessage command sent to the router is not finding the serial port for some reason.

Again, the following works every time, power cycling the device:

Code: [Select]

/usr/pluto/bin/TestSerialPort -p /dev/ttyS5 -P N81 -b 9600 -t "PWSTANDBY\r\s500mPWON\r" -i 1 -s "MON\r"


Poking around in DCRRouter.log, there are messages related to my receiver instance. I think that these are in response to my attempts to send commands from WebAdmin but I don't really know what they mean. Here are a few lines:

Code: [Select]
08      09/04/16 18:10:23.561           Received Message from 20 (^[[36;1mOnScreen Orbiter / Living Room/Family Room^[[0m) to 66 (^[[36;1mAVC-A1SRA (RS232) / Living Room/Family Room^[[0m), type 1 id 193 \
Command:^[[35;1mOff^[[0m, retry none, parameters: <0xb60d4b40>
08      09/04/16 18:10:23.561           Received Message from 20 (^[[36;1mOnScreen Orbiter / Living Room/Family Room^[[0m) to 66 (^[[36;1mAVC-A1SRA (RS232) / Living Room/Family Room^[[0m), type 1 id 193 \
Command:^[[35;1mOff^[[0m, retry none, parameters: <0xb60d4b40>
05      09/04/16 18:10:23.561           ^[[33;1mThe target device 19 (routed to 19) has not registered.^[[0m <0xb60d4b40>


Clues would be welcome. If I need to reinstall the device, or my entire installation, in order to start clean I would be happy to do so.

Thanks,

CDM

Title: Re: Denon Receiver Control over Ethernet (& RS-232)
Post by: cafedumonde on September 05, 2016, 05:26:01 am
Progress. The command data needs to be in Ruby format. The off command, for example is:<$"PWSTANDBY\r"$>. I added this to the device template (#71) by opening the template and then "Edit Ruby Codes". After entering the command, the "send command to device" option works for the commands that I have populated. I also added the serial port of my instance, /dev/ttyS5,  to the Default Value fiels for the COM Port. So, two changes to the device template. Should this be necessary?

This means that the messages are getting to the serial port through the router. Phew.

It seems that the codes are missing from the device template in the latest distribution.

CDM
Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on September 07, 2016, 02:19:14 am


Lots of progress. Now that I can send commands to the receiver, I am populating the template. The only glitch has to do with the MUTE command. The protocol in the manuals that I have, for the 2310 and 3312, both provide discrete commands for this function, that is, separate commands for on and off. The device template however is built for a toggle command. This is consistent with button on the remote, and I also have a pronto code for this function. I see four solutions:

1: Change the template to accommodate discrete RS-232 commands, though this does not seem possible with the command options in WebAdmin.

2. Find a way to send the pronto code over RS-232.

3. Find an RS232  toggle command for mute that is not in the manuals that I have.

4. Embed an if statement in the ruby code for the command that queries the mute status using <$"MU?\n"$> and then sends the correct discrete command.

If anyone has a Denon receiver working with RS-232 I would be interested to know what you have done for MUTE.

Thanks,

CDM
Title: Re: Denon Receiver Control over Ethernet
Post by: phenigma on September 07, 2016, 02:25:56 am
Why are you building a new denon template?  We have working serial and Ethernet templates. 

Sent from my Nexus 5 using Tapatalk

Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on September 07, 2016, 03:12:58 am

See my posting just prior to the last. The codes are not populated in my installation. I think this is why I originally believed that RS-232 was not working. No data was being sent.

I am not saying that the populated template isn't in the repo. Its just that it's not coming over when I run the install script, and I have installed twice in the past month. I did so the second time because my myth database password somehow got screwed up for mythfilldatabase.

Do you have a toggle MUTE ruby/RS232 command?

CDM
Title: Re: Denon Receiver Control over Ethernet
Post by: phenigma on September 07, 2016, 03:48:23 am
Rather than rebuilding the template it should be determined why it's not retrieving.

Sent from my Nexus 5 using Tapatalk

Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on September 07, 2016, 04:18:17 am

I am happy to dig. Could you suggest commands to query the database directly to see if the data is there? Perhaps for a few devices?

CDM
Title: Re: Denon Receiver Control over Ethernet
Post by: phenigma on September 07, 2016, 04:53:16 am
Any time you edit a DT and choose to edit ruby codes the associated commands are fetched from the schema server.  IR codes are also updated when certain packages are updated.  I forget which ones at the moment.  Try a few dts and see if you get codes for any of them

Sent from my Nexus 5 using Tapatalk

Title: Re: Denon Receiver Control over Ethernet
Post by: Marie.O on September 07, 2016, 01:33:42 pm
I just checked if code retrieval is working by adding a Pioneer Kuro Plasma to my system. All data was received. Maybe rule #1 wasn't followed ;)
Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on September 08, 2016, 02:02:34 am

Posde,

I followed the directions on the wiki here: http://wiki.linuxmce.org/index.php/Installing_1404

Step #1 says: "Install Trusty Tahr desktop and update it. (download Kubuntu 14.04 desktop release from http://cdimage.ubuntu.com/kubuntu/releases/14.04/release/kubuntu-14.04-desktop-i386.iso"

The update instructions that I followed are at the bottom of the wiki page, specifically:

Code: [Select]
sudo -i
apt-get update
apt-get dist-upgrade

Please confirm. The install is functional in all other regards. Clearly some device templates are working fine, like the USB-UIRT. Checking device #1779, for Pioneer Plasmas, the device template shows that no commands are implemented in WebAdmin. I went to Developers -> Device Templates, selected 1779, and clicked on "Edit Ruby Codes." Do you see something different?

I am so sorry to be a noob. It seems I am taking a difficult path to getting my install up but I *am* getting there and learning a lot. LMCE is awesome. Thanks to Phenigma and Posde for patient guidance.

CDM
Title: Re: Denon Receiver Control over Ethernet
Post by: Marie.O on September 08, 2016, 11:15:03 am
The way you install looks good.

With rule #1 I only mean being patient. The download of the "IR" codes from schema to your system takes a while. During this time, all you see is: Waiting for data. If you cancel that, no codes will be transferred.
Title: Re: Denon Receiver Control over Ethernet
Post by: cafedumonde on September 09, 2016, 12:27:55 am
Does the download happen during the setup wizard? I thought that I waited until the notification window disappeared but I will wait longer next time.

Is there a script for this that I can trigger?

CDM
Title: Re: Denon Receiver Control over Ethernet
Post by: phenigma on September 09, 2016, 12:42:39 am
Well, I tried adding the Pioneer kuro and I'm not getting any codes here.  Shit.

Sent from my Nexus 5 using Tapatalk

Title: Re: Denon Receiver Control over Ethernet
Post by: Marie.O on September 09, 2016, 06:40:48 am
Very strange. I'll dig into it.
Title: Re: Denon Receiver Control over Ethernet
Post by: Marie.O on September 10, 2016, 11:56:24 am
Please try again.
Title: Re: Denon Receiver Control over Ethernet
Post by: phenigma on September 10, 2016, 09:48:48 pm
That's got it.  Thanks for checking into that posde!

J.