Telnet commands for Denon/Marantz

I’ve been looking at/modifying/testing this code for hours now, which I’m sure is part of the problem…I’m probably missing something simple: Using some examples I’ve found on the forums, I’m trying to send a fairly simple telnet command using Marantz IP Control commands. I know the Denon plugin will do this, however my particular scenario is using Imperihome on an Android tablet as an on-wall touch screen controller. I’d like to be able to press a button for a scene such as “start pandora”, which would turn on the Marantz receiver and set the input directly to Pandora.

I’m attempting to start simple and just have the receiver turn on, but it is not working. I have tried running the code thru an online Lua compiler and it complains about “attempt to call global ‘require’ (a nil value)”. I have no clue what that means and other examples I’ve found on the forum all include the socket command. When I “compile” the code in a scene, it does not complain, however when I test the code in the Lua test area under ‘Develop Apps’ it states code failed, but I don’t know why. Any suggestions/assistance would be greatly appreciated.

local socket = require("socket")
local host = "192.168.1.103"
local port = 23
local c = assert(socket.connect(host, port))
c:send("PWON\r")
c:close()

Try this instead:

local socket = require("socket") host = "192.168.1.103" c = assert(socket.connect(host, 23)) c:send("PWON\r") c:close()

@strangely

Thank you for your suggestion. I tried copying/pasting your code snippet but I still get a failure in the Lua code testing area.

I began investigating the Denon plugin further, so as not to try and re-invent the wheel and I think I now understand how to set an input in the advanced section of a scene. However, my Marantz command codes are slightly different. I need to use ‘SISAT/CBL’, for example, to set my input instead of ‘TV/CBL’. Is the proper way to “fix” this to edit one of the script files? I’ve downloaded the I_DenonReceiver1.xml file. Can I make those minor text changes and upload my new version?

I think I understand the relation between the plugin files. For my purposes of changing command text values and the corresponding buttons/names (changing button label from boxes to roku) I need to change the following:

In I_DenonReceiver1.xml

<action> <serviceId>urn:micasaverde-com:serviceId:InputSelection1</serviceId> <name>Input1</name> <run> -- Main picture Input Select - TV/CBL sendZoneCommand(lul_device, 'SI', 'TV/CBL', 'DiscreteinputTV') </run> </action>

to

<action> <serviceId>urn:micasaverde-com:serviceId:InputSelection1</serviceId> <name>Input1</name> <run> -- Main picture Input Select - TV/CBL sendZoneCommand(lul_device, 'SI', 'SAT/CBL', 'DiscreteinputDirecTV') </run> </action>

Then within D_DenonReceiver1.json change

{
			"ControlType": "button",
			"Label": {
				"lang_tag": "Input1",
				"text": "TV/CBL"
			},
			"Display": {
				"Service": "urn:micasaverde-com:serviceId:InputSelection1",
				"Variable": "Input",
				"Value": "TV/CBL",
				"Top": 145,
				"Left": 10,
				"Width": 65,
				"Height": 20
			},
			"Command": {
				"Service": "urn:micasaverde-com:serviceId:InputSelection1",
				"Action": "Input1",
				"Parameters": []

to

{
			"ControlType": "button",
			"Label": {
				"lang_tag": "Input1",
				"text": "SAT/CBL"
			},
			"Display": {
				"Service": "urn:micasaverde-com:serviceId:InputSelection1",
				"Variable": "Input",
				"Value": "SAT/CBL",
				"Top": 145,
				"Left": 10,
				"Width": 65,
				"Height": 20
			},
			"Command": {
				"Service": "urn:micasaverde-com:serviceId:InputSelection1",
				"Action": "Input1",
				"Parameters": []

and finally, within S_InputSelection change

<action> <name>DiscreteinputTV</name> </action>

to

<action> <name>DiscreteinputDirecTV</name> </action>

One thing I don’t fully understand is the Action": “Input1”, tag within the Command code. Is “Input1” an arbitrary value or something I need to know for my particular receiver…i.e. sat/cbl is 1, dvd is 2, etc. as you cycle thru ‘next input’ on the remote?

This is long, I know… Thanks in advance and my apologies if these questions are “basic”…the ‘Develop Apps’ area and luup files are things I’ve always been a little nervous to mess with.

The inputs action variable is arbitrary. I did the same thing as you and had to modify the xml files to select the correct inputs.