Vera (Luup) Control of Denon A/V receiver over serial/ethernet

Thats works fine.

Looked like i was close to the correct code… Atleast is now easier for me to understand the code and how it must be read the xml files and use lua to in my scenes

luup.call_action("urn:denon-com:serviceId:Receiver1","SetVolumeTarget",{newTargetValue = "30"}, 16)
Does the volume set to specific level :slight_smile:

It looks like the plugin needs a little work. I have a Denon 3808ci, and I seem to remember that the Micasaverde definition has enough inputs to (just) cover the inputs on my receiver, but briefly looking at the newer Denon manuals I don’t think there are nearly enough inputs (The newer Denon’s seem have to inputs for all sorts of internet streaming services too).

I’m certainly happy to change the code if I can figure out what the correct behavior should be. Any kick in the right direction is also appreciated. I would also really like to improve on the device GUI element in the UI5 dashboard and make more controls accessible from there, and if possible, have the sources named correctly. The plugin “knows” the right names, I just don’t think there is anyway to update the display code with that information.

So the next questions is how does one get access to the app store to edit a plugin? My current MIOS account does not work.

@zoot1612, what plugin are you trying to edit? I think mcv gave me control of the denon plugin and so you might not be able to edit it. If you commit changes to svn and send me a pm I am happy to add them to the plugin and request approval from mcv.

That whole thing is a little involved of course… but I hope the added convenience for non-technical end users makes it worth it.

Well after a hard day of work i just did some code making/ debugging for my homecomming scene.
First is was only a

return luup.is_night()

Now its a bit “changed”
Because calling other scenes from within a other scene is not really working in the way i want. I did remove my small pure code scene and merge it in 1.
The result:

[code]
if luup.is_night() then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”,“SetLoadLevelTarget”, {newTargetValue = “100”}, 11)
luup.call_action(“urn:upnp-org:serviceId:Dimming1”,“SetLoadLevelTarget”, {newTargetValue = “45”}, 4)

end
luup.call_action(“urn:micasaverde-com:serviceId:DiscretePower1”,“On”,{},16)
luup.sleep(2000)
luup.call_action(“urn:micasaverde-com:serviceId:InputSelection1”,“Input4”,{}, 16)
luup.sleep(200)
luup.call_action(“urn:micasaverde-com:serviceId:InputSelection1”,“Input5”,{}, 16)
luup.sleep(2000)
luup.call_action(“urn:denon-com:serviceId:Receiver1”,“SetVolumeTarget”,{newTargetValue = “39”}, 16)[/code]
In short
When its dark outside it turn on 2 lights.
Afther that statement it turns on my Denon, waits 2 seconds (needed to powerup the denon)
Changes the input to something else then the tuner…
Short wait which is also needed :wink:
Turn (back) to tuner input. [sup]1[/sup]
And finally turn up the volume a bit :wink:

[sup]1: When the receiver is allready on Tuner input and you send this command it switches band between AM/ FM[/sup]

@radarengineer

Can a UI5 branch of the Denon plugin be created in SVN using the code from the app store?

On/Off, Volume, and a few of the inputs work - However, the inputs seem to be fixed to a different model so it only works on a few inputs that match my 2112ci. Is there anything to edit to match up the inputs to this model?

Works on 2112ci:
on/off
displays correct current input name
mute/unmuite
vol up/down
dvd
net/usb
tuner
cd
v.aux
ipod (switches to net usb should switch to dock I think)

doesn’t work:
sat/cbl (sat)
game1
game2
dock
bd
tv

doesn’t apply:
boxee
phono
xm

Will do. Happy to try/test/hack anything. Seems that it would be good to have a denon model file with preset cmds appropriate for different Denon models. My 2112ci has a different set of inputs for example.

Is there any documentation on Denon’s network API?

Search for Command3808 on google for a codebase which is also used in this plugin. The L_DenonReceiver1.lua is basicly the source of command3808 transformed into a “vera file”
If you need some documentation search for AVR-3808CISerialProtocol and you should and up with a pdf which has also a version number on the end of it like “AVR-3808CISerialProtocol_Ver5.2.0a” In this document are all the telnet commands and responses…

[quote=“The-Source, post:89, topic:167791”]Search for Command3808 on google for a codebase which is also used in this plugin. The L_DenonReceiver1.lua is basicly the source of command3808 transformed into a “vera file”
If you need some documentation search for AVR-3808CISerialProtocol and you should and up with a pdf which has also a version number on the end of it like “AVR-3808CISerialProtocol_Ver5.2.0a” In this document are all the telnet commands and responses…[/quote]

Interestingly, while the vera plugin works but just doesn’t have the right inputs/etc to match a different model than 3808 (ie 2112 or 1912 etc) the Command3808 program won’t communicate with my 2112ci at all. However, snooping around the 2112ci Webui I was able to dig up the javascript that it uses to configure the UI for each specific model. See attachment txt

below is where it sets up the input list based on which model its trying to configure the UI for:

//  Sourceアイコンの追加
if( selectSource == "NET/USB" ) {
	selectSource = data.getValue("NetFuncSelect");
	if( selectSource == "IPOD DIRECT" || selectSource == "USB DIRECT" ) {
		selectSource = "USB/IPOD";
	}
}
if((parseInt( data.getValue( "ModelId" ) ) == 1) || // 19XX
   (parseInt( data.getValue( "ModelId" ) ) == 2)) { // 21XX
	appendSource($("#funcPlayer .RFuncIcon"), del, source, rename, ["BD" , "DVD" , "CD" , "DOCK"], selectSource, false);
	appendSource($("#funcVideo .RFuncIcon"), del, source, rename, ["SAT/CBL" , "TV" , "GAME" , "GAME2" , "V.AUX"], selectSource, false);
	
}else if(parseInt( data.getValue( "ModelId" ) ) == 3){ // 23XX
	appendSource($("#funcPlayer .RFuncIcon"), del, source, rename, ["BD" , "DVD" , "CD"  , "DOCK"], selectSource, false);
	appendSource($("#funcVideo .RFuncIcon"), del, source, rename, ["SAT/CBL" , "TV" , "GAME", "GAME2" , "DVR" , "V.AUX"], selectSource, false);
	
}else if(parseInt( data.getValue( "ModelId" ) ) == 4){ // 33XX
	appendSource($("#funcPlayer .RFuncIcon"), del, source, rename, ["BD" , "DVD" , "CD" , "PHONO" , "DOCK"], selectSource, false);
	appendSource($("#funcVideo .RFuncIcon"), del, source, rename, ["SAT/CBL" , "TV" , "GAME", "GAME2" , "DVR" , "V.AUX"], selectSource, false);
	
}else if(parseInt( data.getValue( "ModelId" ) ) == 5){ // NR160X
	appendSource($("#funcPlayer .RFuncIcon"), del, source, rename, ["BD" , "DVD" , "CD" , "M-XPORT"], selectSource, false);
	appendSource($("#funcVideo .RFuncIcon"), del, source, rename, ["SAT" , "TV" , "GAME"], selectSource, false);
	
}else if(parseInt( data.getValue( "ModelId" ) ) == 6){ // SR500X
	appendSource($("#funcPlayer .RFuncIcon"), del, source, rename, ["BD" , "DVD" , "CD" , "M-XPORT" ], selectSource, false);

// appendSource($(“#funcVideo .RFuncIcon”), del, source, rename, [“SAT” , “TV” , “VCR” , “GAME” , “AUX”], selectSource, false);
appendSource($(“#funcVideo .RFuncIcon”), del, source, rename, [“SAT” , “TV” , “VCR” , “GAME” , “AUX1”], selectSource, false);

}else if(parseInt( data.getValue( "ModelId" ) ) == 7){ // SR600X
	appendSource($("#funcPlayer .RFuncIcon"), del, source, rename, ["BD" , "DVD" , "CD" , "PHONO", "M-XPORT" ], selectSource, false);

// appendSource($(“#funcVideo .RFuncIcon”), del, source, rename, [“SAT” , “TV” , “VCR” , “GAME” , “AUX”, “AUX2”], selectSource, false);
appendSource($(“#funcVideo .RFuncIcon”), del, source, rename, [“SAT” , “TV” , “VCR” , “GAME” , “AUX1”, “AUX2”], selectSource, false);
}

var list;
if (data.getValue("SalesArea") == "0") {	// USA
	list = ["NET/USB", "Favorites", "Internet Radio" , "Media Server", "USB/iPod"  , "Flickr" , "Pandora" , "Napster" , "Rhapsody" ];
}else if(data.getValue("SalesArea") == "1") {	// EUR
	if(data.getValue("LastfmDisplay") == "TRUE") {	// Last FM Display
		list = ["NET/USB", "Favorites", "Internet Radio" , "Media Server", "USB/iPod"  , "Flickr" , "Last. fm" , "Napster" ];
	}else{
		list = ["NET/USB", "Favorites", "Internet Radio" , "Media Server", "USB/iPod"  , "Flickr" , "Napster" ];
	}
} else {
	list = ["NET/USB", "Favorites", "Internet Radio" , "Media Server", "USB/iPod"  , "Flickr" ];
}

Cool thing. I also located the 2112/1912 protocol documentation http://www.procinema.hu/dokumentumok/denon-avr-1912-protokoll.pdf. It’s very similar to the 3808 infact it looks like the same protocol, with differences for the delta in features/inputs/zones. If we can get the specs on variety of Denon models then it would be great to let the user select the model and offer the appropriate cmds based on the model.

Would be happy to hack the plugin. How (and where) do I d/l the plug-in for editing, then reinstall?

Thx
SK

@santakrooz
I think currently Radarengineer is the only one with access to the UI5 code so you have to do as you have suggested (edit and upload).

Also If you did not name your device it should be named with model plus main zone e.g. AVR-3808EUR - Lounge so no need to ask the user, it should be able to be done automatically.

@santakrooz
Can you look at the javascript code for data.getValue? I would like to see how the information for ModelId and SalesArea is been retrieved.

cheers

Zoot

@santakrooz and @zoot1612, I will be uploading the code to svn soon.

One of the big issues with zones that was mentioned earlier in this thread is how to handle new receivers with more inputs than are supported in urn:micasaverde-com:serviceId:InputSelection1. I think we can add a SetInputTarget in urn:denon-com:serviceId:Receiver1 that supports more inputs.

@radarengineer
Easy to add more inputs the only issue is naming them in UI. Do you know if this is possible in UI5?

zoot

with data.getvalue function ie:

if((parseInt( data.getValue( “ModelId” ) ) == 1) || // 19XX
(parseInt( data.getValue( “ModelId” ) ) == 2)) { // 21XX
appendSource($(“#funcPlayer .RFuncIcon”), del, source, rename, [“BD” , “DVD” , “CD” , “DOCK”], selectSource, false);
appendSource($(“#funcVideo .RFuncIcon”), del, source, rename, [“SAT/CBL” , “TV” , “GAME” , “GAME2” , “V.AUX”], selectSource, false);

and

if (data.getValue(“SalesArea”) == “0”) { // USA
list = [“NET/USB”, “Favorites”, “Internet Radio” , “Media Server”, “USB/iPod” , “Flickr” , “Pandora” , “Napster” , “Rhapsody” ];
}else if(data.getValue(“SalesArea”) == “1”) { // EUR
if(data.getValue(“LastfmDisplay”) == “TRUE”) { // Last FM Display
list = [“NET/USB”, “Favorites”, “Internet Radio” , “Media Server”, “USB/iPod” , “Flickr” , “Last. fm” , “Napster” ];
}else{
list = [“NET/USB”, “Favorites”, “Internet Radio” , “Media Server”, “USB/iPod” , “Flickr” , “Napster” ];
}
} else {
list = [“NET/USB”, “Favorites”, “Internet Radio” , “Media Server”, “USB/iPod” , “Flickr” ];
}

So decided to take the plunge and install UI5 all went OK but now the Denon plugin is only partially working.

It looks like the feedback from the following via Telnet is occurring after the create children command therefore children are never created as table is empty.

local getZoneNames = 'http://' .. ipAddress .. '/ZONERENAME/r_zonerename.asp'
 log(string.format ("(receiverStartup) ipAddress=%s, ipPort=%s", tostring (ipAddress), tostring (ipPort)))
--get zone names
log("(receiverStartup) force AVR to send zone names" .. getZoneNames)
status, response = luup.inet.wget(getZoneNames)

I have tried a few different combinations but have not been able to get the commands coming in before the create child function is called.

I am assuming I can use intercept somehow so that the startup waits for the table to be populated but unsure how to implement, any help would be appreciated.

Thanks

Zoot

All - I put the code from apps.mios.com onto a tag called “initial-UI5” on the svn server.

Just starting to look at the changes guess suggested here:

http://forum.micasaverde.com/index.php/topic,5863.msg55856.html#msg55856

Once that is done I would like to commit the merged code to trunk and make a tag called “0.1-UI5-merge” as guessed has done with his plugins.

I would like to suggest the get zone names via Ethernet part of the plugin be removed. This is for two reasons, one I can’t get it to work reliably in UI5 from a timing point of view and the replacement covers off connections for both with serial and Ethernet.

The replacement would be a table as follows: -

local receiverDetails = { ["AVR-3808EUR"]={ zones={3}, inputs={"TV/CBL","HDP","DVD","NET/USB","TUNER,CD","PHONO","SAT","VCR","DVR","V.AUX","XM","IPOD"} }, ["AVR-2???????"]={ zones={2}, inputs={"TV/CBL","HDP","DVD","NET/USB","TUNER,CD","PHONO","SAT","VCR","DVR","V.AUX","XM","IPOD"} }, }

The table will cover off the zones and inputs by using feedback from “SYMO” which in my case returns “AVR-3808EUR”. This also means that to add another device all that needs to be done is add another entry in the receiverDetails table (if they support the command).

I have already implemented but not tested just want the get feedback on whether you would prefer this or the existing method.

Please note this does not get around the naming of buttons in UI

I have attached the as yet tested implementation so you can see what I have done.

regards

Zoot

Zoot, for now that sounds good to me. Once we figure out how to get the naming of buttons working in the UI I will probably try to chase down getting zone names from ethernet further.

Let me know if I can help in anyway. Test etc. I have a new AVR-2112CI

SK