Page 1 of 3

Plugin Denon AVR-X2100W

Posted: Tuesday 24 January 2017 14:32
by piokuc
Hi
Is anybody who can write good plugin for Denon ampltuner AVR-X2100W ?
Good if controlling will be by HTTP
Becuase when i use test plugin on SSH , tyhen i can not connect by App Denon Remote(alternative app not from Denon). Original from Denon can connect. Thanks

Re: Plugin Denon AVR-X2100W

Posted: Thursday 16 February 2017 17:41
by sjefk
Hi Poikuc,

I just tried your plugin but i get the following error

2017-02-16 17:39:06.093 (Denon AVR X2100W) Calling message handler 'onHeartbeat'.
2017-02-16 17:39:06.093 (Denon AVR X2100W) Disconnect directive received.
2017-02-16 17:39:06.093 Error: Plugin: Async Read Exception: 125, Operation canceled
2017-02-16 17:39:06.094 (Denon AVR X2100W) Calling message handler 'onDisconnect'.
2017-02-16 17:39:06.094 (Denon AVR X2100W) Device has disconnected.
2017-02-16 17:39:16.141 (Denon AVR X2100W) Calling message handler 'onHeartbeat'.
2017-02-16 17:39:16.142 PluginSystem: Starting I/O service thread.
2017-02-16 17:39:16.142 (Denon AVR X2100W) Connect directive received, transport connect initiated successfully.
2017-02-16 17:39:19.148 (Denon AVR X2100W) Calling message handler 'onConnect'.
2017-02-16 17:39:19.148 (Denon AVR X2100W) Connected successfully to: 172.25.2.83:80
2017-02-16 17:39:19.148 (Denon AVR X2100W) Sending data: 'PW? '.
2017-02-16 17:39:26.112 (Denon AVR X2100W) Calling message handler 'onHeartbeat'.
2017-02-16 17:39:26.112 (Denon AVR X2100W) Sending data: 'PW? '.

Do you have any idea ?

Best regards,

Sjef

Re: Plugin Denon AVR-X2100W

Posted: Friday 17 February 2017 22:17
by l00pz
I also tried to clean up the existing Denon example Plugin, but I keep getting the following error when starting the Plugin:

Code: Select all

2017-02-17 22:15:04.179 (Denon X2100W) Initialized version 1.0.0, author 'piokuc'
2017-02-17 22:15:04.180 (Denon X2100W) Debug log level set to: 'true'.
2017-02-17 22:15:04.180 (Denon X2100W) Creating device 'Main Zone'.
2017-02-17 22:15:04.181 (Denon X2100W) Creating device 'Main Volume'.
2017-02-17 22:15:04.182 (Denon X2100W) Devices created.
2017-02-17 22:15:04.182 (Denon X2100W) 'HardwareID':'71'
2017-02-17 22:15:04.182 (Denon X2100W) 'Version':'1.0.0'
2017-02-17 22:15:04.182 (Denon X2100W) 'Name':'Denon X2100W'
2017-02-17 22:15:04.182 (Denon X2100W) 'HomeFolder':'/home/kevin/domoticz/plugins/Denon/'
2017-02-17 22:15:04.182 (Denon X2100W) 'Key':'DenonX2100W'
2017-02-17 22:15:04.182 (Denon X2100W) 'Mode6':'Debug'
2017-02-17 22:15:04.182 (Denon X2100W) 'Port':'23'
2017-02-17 22:15:04.182 (Denon X2100W) 'Author':'piokuc'
2017-02-17 22:15:04.183 (Denon X2100W) 'Address':'192.168.178.202'
2017-02-17 22:15:04.183 (Denon X2100W) Device count: 2
2017-02-17 22:15:04.183 (Denon X2100W) Device: 1 - ID: 1145, Name: 'Denon X2100W - Main Zone', nValue: 0, sValue: ''
2017-02-17 22:15:04.183 (Denon X2100W) Device ID: '1145'
2017-02-17 22:15:04.183 (Denon X2100W) Device Name: 'Denon X2100W - Main Zone'
2017-02-17 22:15:04.183 (Denon X2100W) Device nValue: 0
2017-02-17 22:15:04.183 (Denon X2100W) Device sValue: ''
2017-02-17 22:15:04.183 (Denon X2100W) Device LastLevel: 0
2017-02-17 22:15:04.183 (Denon X2100W) Device: 2 - ID: 1146, Name: 'Denon X2100W - Main Volume', nValue: 0, sValue: ''
2017-02-17 22:15:04.183 (Denon X2100W) Device ID: '1146'
2017-02-17 22:15:04.183 (Denon X2100W) Device Name: 'Denon X2100W - Main Volume'
2017-02-17 22:15:04.183 (Denon X2100W) Device nValue: 0
2017-02-17 22:15:04.183 (Denon X2100W) Device sValue: ''
2017-02-17 22:15:04.183 (Denon X2100W) Device LastLevel: 0
2017-02-17 22:15:04.183 (Denon X2100W) Transport set to: 'TCP/IP', 192.168.178.202:23.
2017-02-17 22:15:04.184 (Denon X2100W) Protocol set to: 'Line'.
2017-02-17 22:15:04.184 PluginSystem: Starting I/O service thread.
2017-02-17 22:15:04.184 (Denon X2100W) Connect directive received, transport connect initiated successfully.
2017-02-17 22:15:04.234 (Denon X2100W) Calling message handler 'onConnect'.
2017-02-17 22:15:04.234 (Denon X2100W) Connected successfully to: 192.168.178.202:23
2017-02-17 22:15:04.234 (Denon X2100W) Sending data: 'PW? '.
2017-02-17 22:15:04.335 (Denon X2100W) Calling message handler 'onMessage'.
2017-02-17 22:15:04.335 Error: (Denon X2100W) 'onMessage' failed 'TypeError':'onMessage() takes 1 positional argument but 3 were given'.
Anyone have an idea what this could be? The only result I found on the Forum was solved by Dnpwwo updating the Kodi Plugin.

Re: Plugin Denon AVR-X2100W

Posted: Saturday 18 February 2017 1:07
by Dnpwwo
@l00pz,

You are running an old version and the parameters don't match what Domoticz is supplying. Have a look at http://www.domoticz.com/wiki/Developing ... #Callbacks for parameter details.

If you are happy with a version of the plugin that runs over telnet (port 23) rather than HTTP then have a look at the example plugin Denon4306.py that this one is based on because it should work for almost all AVR models as is (or look here: https://github.com/domoticz/domoticz/bl ... non4306.py). It is more up to date and a better place to start if you want to modify it.

I would also suggest attaching your plugin code to posts in future if you have more questions.

Re: Plugin Denon AVR-X2100W

Posted: Saturday 18 February 2017 9:31
by l00pz
Dnpwwo wrote:@l00pz,

You are running an old version and the parameters don't match what Domoticz is supplying. Have a look at http://www.domoticz.com/wiki/Developing ... #Callbacks for parameter details.

If you are happy with a version of the plugin that runs over telnet (port 23) rather than HTTP then have a look at the example plugin Denon4306.py that this one is based on because it should work for almost all AVR models as is (or look here: https://github.com/domoticz/domoticz/bl ... non4306.py). It is more up to date and a better place to start if you want to modify it.

I would also suggest attaching your plugin code to posts in future if you have more questions.
Thanks! Completely missed the updated Plugin on your GitHub, and this version is working perfect for me :D

Re: Plugin Denon AVR-X2100W

Posted: Saturday 18 February 2017 21:16
by gielie
How do I use this plugin?
I saved the .py file in domoticz/plugin/denon/script.py

I thought there should be a hardware option to add and configure my denon.
Nothing shows up, can someone explain?

Re: Plugin Denon AVR-X2100W

Posted: Saturday 18 February 2017 21:37
by oohlaf
You need to rename to plugin.py

Re: Plugin Denon AVR-X2100W

Posted: Saturday 18 February 2017 22:19
by Dnpwwo
@gielie,

The folder name is 'plugins' not 'plugin'.

You will need to restart Domoticz

Re: Plugin Denon AVR-X2100W

Posted: Saturday 18 February 2017 22:29
by gielie
Ok I renamed it to plugin.py, it looks like this, domoticz/plugins/denon/plugin.py then rebooted.
Still nothing, how can I check if the plugin is loaded or not? Can i execute the plugin manually?

Re: Plugin Denon AVR-X2100W

Posted: Saturday 18 February 2017 23:45
by Dnpwwo
@gielie,

If it loaded it will be in the drop down list of available hardware in the Hardware page.

Not sure which plugin version you are using, the one from the examples folder shows up as "Denon AVR 4306 Amplifier". If you are using the example one then you tell it:
  • IP Address
  • Port (leave this as default unless you have changed your amplifier setting)
  • how many zones you want
  • startup delay (Domoticz buffers messages for this time when the amplifier is turning on otherwise they are ignored)
  • the sources you use. Remove the ones you don't use but make sure the names match what your amplifier calls them. You can give them friendly names later by editing the selector switch directly in the Switches page
Add the hardware and the related devices will start showing up in the Switches page.

Re: Plugin Denon AVR-X2100W

Posted: Sunday 19 February 2017 12:33
by gielie
If it loaded it will be in the drop down list of available hardware in the Hardware page.
This part is not happening, i can't figure out why and i don't know how to check if domoticz can load the phyton plugins.

Re: Plugin Denon AVR-X2100W

Posted: Sunday 19 February 2017 13:22
by Dnpwwo
@gielie,

domoticz/plugins/denon/plugin.py is the correct place and name. If you restart Domoticz after putting the file there it should load.

I assume you are running the beta version of Domoticz? (You need to be)

Do you see messages at the start of the log after a restart showing that Pyhton has been loaded?

I've attached a newer version of gthe plugin you can try as well
plugin v2.2.0.rar
(3.37 KiB) Downloaded 174 times

Re: Plugin Denon AVR-X2100W

Posted: Sunday 19 February 2017 22:26
by piokuc
Hi
I have a problem. I have created in /domoticz/plugins/DenonX2100W/plugin.py but in hardwear i not see Denon. I put in my directory named DenonX2100W your file with new version and changed name to plugin.py
But not see Denon. Please help me.

PLUGINS: Goup "pi" OWNER "pi" 0755


In logs i have an error:

Code: Select all

PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.

Re: Plugin Denon AVR-X2100W

Posted: Monday 20 February 2017 9:24
by Dnpwwo
@piokuc,

This is not a problem with a plugin. Domoticz is not loading Python which is different.

This is covered on the wiki http://www.domoticz.com/wiki/Linux#Prob ... ing_Python

Re: Plugin Denon AVR-X2100W

Posted: Monday 20 February 2017 12:16
by gielie
Ok i got the python script running and i have the hardware added, power switch, input selector and audio. The power switch works, the input and volume not, it reads the current volume level from the receiver but I can not adjust it within domoticz. The input selector I have to change the names but to what? I tried the the names I gave but no luck. I have a denon x2100, anyone who can point me in the right direction?

Re: Plugin Denon AVR-X2100W

Posted: Monday 20 February 2017 13:17
by Dnpwwo
@gielie,

The technical guide for your amp was posted here: viewtopic.php?f=6&t=14784&p=110321&hilit=X2100W#p110321. Page 9 has a list of paramaters to the SI command, these are the device names that the AVR understands.

Delete the hardware then work out which ones you use and put them in the 'Sources' field separated by pipes. E.g 'Off|Tuner|DVD|BD|GAME' then Add it again and it should work.

If it does you can edit the selector switch(s) directly and rename them to whatever you want and it will still work. For example, my sources field is 'Off|DVD|VDP|TV' but I've changed the selector switch to show Off, DVD, Sony PS3, Kodi. Selecting 'Sony PS3' switches the amp to source VDP which is the Sony PS3 source.

Re: Plugin Denon AVR-X2100W

Posted: Monday 20 February 2017 18:06
by l00pz
Hmmm after the latest Update of Domoticz, my Plugin for the Denon also shows the same symptoms as @gielie has. The current status of the Denon is reflected into Domoticz, but when I try to change the volume or the Source nothing happens. In the logfile I see the following information:

Code: Select all

2017-02-20 18:04:13.083 User: Admin initiated a switch command (1147/Denon X2100W - Main Volume/Set Level)
2017-02-20 18:04:13.119 (Denon X2100W) onCommand called for Unit 3: Parameter 'Set Level', Level: -273.1499938964844
2017-02-20 18:04:15.385 User: Admin initiated a switch command (1146/Denon X2100W - Main Zone/Set Level)
2017-02-20 18:04:15.403 (Denon X2100W) onCommand called for Unit 2: Parameter 'Set Level', Level: -273.1499938964844
2017-02-20 18:04:15.403 Error: (Denon X2100W) 'onCommand' failed 'KeyError'.
2017-02-20 18:04:15.403 Error: (Denon X2100W) ----> Line 213 in /home/kevin/domoticz/plugins/Denon/plugin.py, function onCommand
I also tried putting back the previous version of the Plugin, but this does the same.

Re: Plugin Denon AVR-X2100W

Posted: Tuesday 21 February 2017 4:21
by Dnpwwo
@l00pz,

From the detail you have provided I'm guessing this is a data issue not a plugin issue so I'm not surprised that changing versions did not help. I'm going to guess that this error started showing up after you edited the selector switch.

Editing the selector is okay but in the instructions below I told gielie to make sure the plugin worked first.

Can you delete the hardware, set the sources field to the names that the amplifier understands then try it. If it does not work post the value of the sources field and a screen shot of the selector switch in edit mode

Re: Plugin Denon AVR-X2100W

Posted: Tuesday 21 February 2017 9:00
by l00pz
Dnpwwo wrote:@l00pz,

From the detail you have provided I'm guessing this is a data issue not a plugin issue so I'm not surprised that changing versions did not help. I'm going to guess that this error started showing up after you edited the selector switch.

Editing the selector is okay but in the instructions below I told gielie to make sure the plugin worked first.

Can you delete the hardware, set the sources field to the names that the amplifier understands then try it. If it does not work post the value of the sources field and a screen shot of the selector switch in edit mode
I deleted the Hardware, and added it again with a new name to make sure there's no legacy stuff left. Unfortunately the Switches still don't work. The communication and the names of the sources seem to be correct as the status of the Denon is reflected to Domoticz (so when I switch source with the Remote, the switch is updated in Domoticz with the correct name). Isn't it also strange that in the log file it states that the volume should be set to "-273.1499938964844" or has this something to do with the conversion from relative to absolute volume?

This is the Logfile when I try to change the volume and source of the Denon to BD:

Code: Select all

2017-02-21 08:42:22.024 (Denon X2100W Woonkamer) Calling message handler 'onHeartbeat'.
2017-02-21 08:42:22.027 (Denon X2100W Woonkamer) onHeartbeat: lastMessage PW, Sending 'ZM'.
2017-02-21 08:42:22.027 (Denon X2100W Woonkamer) Sending data: 'ZM? '.
2017-02-21 08:42:22.178 (Denon X2100W Woonkamer) Calling message handler 'onMessage'.
2017-02-21 08:42:22.178 (Denon X2100W Woonkamer) onMessage called with Data: 'ZMON'
2017-02-21 08:42:32.035 (Denon X2100W Woonkamer) Calling message handler 'onHeartbeat'.
2017-02-21 08:42:32.035 (Denon X2100W Woonkamer) onHeartbeat: lastMessage ZM, Sending 'SI'.
2017-02-21 08:42:32.035 (Denon X2100W Woonkamer) Sending data: 'SI? '.
2017-02-21 08:42:32.135 (Denon X2100W Woonkamer) Calling message handler 'onMessage'.
2017-02-21 08:42:32.136 (Denon X2100W Woonkamer) onMessage called with Data: 'SISAT/CBL'
2017-02-21 08:42:32.186 (Denon X2100W Woonkamer) Calling message handler 'onMessage'.
2017-02-21 08:42:32.186 (Denon X2100W Woonkamer) onMessage called with Data: 'SVOFF'
2017-02-21 08:42:42.034 (Denon X2100W Woonkamer) Calling message handler 'onHeartbeat'.
2017-02-21 08:42:42.035 (Denon X2100W Woonkamer) onHeartbeat: lastMessage SI, Sending 'MV'.
2017-02-21 08:42:42.035 (Denon X2100W Woonkamer) Sending data: 'MV? '.
2017-02-21 08:42:42.135 (Denon X2100W Woonkamer) Calling message handler 'onMessage'.
2017-02-21 08:42:42.135 (Denon X2100W Woonkamer) onMessage called with Data: 'MV23'
2017-02-21 08:42:42.186 (Denon X2100W Woonkamer) Calling message handler 'onMessage'.
2017-02-21 08:42:42.186 (Denon X2100W Woonkamer) onMessage called with Data: 'MVMAX 98'
2017-02-21 08:42:42.186 (Denon X2100W Woonkamer) Unknown: Action MV, Detail 'MAX 98' ignored.
2017-02-21 08:42:49.210 User: Admin initiated a switch command (1153/Denon X2100W Woonkamer - Main Volume/Set Level)
2017-02-21 08:42:49.248 (Denon X2100W Woonkamer) Calling message handler 'onCommand'.
2017-02-21 08:42:49.249 (Denon X2100W Woonkamer) onCommand called for Unit 3: Parameter 'Set Level', Level: -273.1499938964844
2017-02-21 08:42:49.260 (Denon X2100W Woonkamer) Sending data: 'MV-273.1499938964844 '.
2017-02-21 08:42:52.029 (Denon X2100W Woonkamer) Calling message handler 'onHeartbeat'.
2017-02-21 08:42:52.029 (Denon X2100W Woonkamer) onHeartbeat: lastMessage MV, Sending 'MU'.
2017-02-21 08:42:52.029 (Denon X2100W Woonkamer) Sending data: 'MU? '.
2017-02-21 08:42:52.091 User: Admin initiated a switch command (1152/Denon X2100W Woonkamer - Main Zone/Set Level)
2017-02-21 08:42:52.130 (Denon X2100W Woonkamer) Calling message handler 'onCommand'.
2017-02-21 08:42:52.130 (Denon X2100W Woonkamer) onCommand called for Unit 2: Parameter 'Set Level', Level: -273.1499938964844
2017-02-21 08:42:52.130 Error: (Denon X2100W Woonkamer) 'onCommand' failed 'KeyError'.
2017-02-21 08:42:52.130 Error: (Denon X2100W Woonkamer) ----> Line 213 in /home/kevin/domoticz/plugins/Denon/plugin.py, function onCommand
2017-02-21 08:42:52.130 (Denon X2100W Woonkamer) Calling message handler 'onMessage'.
2017-02-21 08:42:52.130 (Denon X2100W Woonkamer) onMessage called with Data: 'MUOFF'
2017-02-21 08:43:02.033 (Denon X2100W Woonkamer) Calling message handler 'onHeartbeat'.
2017-02-21 08:43:02.033 (Denon X2100W Woonkamer) onHeartbeat: lastMessage MU, Sending 'PW'.
2017-02-21 08:43:02.033 (Denon X2100W Woonkamer) Sending data: 'PW? '.
2017-02-21 08:43:02.134 (Denon X2100W Woonkamer) Calling message handler 'onMessage'.
2017-02-21 08:43:02.134 (Denon X2100W Woonkamer) onMessage called with Data: 'PWON'
2017-02-21 08:43:02.184 (Denon X2100W Woonkamer) Calling message handler 'onMessage'.
2017-02-21 08:43:02.184 (Denon X2100W Woonkamer) onMessage called with Data: 'Z2ON'
2017-02-21 08:43:12.016 (Denon X2100W Woonkamer) Calling message handler 'onHeartbeat'.
2017-02-21 08:43:12.016 (Denon X2100W Woonkamer) onHeartbeat: lastMessage PW, Sending 'ZM'.
2017-02-21 08:43:12.016 (Denon X2100W Woonkamer) Sending data: 'ZM? '.
2017-02-21 08:43:12.117 (Denon X2100W Woonkamer) Calling message handler 'onMessage'.
2017-02-21 08:43:12.117 (Denon X2100W Woonkamer) onMessage called with Data: 'ZMON'
2017-02-21 08:43:22.014 (Denon X2100W Woonkamer) Calling message handler 'onHeartbeat'.
2017-02-21 08:43:22.014 (Denon X2100W Woonkamer) onHeartbeat: lastMessage ZM, Sending 'SI'.
2017-02-21 08:43:22.014 (Denon X2100W Woonkamer) Sending data: 'SI? '.
2017-02-21 08:43:22.115 (Denon X2100W Woonkamer) Calling message handler 'onMessage'.
2017-02-21 08:43:22.115 (Denon X2100W Woonkamer) onMessage called with Data: 'SISAT/CBL'
2017-02-21 08:43:22.165 (Denon X2100W Woonkamer) Calling message handler 'onMessage'.
2017-02-21 08:43:22.165 (Denon X2100W Woonkamer) onMessage called with Data: 'SVOFF'
And these are the screenshots of the switch and the hardware

Image

Image

Re: Plugin Denon AVR-X2100W

Posted: Tuesday 21 February 2017 9:33
by gielie
Ok, i changed the input names according the technical guide, these are the same names i can use to switch via http (could have thought about that earlier) but as stated above it wont work, i have the same amplifier and get the same log. One other thing, when i turn on the receiver bot zones are turned on (zone 1 and 2) which is annoying, it doesn't matter wetter i choose 1 or 2 zones within the hardware settings. When i turn it off zone 2 stays on, i can not turn it off via Domoticz.