Page 1 of 3

Denon & Globalcache

Posted: Wednesday 29 January 2014 10:20
by RobDob
Hi,

I'm new here and currently looking at Domoticz to replace some other automation software I have.

Sorry if this has been asked before however I can't find the answers by searching. Has anyone managed to integrate Domoticz with the following hardware:

1. Denon AV receivers
2. Globalcache GC-100

Thanks,

Rob

Re: Denon & Globalcache

Posted: Wednesday 29 January 2014 11:14
by mongoose
I have an onkyo receiver and commands work great through Domoticz, Im sure you would be able to do something similar for Denon, maybe something similar as this: http://www.domoticz.com/forum/viewtopic.php?f=17&t=1491
but instead of the onkyo github, try https://github.com/jtangelder/denon-remote or maybe another....

Re: Denon & Globalcache

Posted: Wednesday 29 January 2014 19:32
by RobDob
Thanks - that has pointed me in the right direction and I have found that I can send commands to the Denon via Telnet. Now I just need to workout how to send telnet commands.....

Re: Denon & Globalcache

Posted: Friday 28 February 2014 13:38
by simon_rb
Hi Rob, did you ever manage to get telnet commands sent from Domoticz?

Cheers

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 13:33
by RobDob
Hi,

No I have not progressed on the Telnet commands yet. The lack of sockets in the Domoticz Lua and the fact I was running on Windows stopped me.

I have just (last night) started moving over to a Raspberry Pi. I will get round to the telnet part at some point however I have given priority to the GlobalCache first as that can control the Denon as well.

Now that I am on Raspberry Pi I can run Python scripts to do what I want, so here is a script that will send an IR signal to a GlobalCache:

Code: Select all

#!/usr/bin/python

#
# Python script to send IR to GlobalCache GC-100
# Rob Dobson - 4/3/2014
#

import socket

# set host and port
HOST = '192.168.1.70'
PORT = 4998

# connect to GC-100
s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))

# Send IR - Sky box - Sky button
s.sendall("sendir,4:2,2,36000,1,1,97,32,16,16,16,16,16,32,16,32,32,16,16,16,16,16,16,16,16,16,32,32,32,16,16,16,16,32,16,16,16,16,32,32,32,16,16,16,16,32,16,16,16,4473,97,32,16,16,16,16,16,32,16,32,32,16,16,16,16,16,16,16,16,16,32,32,32,16,16,16,16,32,16,16,16,16,32,32,32,16,16,16,16,32,16,16,16,32\r")

#This is the echo back from GC-100
response = s.recv(24)
print "Response from send():", response
This sends a Sky button press on a UK Sky+HD box. All in all that is pretty simple and works well - now I just need to work out how to trigger this in Lua on a scene change.

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 17:31
by simon_rb
Ah very good. I use the SQ Blaster and control that via a script using my Pi. I have a GC iTach Flex however never integrated it as the SQ Blaster is far better. It just sits in the corner and controls everything above it, below it , behind it, in front, well you get the idea. However I wonder if your script would work for my iTach Flex as it would be ideal for another room.

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 17:47
by RobDob
I think it should, the devices are from the same manufacturer and the API's look the same (at a quick glance). I think it may have been an iTach script that I started with.

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 17:59
by RobDob
I've just had a quick look at using Python for the telnet part as well and the following script will change the Master Volume on the Denon to 50:

Code: Select all

#!/usr/bin/python

#
# Python script to send Telnet commands to Denon Receiver
# Rob Dobson - 4/3/2014
#

import socket

# set host and port
HOST = '192.168.1.108'
PORT = 23

# connect to Denon
s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))

# Send Command - Denon - Volume to 50
s.sendall("MV50\r")
So now I have achieved both of what I want to do - next stage is to get it all integrated into my scenes.

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 18:40
by simon_rb
Excellent. Will take a gander and see if I can get it to work with my set up [SMILING FACE WITH OPEN MOUTH]

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 21:33
by simon_rb
Do you think your python/telnet script would send a command to a squeezebox device.. Only to turn them off..

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 21:48
by RobDob
Looks like you wouldn't even need to use Python. Seems someone has already written a Perl script to do it all:

https://github.com/pssc/squeezy

You could just call this from Lua as an OS command.

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 21:48
by simon_rb
Script didn't work for me. I got this:-

Image

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 21:49
by RobDob
Its a Python script not a shell script. Try:

python denon.sh

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 22:00
by simon_rb
Ah, I'm very new to this and that worked just fine haha. Thank you! I'll look into the squeezy thing, I did see that befofe however looked a bit complicated for me.

Hopefully domoticz will know to run the script as python and not bash..

Thanks again Rob.

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 22:08
by RobDob
You can force Domoticz to use Python, here is an example of how I call the scripts, its a Lua script called "script_device_LoungeTV.lua", in the directory /home/pi/domoticz/scripts/lua/

Code: Select all

--
-- When scene changes run GlobalCache script
-- Sending Sky Button press
--

commandArray = {}
if (devicechanged['LoungeTVDummy'] == 'On') then
        os.execute('python /autoscripts/gc-sky-skybutton.py')
        print('Scene: LoungeTV started')
end
return commandArray
My scene has a dummy device in it and when that changes to On the script is triggered.

I would have though that you wouldn't need to explicitly call Python but I prefer to be 100% on these things.

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 22:12
by RobDob
You should be able to download the SqueezeBox thing and call it via os.execute in the same way I am calling the Python scripts.

Maybe I will have a look at the SqueezeBox thing at some point, I have a couple of them as well.

Re: Denon & Globalcache

Posted: Tuesday 04 March 2014 23:03
by simon_rb
The squeezebox's are good, shame they were discontinued. I have one in every room.. They do not turn off automatically when they are turned on at the mains. They are powered up via a switch in domoticz, so when they are turned on they receive an off command via domoticz so they go into standby mode. To be honest this is all a bit over my head however I am trying and willing to learn. :-)

Re: Denon & Globalcache

Posted: Wednesday 05 March 2014 0:17
by RobDob
I've had a play around with the SqueezeBox stuff and seem to have it working. Try the following:

1. Download the stuff I linked to earlier
2. Extract to a directory on the Pi
3. Configure the squeezy.conf file - I let it auto discovery the server and devices and also commented out all of the other devices
4. Create a Dummy Device in the switches part of Domoticz
5. Create a LUA script that triggers off the dummy device, below is an example of the script I used

Code: Select all

--
-- Turn the Lounge Squeezebox Off
--

commandArray = {}
if (devicechanged['SqueezeBoxLounge'] == 'Off') then
        os.execute('perl /autoscripts/Squeezy/squeezy -SQ-Lounge -off')
        print('SqueezeBoxLounge Off')
end
return commandArray
The key part is the name of the SqueezeBoxes in the os.execute line, it must match what they are called in the server. Mine is called "SQ-Lounge".

I now have Domoticz turning the SqueezeBox on and off.

Re: Denon & Globalcache

Posted: Wednesday 05 March 2014 2:40
by simon_rb
Ah excellent. I will attempt this when I get 5 mins. I am working the next 4 days. Hopefully Sunday!! :-)

Thank you!

Denon & Globalcache

Posted: Thursday 06 March 2014 12:54
by simon_rb
Hi Rob,

Been trying to get the python script to run when a switch is switched with no luck. I see your path in both examples is /autoscripts/ have you created a folder someone called autoscripts? What would be the path to the default scripts fodder created by domoticz on a Raspberry Pi?

Thank you

Edit:- its working!!! For anyone else reading this its... home/pi/domoticz/scripts/