Marantz/Denon Plugin Development

Questions and comments specific to a particular plugin should go here.
User avatar
zian
Site Admin
Posts: 575
Joined: Wed Jun 24, 2009 3:54 pm

Re: Marantz/Denon Plugin Development

Post by zian » Sat Mar 14, 2020 4:20 pm

Howdy All, Guess who got "gifted" a Marantz sr7009.
Yup... me. Been twiddling around with it.

Been trying to use it's IP address and EG as well as Tasker to do stuff with it. To it.
Got mute and power working so far.

This page helped (for device commands)...
https://github.com/subutux/denonavr/blo ... points.txt

This helped me do the wget cmds in win10...
https://eternallybored.org/misc/wget/

Here are my first few EG actions to Un/Mute the Marantz if anyboday cares...

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="0.5.0-rc6">
    <Folder Name="Marantz" XML_Guid="{A07085E4-B4C4-406E-A2A8-3DBF354A3ABD}" Expanded="True">
        <Macro Name="Run Application: MuteOffMarantz.bat" XML_Guid="{1EFB2E71-4EC3-4661-A6C0-19B7E46C48C5}" Expanded="True">
            <Action XML_Guid="{AF16A16D-3EE9-4A6F-8DB9-EC84A3A22683}">
                System.Execute(u'"C:\\Program Files (x86)\\EventGhost\\MoveFiles\\wget.exe"', u'--quiet http://192.168.1.141/MainZone/index.put.asp?cmd0=PutVolumeMute%2Foff&amp;cmd1=aspMainZone_WebUpdateStatus%2F', 3, False, 2, u'', False, True, u'', False, False, False, True)
            </Action>
        </Macro>
        <Macro Name="Run Application: MuteOnMarantz.bat" XML_Guid="{1EFB2E71-4EC3-4661-A6C0-19B7E46C48C5}" Expanded="True">
            <Action XML_Guid="{AF16A16D-3EE9-4A6F-8DB9-EC84A3A22683}">
                System.Execute(u'"C:\\Program Files (x86)\\EventGhost\\MoveFiles\\wget.exe"', u'--quiet http://192.168.1.141/MainZone/index.put.asp?cmd0=PutVolumeMute%2Fon&amp;cmd1=aspMainZone_WebUpdateStatus%2F', 3, False, 2, u'', False, True, u'', False, True, False, True)
            </Action>
        </Macro>
    </Folder>
</EventGhost>
bat files like sooo...
Mute On..

Code: Select all

wget http://192.168.1.141/MainZone/index.put.asp?cmd0=PutVolumeMute%2Fon&cmd1=aspMainZone_WebUpdateStatus%2F
Mute Off...

Code: Select all

wget http://192.168.1.141/MainZone/index.put.asp?cmd0=PutVolumeMute%2Foff&cmd1=aspMainZone_WebUpdateStatus%2F
I love this shit.
All but for the Marantz dweebs re/moving/deleting nearly every old or useful web link resource that has been put up online over the past years/decades. They suck for that.
eventghost.net
Be there or be square.

User avatar
zian
Site Admin
Posts: 575
Joined: Wed Jun 24, 2009 3:54 pm

Re: Marantz/Denon Plugin Development

Post by zian » Sat Mar 14, 2020 4:38 pm

kgschlosser wrote:
Fri Jan 20, 2017 4:26 am
Here is a newer version. I have incorporated a connection error retry. there is a 5 second delay between each retry. on it's 6th time it will error out completely. I think that 30 seconds should be enough time for the AVR to figure out what it's doing.

I have also added more to the debugging routine. this will now put any traceback information into that debug file as well as any in and out data from the echo clients
This is AWESOME Kev.
If only I had found/read it 7 hours ago.
lol
eventghost.net
Be there or be square.

V_J
Experienced User
Posts: 237
Joined: Tue Mar 04, 2014 9:00 am

Re: Marantz/Denon Plugin Development

Post by V_J » Tue Apr 14, 2020 7:37 am

Hello!

Can I ask on the status of this plugin?

Previously, I added all actions to the marantz serial plugin (it is somewhere on the forums), but of course it was missing the events and the answers of the amplifier. In this plugin, I checked the code and it seems to use the new set of Marantz commands (models 2013 and up if I'm not mistaken). I already played in the action.py and events.py to see if I can easily adapt it for the old set of commands (e.g. "@VOL:" in stead of "MV") and first experiments seem hopeful (I got the volume reading from my SR6001). I will work a bit more on that and if it works, I will create all the actions and events for the older api.
Perhaps they could be merged in a single plugin, with a selection in the configuration of the plugin to choose old or new commands?

Best regards,

Jörg

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Marantz/Denon Plugin Development

Post by kgschlosser » Tue Apr 14, 2020 10:13 pm

My problem with this thing is I am not able to get a complete API from Denon/Marantz. I can hack something together but it is going to be riddled with problems due to changes in the API between years and also between models and firmware versions.
I have asked 2 times now and both times they stated they do not have a "complete" API covering all versions and that I would have to manually go through each and every single one of the modes and get the API documentation, The problem with this is that because of firmware changes and updates the API might differ from what they have posted on their website. The otherrng is that the dambed things spit out all kinds of information there is no documentation for at all.

I have not managed to get past their first line of customer support, maybe you might be able to. I know that the engineering department has to have a complete list other wise how would they know what can be changed or ad without bonking heads with another command that may exist.. So there is a complete list I know this.This is the reason why there are no complete bindings for any HA device or software that supports the full API. they all sick with the basic commands like volume and channel that they know will work across the line of devices. Because of the remote control capabilities of EG it is important to be able to add ALL of the API so mappings can be made to remote control buttons if a user wanted to.
If you like the work I have been doing then feel free to Image

V_J
Experienced User
Posts: 237
Joined: Tue Mar 04, 2014 9:00 am

Re: Marantz/Denon Plugin Development

Post by V_J » Wed Apr 15, 2020 7:48 am

I have an older amplifier, whose API is perhaps simpler and more established ( https://www.us.marantz.com/-/media/File ... I_V100.pdf ), but even so it also has its issues: the amplifier supports some commands that it should not (according to the document), while it does not support some others. So probably similar issues...

I've started modifying the actions.py and events.py and do manage to both send and receive values (still struggling with some bit-code values, but that is rather my python limitation :)), but the mechanism is entirely the same. So I can adapt this plugin for my purpose by messing in the code. But this made me think: what if the api-commands would not be in the plugin?

What if the plugin would allow you to send a command (user can enter it, like now with your "send command" action) but with a payload (e.g. volume). And similarly, the plugin would allow you to create an event where the user specifies the command to be recognized, along with an optional type (e.g. user enters ** for numbers, the old command codes also had hexadecimal values that were bit-coded data so for those e.g. ## could be used). The plugin would effectively be a more universal send/receive to/from serial port with limited parsing, but then the set of commands for a device could be supplied in an egtree. That way, a user can easily adjust the supported commands and if they share the egtree on the forum we at least have the commands for different devices... The plugin would be universal, the API matters more easily solvable as they would not be in the plugin code...

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Marantz/Denon Plugin Development

Post by kgschlosser » Wed Apr 15, 2020 8:06 am

I would have to go in and look at what I did with the plugin. I honestly do not remember where I stopped working on it. I know I have a few version of the plugin on my local machine. They are going to be newer then what is attached to this forum topic.

what I can do is I can create a GitHub repository for it and you can make code changes and submit a pull request so I can get the new code added to the plugin. It is also a better place to "talk shop" because GitHub is designed to handle copying, pasting and viewing of code. I believe I should still have the collection of API docs I have collected from Marantz and Denon. For some reason I think I have combined them into a single document. I also think that I spent the time to work out the variations between like commands or not. I would have to look at it to refresh my bean. Since I write this plugin my programming knowledge and skills have increased exponentially. I had been programming < 2 years when I wrote it. I would be willing to provide information as needed and help with updating it.
If you like the work I have been doing then feel free to Image

V_J
Experienced User
Posts: 237
Joined: Tue Mar 04, 2014 9:00 am

Re: Marantz/Denon Plugin Development

Post by V_J » Wed Apr 15, 2020 8:26 am

My Python skills are very limited... I can manage to adapt some things for my use by learning from examples (I did this with the other Marantz serial plugin), but feel I lack the time to develop the skills needed for making it.

I managed to adapt the current version of the plugin to make it work for the things I tested: setting volume and reading the volume level through rs232 from a Marantz SR6001. But that was a quite straightforward adjustment of the commands in your code (replace MV with @VOL: ). Now I'm checking the parsing to deal with some fields that return a bit-encoded field (e.g. @AST, which sets the layers of events that are sent out, but also speakers in use is bitcoded in the old API, with each bit representing a speaker). I added a command in your events.py that matches @AST:# and am processing the # in a similar way as you are processing the volume values using **. Just struggling at the moment with the regular expression matching, it already works if the encoded field is 0-9, but not yet for A-F, but I'll crack it. :) Once I have that one, I think I have enough for my purpose: I can then add events / commands for everything I need.

My suggestions was more that if you are stuck with the API, the more generic serialport-parsing could be a way out... other people could do what I'm doing without having to code, all they need is the list of commands and return types and make the things in the egtree... and if egtrees are posted then those can actually help to circumvent api issues as everything can be customized at tree level. And it would work for many devices (e.g. my projector also uses a similar protocol... I don't have a serial cable there, but I think it could be a general thing).

One thing: when removing the current plugin from the tree (or adjusting some settings), it crashes eventghost...

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Marantz/Denon Plugin Development

Post by kgschlosser » Wed Apr 15, 2020 9:37 am

I am not "stuck" really. The issue is trying to locate an API doc on Denon's website that actually works and is not corrupted I have not been able to do. I do know that there are things that differ between Denon and Marantz. The other thing is there is all kinds of data that gets spewed of the AVR that is not documented. and because of this It makes it extremely difficult to parse the information. Because I do not know what is static data wand what is going to change. and what I should be looking for in the jumble of information that is being spit out.

For instance. I know there is a way to get the names of the sources on the AVR. and also the custom names a user has entered. This portion is no where to be found in any documentation. There is a world of information that can be gotten from the AVR. I had thought there is a web gui on these things as well. I may be able to use that GUI to break down some of the IP commands. The we GUI is not going to interface with the AVR directly. It is going to use the exact same IP/Serial codes that we would use for control. These codes are going to be in the source of the web gui. This source code can be gotten by connecting to it using a browser from a PC and right clicking on the page and then clicking on "view source" This would need to be done for every single page in the GUI.

I do not own one of these things and that adds another layer of complexity.
If you like the work I have been doing then feel free to Image

V_J
Experienced User
Posts: 237
Joined: Tue Mar 04, 2014 9:00 am

Re: Marantz/Denon Plugin Development

Post by V_J » Wed Apr 15, 2020 10:04 am

Ok, I get it... I thought the current API was still as limited as the old one (for the model I have): in that one, it is quite clear what can come from the receiver as it cannot contain any user-added information (such as source names or presets) and thus is restricted to the events listed in the documentation. The only thing that is unclear is that some documented things that should not work on this model do work, but that is easily accommodated. (that is also why I first thought of using the serial port plugin in the other thread: I have a limited (albeit long) list of events that can be sent by the amplifier. It would be very easy to create an event for each of them and bind that one with an action, thus bypassing the need to parse the data. But of course parsing the data would be better).

I will check a bit more in your plugin, but I can only test the rs232 side. I am tempted to see if I can modify the plugin to make it a more general serial port parser... (gives me a chance to improve my Python skills)

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Marantz/Denon Plugin Development

Post by kgschlosser » Wed Apr 15, 2020 1:23 pm

what is the model number of the AVR/PreAmp you have? And is it Denon or Marantz?
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Marantz/Denon Plugin Development

Post by kgschlosser » Wed Apr 15, 2020 1:27 pm

also here is a list of the commands I have managed to scrape together thus far. That is everything for Marantz API to v16 except those "undocumented" commands and events. I do not have v17 rev01 or v17 rev02 added to the attached command list.
Attachments
Marantz.zip
(171.36 KiB) Downloaded 31 times
If you like the work I have been doing then feel free to Image

V_J
Experienced User
Posts: 237
Joined: Tue Mar 04, 2014 9:00 am

Re: Marantz/Denon Plugin Development

Post by V_J » Wed Apr 15, 2020 2:42 pm

Those commands don't work for me, I have the a Marantz SR6001 which uses the old command set (I think this was pre-2013), as here:
https://www.us.marantz.com/-/media/File ... I_V100.pdf ; it has commands of the form @XXX:YYY\r, where XXX is a command (PWR for power, VOL for volume, ...) and YYY is the attribute (e.g. for power this is 0,1 or 2; for volume this is either a 0 followed by a number, or a 1, 2, 3 or 4 to change the volume in small or big steps. Most commands also have ?, to allow for querying. As a reply, the amplifier just sends the current status of the setting that was changed (so a volume up gets a response that contains the current volume level).

But the whole concept is the same. At the moment, I'm modifying the plugin by changing actions/events to match with my command set. Power and volume work, which means I can make it work for most of the commands. I'm just thinking what to do with the bit-encoded fields (commands AST - which feedback is sent - and CHS - which channels are in the incoming signal). I first thought I would do it the same as you do for numeric data (such as volume) but with # as the wildcard. However, as there are only 2 such commands it may be better to decode them entirely and return more annotated data rather than trying with a generic hex->bit method and return bits.

O, when removing the plugin from the egtree, I get the following error:

Error starting plugin: Marantz AVR Serial/TCP/Forwarding
Traceback (most recent call last) (0.5.0-rc6):
File "C:\Program Files (x86)\EventGhost\eg\Classes\PluginInstanceInfo.py", line 227, in Stop
self.instance.__stop__()
File "C:\ProgramData\EventGhost\plugins\MarantzAVR\__init__.py", line 191, in __stop__
self.client.Stop()
File "C:\ProgramData\EventGhost\plugins\MarantzAVR\serial.py", line 42, in Stop
self.sevent.set()
AttributeError: 'Serial' object has no attribute 'sevent'

After this happens, I need to restart Eventghost if I want to add the plugin again: it says it fails to initialize the serial port.

V_J
Experienced User
Posts: 237
Joined: Tue Mar 04, 2014 9:00 am

Re: Marantz/Denon Plugin Development

Post by V_J » Mon Apr 20, 2020 6:24 pm

Just to update: I'm adding all the actions/events for the old commands. It is a bit of a mess, as some return values differ per model (but you cannot ask the model from amplifier). So there will be some generic ones in comments and then tailored ones for my amplifier (only those will be tested).

Stupid question: Tone bass and tone treble, for which I even have buttons on the remote, don't work (also not from the remote). Could it be the Audyssey correction that is preventing adjustment using those?

I'll post the actions/events here, but I will first integrate them more in the other system: this will allow my to check for errors and typing mistakes.

Jörg

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Marantz/Denon Plugin Development

Post by kgschlosser » Tue Apr 21, 2020 7:08 am

put the thing into stereo and see if it starts working. bass and treble control when using a DSP or some kind of a surround sound processor can remove those controls in favor of adjusting output level of your LFE channel or the center channel as these would be a better way to adjust the bass and treble because of the xover cutoff points assigned to specific channels.
If you like the work I have been doing then feel free to Image

V_J
Experienced User
Posts: 237
Joined: Tue Mar 04, 2014 9:00 am

Re: Marantz/Denon Plugin Development

Post by V_J » Tue Apr 21, 2020 4:58 pm

Nope... no reaction at all... I switched off the Audyssey correction, put it in stereo, set the input to analog... those buttons do nothing... Ah, not so important. :)

Post Reply