Denon AV Reciver - plugin

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.
User avatar
G3rard
Posts: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Denon AV Reciver - plugin

Post by G3rard » Saturday 12 November 2016 14:50

What does it show if you add

Code: Select all

print('----------------------')
print(vol_tv)
print('----------------------')
directly after vol_tv = execute('curl --url "http://192.168.1.12/goform/formMainZone_MainZoneXml.xml" &')?
I get an overview of all values (without XML layout due to the log I think).
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

simon_rb
Posts: 689
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Denon AV Reciver - plugin

Post by simon_rb » Saturday 12 November 2016 14:54

Right, I uncommented them and yes I am getting the right values. Its also updating Domoticiz Denon Volume with the right value! Thanks :) was the ~= 'Off' then that was the problem. Issue I have now is the % changes in domoticz but the slider doesn't move.. So it says 45% but shows 65% on the sliderfor example

User avatar
G3rard
Posts: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Denon AV Reciver - plugin

Post by G3rard » Saturday 12 November 2016 14:59

Good to hear it's working :mrgreen:

I update the dimmer with the commandArray['UpdateDevice'] command. That means that the % is updated, without actually firing the LUA command which is update the volume.
I do that to prevent potential loops in volume updates.
The only thing the is that the percentage is being updated, but the sliders isn't. For me that is no problem.

If there are no volume loops to be expected you can update the dimmer via JSON and then the slider will be at the right place.
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

simon_rb
Posts: 689
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Denon AV Reciver - plugin

Post by simon_rb » Saturday 12 November 2016 15:04

G3rard wrote:Good to hear it's working :mrgreen:

I update the dimmer with the commandArray['UpdateDevice'] command. That means that the % is updated, without actually firing the LUA command which is update the volume.
I do that to prevent potential loops in volume updates.
The only thing the is that the percentage is being updated, but the sliders isn't. For me that is no problem.

If there are no volume loops to be expected you can update the dimmer via JSON and then the slider will be at the right place.
Eh?!?! Sorry I'm still learning all this stuff..

I have just added the Denon Volume to eDomoticz and it seems the switch only updates from the sliders. So I set the amp manually from 60 volume to 50. Domoticz updates to 50 to reflect this but slider doesn't move. Within Homekit it still says 60% so Homekit must use the sliders for volume.. I'll need to get the sliders working so the slider within Homekit work! Doh!

And the Denon Volume is updated every minute when the lua time script runs..

simon_rb
Posts: 689
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Denon AV Reciver - plugin

Post by simon_rb » Saturday 12 November 2016 15:44

This is working however the log shows its setting volume every minute, the previous script did the same.. Hmmm The volume doesn't change on the Amp though so its only the log within switch..

Code: Select all

commandArray = {}
function execute(command)
        -- returns success, error code, output.
    local f = io.popen(command..' 2>&1 && echo " $?"')
    local output = f:read"*a"
    return output
end

--read xml and remove value strings
--<MasterVolume><value>-60.0</value></MasterVolume> becomes -60.0
function get(data,name)
    data = data:match("<"..name..">(.-)</"..name..">")
    data = data:gsub("<value>", "")
    data = data:gsub("</value>", "")
    return data
end

vol_tv = execute('curl --url "http://192.168.1.12/goform/formMainZone_MainZoneXml.xml" &')

--get volume of TV and update volume switch in Domoticz if it differs
local vol_tv = get(vol_tv,"MasterVolume")
local vol_domo = otherdevices_svalues['Denon Volume']
print(vol_tv)
vol_tv = tonumber(vol_tv) + 80
print(vol_tv)
if otherdevices['Denon Volume'] ~= 'Off' then
    if (vol_domo ~= vol_tv) then
        --commandArray['UpdateDevice'] = otherdevices_idx['Denon Volume'] ..' |2|' .. vol_tv
os.execute('curl -s "http://192.168.1.26:8080/json.htm?type=command&param=switchlight&idx=284&switchcmd=Set%20Level&level='..vol_tv..'" &')

    end
end

return commandArray

simon_rb
Posts: 689
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Denon AV Reciver - plugin

Post by simon_rb » Saturday 12 November 2016 15:59

Don't know how pretty this is but it works :)
This updates the sliders and only updates the switch if its different...

Code: Select all

commandArray = {}
function execute(command)
        -- returns success, error code, output.
    local f = io.popen(command..' 2>&1 && echo " $?"')
    local output = f:read"*a"
    return output
end

--read xml and remove value strings
--<MasterVolume><value>-60.0</value></MasterVolume> becomes -60.0
function get(data,name)
    data = data:match("<"..name..">(.-)</"..name..">")
    data = data:gsub("<value>", "")
    data = data:gsub("</value>", "")
    return data
end

vol_tv = execute('curl --url "http://192.168.1.12/goform/formMainZone_MainZoneXml.xml" &')

--get volume of TV and update volume switch in Domoticz if it differs
local vol_tv = get(vol_tv,"MasterVolume")
local vol_domo = otherdevices_svalues['Denon Volume']
print(vol_tv)
vol_tv = tonumber(vol_tv) + 80
print(vol_tv)
if otherdevices['Denon Volume'] ~= 'Off' then
    --if (vol_domo ~= vol_tv) then
difference = math.abs(vol_domo - vol_tv)
if difference > 1 then
        --commandArray['UpdateDevice'] = otherdevices_idx['Denon Volume'] ..' |2|' .. vol_tv
os.execute('curl -s "http://192.168.1.26:8080/json.htm?type=command&param=switchlight&idx=284&switchcmd=Set%20Level&level='..vol_tv..'" &')

    end
end

return commandArray

User avatar
G3rard
Posts: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Denon AV Reciver - plugin

Post by G3rard » Saturday 12 November 2016 16:29

I think it's quite pretty ;)
Will have a look at that as well, because I think there will be no volume loop this way and updating the slider as well is a bit nicer :D
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

simon_rb
Posts: 689
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Denon AV Reciver - plugin

Post by simon_rb » Saturday 12 November 2016 16:31

G3rard wrote:I think it's quite pretty ;)
Will have a look at that as well, because I think there will be no volume loop this way and updating the slider as well is a bit nicer :D
Hehe, I'm having issues trying to get the values to match.. Like setting it to 65% will set receiver to 64%.. I have tried numerous different things and I can't quite get them to match, although there is no volume loop at least! I just like everything just right ;)

Scrap that its working now.. I think I left an odd calculation in there somewhere! Happy days!

Sorry about the repeated updates, The slider within Domoticz is always 1% below what it should but with the difference thing you don't get the volume loop. Be nice to get it 100% but its prob to do with the whole 0-99 rather than 1-100 within Domoticz dimmer..

I can either get it working with Domoticz and the amp showing the same value and homekit being 1% out or I can get Homekit and Amp saying the same and Domoticz 1% out. Rather frustrating..

UPDATE:- After all that it looks like a edomoticz thing maybe - my other 0-99 dimmers behave the same

trixwood
Posts: 510
Joined: Friday 18 March 2016 8:20
Target OS: -
Domoticz version: Offline
Contact:

Re: Denon AV Reciver - plugin

Post by trixwood » Saturday 12 November 2016 20:34

new virtual sensor and device script if original change, change new with original+1.

simon_rb
Posts: 689
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Denon AV Reciver - plugin

Post by simon_rb » Sunday 13 November 2016 2:59

trixwood wrote:new virtual sensor and device script if original change, change new with original+1.
Good idea! I'll hold out as I think its an eDomoticz thing.. G3rard has hacked a fix so hopefully that will be implemented :D

Bart77
Posts: 8
Joined: Saturday 17 September 2016 9:25
Target OS: Raspberry Pi
Domoticz version: Latest
Location: Netherlands
Contact:

Re: Denon AV Reciver - plugin

Post by Bart77 » Sunday 13 November 2016 21:00

Hi All,

Also pretty new at Domoticz but really liking the system, tying to integrate as much as possible.

Currently working on an improved version of the scripts which could support all versions and has improved logging options :) .

At this moment I can check the device status, read all data, check Domoticz server status and update Domoticz objects.

What I need is a clear setup of the Domoticz objects and its slave objects, could someone help??

Below is what I find in the script but setting up the DENON_STATUS as slave to the DENON this not possible :?
# DOMO_DENON_IDX="155" # On/Off (Switch) IDX *1
# DOMO_DENON_STATUS_IDX="290" # Status (Text) IDX <==== what type is this one?
# DOMO_DENON_MUTE_IDX="117" # Absolute Volume (Slider) IDX (same as Absolute Volume) <==== what type is this one
# DOMO_DENON_VOL_REL_IDX="59" # Relative Volume (Sound Volume) IDX
# DOMO_DENON_VOL_ABS_IDX="117" # Absolute Volume (Slider) IDX
# DOMO_DENON_SURROUND_IDX="149" # Surround (Selector Switch) IDX
# DOMO_DENON_INPUT_IDX="133" # Input (Selector Switch) IDX *1
# DOMO_DENON_NET_INPUT_IDX="289" # Net input (Text) IDX
# DOMO_DENON_AIRPLAY_IDX="150" # Airplay? (Switch)

Hoping to post the script shortly :)
Last edited by Bart77 on Monday 14 November 2016 22:37, edited 1 time in total.

trixwood
Posts: 510
Joined: Friday 18 March 2016 8:20
Target OS: -
Domoticz version: Offline
Contact:

Re: Denon AV Reciver - plugin

Post by trixwood » Sunday 13 November 2016 22:02

The text is a virtual sensor type: "text"
Screen Shot 2016-11-13 at 20.52.40.png
Screen Shot 2016-11-13 at 20.52.40.png (245.79 KiB) Viewed 2056 times
Slider is a virtual sensor type: "switch", to change it to a slider go add it to the switches view, go there and press the edit button and change on/off to dimmer.
Screen Shot 2016-11-13 at 21.00.22.png
Screen Shot 2016-11-13 at 21.00.22.png (310.11 KiB) Viewed 2056 times
Screen Shot 2016-11-13 at 20.57.37.png
Screen Shot 2016-11-13 at 20.57.37.png (324.49 KiB) Viewed 2052 times
Also here you can change the icon to a more amp style icons...
Last edited by trixwood on Sunday 13 November 2016 22:31, edited 1 time in total.

trixwood
Posts: 510
Joined: Friday 18 March 2016 8:20
Target OS: -
Domoticz version: Offline
Contact:

Re: Denon AV Reciver - plugin

Post by trixwood » Sunday 13 November 2016 22:06

Screen Shot 2016-11-13 at 20.58.17.png
Screen Shot 2016-11-13 at 20.58.17.png (112.64 KiB) Viewed 2051 times

trixwood
Posts: 510
Joined: Friday 18 March 2016 8:20
Target OS: -
Domoticz version: Offline
Contact:

Re: Denon AV Reciver - plugin

Post by trixwood » Sunday 13 November 2016 22:16

Abou the on/off with slave:

You need two virtual on/off switches.

One to receive the denon data from denon.sh (idx 155 in my case) and which you can remove, it out of your switches view
And one to control the actual on/off in domoticz, (idx 110 in my case) which contains the action url and the sub/slave
Screen Shot 2016-11-13 at 21.15.01.png
Screen Shot 2016-11-13 at 21.15.01.png (131.62 KiB) Viewed 2051 times
3.jpg
3.jpg (221.39 KiB) Viewed 2051 times
I you do not use two, the whole script looses status and the denon keeps turning on- off - on - off... probably because switching on or off cost time and the xml files are not available when in the process of switching on or off then... I did not have to use it anywhere else only when switching on/off

Hope it helps..

Also the script needs improvent in xml handling, it either should download it to a pre configures ram disk or directly to memory... now it writes all the retrieved xml to disk every time it is called... no problem on a normal rust spinner, but could wear down sd cards...

Bart77
Posts: 8
Joined: Saturday 17 September 2016 9:25
Target OS: Raspberry Pi
Domoticz version: Latest
Location: Netherlands
Contact:

Re: Denon AV Reciver - plugin

Post by Bart77 » Sunday 13 November 2016 22:38

Wow that was fast and very helpful, many thanks!! :D

Bart77
Posts: 8
Joined: Saturday 17 September 2016 9:25
Target OS: Raspberry Pi
Domoticz version: Latest
Location: Netherlands
Contact:

Re: Denon AV Reciver - plugin

Post by Bart77 » Friday 18 November 2016 9:58

Hi All,

When I create a dummy switch and try to actuate the receiver I get error messages into the Domoticz log although the action does what is should do.
2016-11-17 22:54:29.211 Error: Error opening url: http://<ip>/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FOFF

this is only when it is switched throught the on of action of the dummy device, no when it is called from a LUA script.

Anyone have the same issue?

Running on a Raspberry PI with the latest version of Domoticz

trixwood
Posts: 510
Joined: Friday 18 March 2016 8:20
Target OS: -
Domoticz version: Offline
Contact:

Re: Denon AV Reciver - plugin

Post by trixwood » Friday 18 November 2016 12:29

No idea but if it works it works :-)

Bart77
Posts: 8
Joined: Saturday 17 September 2016 9:25
Target OS: Raspberry Pi
Domoticz version: Latest
Location: Netherlands
Contact:

Re: Denon AV Reciver - plugin

Post by Bart77 » Friday 18 November 2016 15:38

Agree, it is just not so nice if the log is polluted with incorrect errors...
I just like to create solutions without these kinds of features ;)

Was just wondering if other have similar issues, if so then it would be a structural thing and I will invest in a other approach rather than solving these errors.

User avatar
G3rard
Posts: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Denon AV Reciver - plugin

Post by G3rard » Saturday 19 November 2016 15:31

@Bart77, that's because a response is expected when using the on/off action of the switch, but probably not being sent.

See this topic http://www.domoticz.com/forum/viewtopic.php?t=10211.
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

Bart77
Posts: 8
Joined: Saturday 17 September 2016 9:25
Target OS: Raspberry Pi
Domoticz version: Latest
Location: Netherlands
Contact:

Re: Denon AV Reciver - plugin

Post by Bart77 » Sunday 20 November 2016 0:55

Hi all,

Just update the wiki page https://www.domoticz.com/wiki/Denon.

I put there the scripts I created to control and synchronize the Denon AV receiver with Domoticz.

Until now it really work well, will be testing coming weeks ;) .

Hopefully new functionality and support for multiple devices will be added.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest