Denon AV Reciver - plugin
Moderators: leecollings, remb0
Denon AV Reciver - plugin
Hi
Maybe some users help an write plugin the same as plugin for Panasonic TV to control Denon AV Reciver...? I can help with test only because i dont know write plugin.
Maybe owner plugin Panasonic TV can help ? Control Denon is very simple by send command by http.
Maybe some users help an write plugin the same as plugin for Panasonic TV to control Denon AV Reciver...? I can help with test only because i dont know write plugin.
Maybe owner plugin Panasonic TV can help ? Control Denon is very simple by send command by http.
- Egregius
- Posts: 2589
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Denon AV Reciver - plugin
I use a seperate custom web page. To many options that are possible.
- Egregius
- Posts: 2589
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Denon AV Reciver - plugin
Well, you have volume control, source selection, surround mode, dialog and subwoofer levels. Zone2 control, etc.
Many buttons to put in domoticz.
Many buttons to put in domoticz.
-
- Posts: 612
- Joined: Wednesday 07 August 2013 19:09
- Target OS: -
- Domoticz version:
- Location: UK
- Contact:
Re: Denon AV Reciver - plugin
I have a problem I am trying to solve - I thought I had found a solution however it wasn't, since I have thought of another way round but its out of my basic knowledge. My setup:-
I have a network Denon Amp and a separate amp to power a subwoofer. I have a surround sound button in domoticz and when pressed it switches the mains socket to power on the amp the is connected to the sub and then domoticz sends an IR command to my Denon to turn on and it works. The hurdle I have is when the Denon is in standby and we select it from an airplay menu to play some music then the Denon powers up but obviously the amp powering the sub doesn't turn on as Domoticz is unaware the amp is on.
What I tried to do was turn off the network when it was in standby and had domoticz ping it so when it powered up then it would know as it would then respond to the ping and then turn on the Sub Amp - brilliant I thought however of course this defeats the object as now when the Denon is in standby the network is turned off so we can't select it from the Airplay menu. This got me thinking that maybe I am on the right track with the ping, instead is there a way of querying the Amp using domoticz and when it powers up then Domoticz would know and turn on the other amp. I found some documentation but how I get Domoticz to query and use the received info is a bit beyond my abilities. Any ideas anyone? I know the query for power status is "PW?"
Thank you in advance.
This is the documentation.
http://openrb.com/wp-content/uploads/20 ... V7.6.0.pdf
The command by ASCII CODE, parameter expression
*ASCII CODE which can be used is from 0x20 to 0x7F: the alphabet and the number of 0-9, and space (0x20), some signs,
Command structure: COMMAND + PARAMETER + CR (0x0D) COMMAND: ASCII CODE of 2 characters
The example of a command * <CR> is the meaning of 0x0D. SIDVD<CR> : Select Input source DVD
MSSTEREO<CR> : surround Mode Set to STEREO
MVUP<CR> : Master Volume UP
PWON<CR> : system PoWer ON
PWSTANDBY<CR> : system PoWer STANDBY
SI?<CR> : Request command for now playing input source >> Return RESPONSE ‘SI***<CR>’
I have a network Denon Amp and a separate amp to power a subwoofer. I have a surround sound button in domoticz and when pressed it switches the mains socket to power on the amp the is connected to the sub and then domoticz sends an IR command to my Denon to turn on and it works. The hurdle I have is when the Denon is in standby and we select it from an airplay menu to play some music then the Denon powers up but obviously the amp powering the sub doesn't turn on as Domoticz is unaware the amp is on.
What I tried to do was turn off the network when it was in standby and had domoticz ping it so when it powered up then it would know as it would then respond to the ping and then turn on the Sub Amp - brilliant I thought however of course this defeats the object as now when the Denon is in standby the network is turned off so we can't select it from the Airplay menu. This got me thinking that maybe I am on the right track with the ping, instead is there a way of querying the Amp using domoticz and when it powers up then Domoticz would know and turn on the other amp. I found some documentation but how I get Domoticz to query and use the received info is a bit beyond my abilities. Any ideas anyone? I know the query for power status is "PW?"
Thank you in advance.
This is the documentation.
http://openrb.com/wp-content/uploads/20 ... V7.6.0.pdf
The command by ASCII CODE, parameter expression
*ASCII CODE which can be used is from 0x20 to 0x7F: the alphabet and the number of 0-9, and space (0x20), some signs,
Command structure: COMMAND + PARAMETER + CR (0x0D) COMMAND: ASCII CODE of 2 characters
The example of a command * <CR> is the meaning of 0x0D. SIDVD<CR> : Select Input source DVD
MSSTEREO<CR> : surround Mode Set to STEREO
MVUP<CR> : Master Volume UP
PWON<CR> : system PoWer ON
PWSTANDBY<CR> : system PoWer STANDBY
SI?<CR> : Request command for now playing input source >> Return RESPONSE ‘SI***<CR>’
-
- Posts: 63
- Joined: Saturday 07 March 2015 22:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Denon AV Reciver - plugin
You can only use http interface to send commands. You need to parse xml to get status. I did it before
-
- Posts: 612
- Joined: Wednesday 07 August 2013 19:09
- Target OS: -
- Domoticz version:
- Location: UK
- Contact:
Re: Denon AV Reciver - plugin
Firstly thank you for your quick reply, secondly how might one do that? lol
Ah ok, I have just found another thread thats rather recent so I'll ask there also.
Thank you
Ah ok, I have just found another thread thats rather recent so I'll ask there also.
Thank you
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Denon AV Reciver - plugin
simon_rb, the interface you have mentioned in your post is very functional and much easier to use programatically that the web interface which (IMHO) is complicated and slow.
I use that interface from a Denon AVR 4306 to turn the amp off & on and change input sources from a Python script and map functionality to a number of dummy devices calling the Python script is done from the selector device: While this does not do exactly what you want you could trigger a script from a ping device.
The Python to control the device is pretty simple, this script controls power and source (and turns power on prior to setting source):
I plugin could be developed if there was sufficient demand
I use that interface from a Denon AVR 4306 to turn the amp off & on and change input sources from a Python script and map functionality to a number of dummy devices calling the Python script is done from the selector device: While this does not do exactly what you want you could trigger a script from a ping device.
The Python to control the device is pretty simple, this script controls power and source (and turns power on prior to setting source):
Code: Select all
#!/usr/bin/python
#
import sys
import os
import time
import telnetlib
import logging
import logging.config
logging.config.fileConfig('/home/pi/devices/Denon/Denon_Log.conf')
log = logging.getLogger("[" + str(os.getpid()) + "]")
sockND_Denon = telnetlib.Telnet(<your IPAddress here>)
def CleanString( str ):
return ''.join(c for c in str if ord(c) >= 32)
def WaitForResponse( cmd ):
# flush any data in socket
sockND_Denon.read_eager()
retries = 5
response = ""
log.debug("Sending %d bytes: '%s'" % (len(cmd),CleanString(cmd)))
sockND_Denon.write( cmd + '\r' )
while retries > 0 and (cmd[:2]!=response[:2]):
response=sockND_Denon.read_until('\r',0.5)
if len(response) > 0:
log.debug("Received %d bytes: '%s'" % (len(response),CleanString(response)))
else:
retries = retries-1
return CleanString(response)
def CheckPower( action ):
try:
resp = WaitForResponse( 'PW?' )
if (resp == ('PW%s' % action)):
log.debug("Power state is as required: '%s'." % resp)
return 1
log.info("Power state is not as required: '%s'." % resp)
return -1
except Exception as e:
log.error("Power command unsuccessful, exception thrown. Detail '%s'" % (e))
return -2
def SendPowerCommand( action ):
try:
if (CheckPower( action ) < 0):
resp = WaitForResponse( 'PW' + action )
if (CheckPower( action ) > 0):
return 1
log.info("Power command '%s' failed, response was '%s'." % (action,resp))
return -1
return 1
except Exception as e:
log.error("Power command failed, exception thrown. Detail '%s'" % e)
return -2
def CheckSource( action ):
try:
resp = WaitForResponse( 'SI?' )
if (resp == ('SI%s' % action)):
log.debug("Source is as expected: '%s'." % resp)
return 1
log.debug("Source is not as expected: '%s'." % resp)
return -1
except Exception as e:
log.error("Source unsuccessful, exception thrown. Detail '%s'" % (e))
return -2
def SendSourceCommand( action ):
try:
if (SendPowerCommand( "ON" ) < 0):
log.error("ON Power command failed for '%s' request." % (action))
return -1
resp = WaitForResponse( 'SI' + action )
if CheckSource( action ) > 0:
return 1
resp = WaitForResponse( 'SI' + action )
if CheckSource( action ) > 0:
return 1
log.error("Source '%s' failed, response was '%s'." % (action,CleanString(resp)))
return -1
except Exception as e:
log.error("Source failed, exception thrown. Detail '%s'" % e)
return -2
def mainloop():
if len(sys.argv) != 2:
log.debug("Invalid argument count: %d" % (len(sys.argv)-1))
return -1
log.debug("Argument: '%s'" % sys.argv[1])
if ((sys.argv[1] == "ON") or (sys.argv[1] == "STANDBY")):
retval = SendPowerCommand( sys.argv[1] )
else:
retval = SendSourceCommand( sys.argv[1] )
if (retval > 0):
log.info('Command processed successfully: %s.' % sys.argv[1])
else:
log.error('Command Failed %s.' % sys.argv[1])
sockND_Denon.close
mainloop()
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
- gielie
- Posts: 290
- Joined: Tuesday 12 January 2016 11:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest β
- Location: The Netherlands (Alkmaar)
- Contact:
Re: Denon AV Reciver - plugin
I would very much like a standard plugin, i just started with domiticz and not very handy in changing scripts to my needs.Dnpwwo wrote:
I plugin could be developed if there was sufficient demand
So if someone could create a plugin i would say, "yeah"
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
-
- Posts: 612
- Joined: Wednesday 07 August 2013 19:09
- Target OS: -
- Domoticz version:
- Location: UK
- Contact:
Re: Denon AV Reciver - plugin
Dnpwwo,
Thank you for your detailed reply. I am a little confused. I can currently and do control my amp from python using a telnet connection. So I can switch it on using that, I currently have it selecting a preset. What I am trying to do is send the PW? command but then get Domoticz to read the answer and if its on then Domoticz can turn on the other amp powering the sub if it isn't already. Hope that makes sense?
So I just need to know how to send a query command and get Domoticz to act on the reply.
Thank you
Thank you for your detailed reply. I am a little confused. I can currently and do control my amp from python using a telnet connection. So I can switch it on using that, I currently have it selecting a preset. What I am trying to do is send the PW? command but then get Domoticz to read the answer and if its on then Domoticz can turn on the other amp powering the sub if it isn't already. Hope that makes sense?
So I just need to know how to send a query command and get Domoticz to act on the reply.
Thank you

- Egregius
- Posts: 2589
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Denon AV Reciver - plugin
I use virtual switches to handle my Denon automatically, they all call the same php cron script that handles the rest.
Virtual switches are called 'listen to radio (radioluisteren)', 'watch TV (tvkijken)' and 'watch Kodi (kodikijken)'.
They are linked to the devices (miniliving1s etc) of a minimote.
Possibillities of the minimote:
Button 1 short: power on, set volume to 30 and select input TV.
Button 1 long: power on, set volume to 25 and select input Tuner.
Button 2 short: Power on, set volume to 40 and select input Kodi.
Button 3 short: volume - 3.
Button 4 short: volume + 3.
The virtual switches are there because the devices from the minimote can't be switched with json, they can only be updated. Updating a devices doesn't trigger the action on script.
Virtual switches are called 'listen to radio (radioluisteren)', 'watch TV (tvkijken)' and 'watch Kodi (kodikijken)'.
They are linked to the devices (miniliving1s etc) of a minimote.
Code: Select all
if($Sradioluisteren=='On') {$Sminiliving1l='On';Schakel($SIradioluisteren,'Off');}
if($Stvkijken=='On') {$Sminiliving1s='On';Schakel($SItvkijken,'Off');}
if($Skodikijken=='On') {$Sminiliving2s='On';Schakel($SIkodikijken,'Off');}
if($Seten=='On') {$Sminiliving3l='On';Schakel($SIeten,'Off');}
if($Sminiliving1s=='On') {
if($Sdenon!='On') Schakel($SIdenon,'On','mini Denon');
if($Stv!='On') Schakel($SItv,'On','mini TV');
if($Shall_auto=='On') {
if($Skristal!='On') Schakel($SIkristal,'On','mini Kristal');
if($Stvled!='On') Schakel($SItvled,'On','mini TVled');
}
file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FON&cmd1=aspMainZone_WebUpdateStatus%2F',false, $ctx);
usleep($Usleep*2);
file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutZone_InputFunction/SAT/CBL',false, $ctx);
usleep($Usleep*2);
file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/-50.0',false, $ctx);
if($Ssubwoofer!='On') Schakel($SIsubwoofer,'On','mini Subwoofer');
Udevice($SIminiliving1s,0,'Off');
}
if($Sminiliving1l=='On') {
if($Sdenon!='On') Schakel($SIdenon,'On','mini Denon');
if($Stv!='Off') Schakel($SItv,'Off','mini TV');
if($Skristal!='Off') Schakel($SIkristal,'Off','mini Kristal');
if($Stvled!='Off') Schakel($SItvled,'Off','mini TVLed');
file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FON&cmd1=aspMainZone_WebUpdateStatus%2F',false, $ctx);
usleep($Usleep*2);
file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/-55.0',false, $ctx);
usleep($Usleep*2);
file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutZone_InputFunction/TUNER',false, $ctx);
if($Ssubwoofer!='On') Schakel($SIsubwoofer,'On','mini Subwoofer');
Udevice($SIminiliving1l,0,'Off');
}
if($Sminiliving2s=='On') {
if($Sdenon!='On') Schakel($SIdenon,'On','mini Denon');
if($Stv!='On') Schakel($SItv,'On','mini TV');
if($Skodi!='On') Schakel($Skodi,'On','mini Kodi');
if($Shall_auto=='On') {
if($Skristal!='On') Schakel($SIkristal,'On','mini Kristal');
if($Stvled!='On') Schakel($SItvled,'On','mini TVled');
}
file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FON&cmd1=aspMainZone_WebUpdateStatus%2F',false, $ctx);
usleep($Usleep*2);
file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutZone_InputFunction/DVD',false, $ctx);
usleep($Usleep*2);
file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/-40.0',false, $ctx);
if($Ssubwoofer!='On') Schakel($SIsubwoofer,'On','mini Subwoofer');
Udevice($SIminiliving2s,0,'Off');
}
if($Sminiliving3s=='On') {
$denonmain=simplexml_load_string(file_get_contents($denon_address.'/goform/formMainZone_MainZoneXml.xml?_='.$time,false,$ctx));
$denonmain=json_encode($denonmain);$denonmain=json_decode($denonmain,TRUE);usleep(10000);
if($denonmain){
$denonmain['MasterVolume']['value']=='--'?$setvalue=-55:$setvalue=$denonmain['MasterVolume']['value'];
$setvalue=$setvalue-3;
if($setvalue>-10) $setvalue=-10;if($setvalue<-80) $setvalue=-80;
file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/'.$setvalue.'.0');}
Udevice($SIminiliving3s,0,'Off');
}
if($Sminiliving4s=='On') {
$denonmain=simplexml_load_string(file_get_contents($denon_address.'/goform/formMainZone_MainZoneXml.xml?_='.$time,false,$ctx));
$denonmain=json_encode($denonmain);$denonmain=json_decode($denonmain,TRUE);usleep(10000);
if($denonmain){
$denonmain['MasterVolume']['value']=='--'?$setvalue=-55:$setvalue=$denonmain['MasterVolume']['value'];
$setvalue=$setvalue+3;
if($setvalue>-10) $setvalue=-10;if($setvalue<-80) $setvalue=-80;
file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/'.$setvalue.'.0');}
Udevice($SIminiliving4s,0,'Off');
}
Button 1 short: power on, set volume to 30 and select input TV.
Button 1 long: power on, set volume to 25 and select input Tuner.
Button 2 short: Power on, set volume to 40 and select input Kodi.
Button 3 short: volume - 3.
Button 4 short: volume + 3.
The virtual switches are there because the devices from the minimote can't be switched with json, they can only be updated. Updating a devices doesn't trigger the action on script.
-
- Posts: 612
- Joined: Wednesday 07 August 2013 19:09
- Target OS: -
- Domoticz version:
- Location: UK
- Contact:
Re: Denon AV Reciver - plugin
Hi Egregius, I currently have a similar setup however what I am trying to achieve is to send a query to the denon amp and get a response and get Domoticz to act on it. The command is PW? As I can turn the amp on by selecting it from an iPhone using AirPlay I need domoticz to realise it has come on so it can turn on the other amp that powers the sub.
Cheers
Sent from my iPhone using Tapatalk
Cheers
Sent from my iPhone using Tapatalk
- Egregius
- Posts: 2589
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Denon AV Receiver - plugin
If you're OK with a one minute delay you could put this in a cron job:
This would switch idx 123 on if the main zone is on, or else off.
In my cronjob I have it like this:
The cronjob is executed every minute. The (date('i')%10==0) part limits the execution to every 10 minutes.
It gets the current status and pushes that status to the virtual Denon switch in domoticz and switches the subwoofer on/off.
Because I almost always use my webinterface to switch it's basically not needed for me, this was just to update domoticz in case someone switches the amp on with the button or the remote.
Code: Select all
<?php
$domoticzurl='http://127.0.0.1:8084/';
$denon_address = 'http://192.168.0.15';
$time=$_SERVER['REQUEST_TIME'];
function Schakel($idx,$cmd) {
global $domoticzurl;
$reply=json_decode(file_get_contents($domoticzurl.'json.htm?type=command¶m=switchlight&idx='.$idx.'&switchcmd='.$cmd.'&level=0&passcode='),true);
if($reply['status']=='OK') $reply='OK';else $reply='ERROR';
return $reply;
}
$denonmain=json_decode(json_encode(simplexml_load_string(file_get_contents($denon_address.'/goform/formMainZone_MainZoneXml.xml?_='.$time,false,$ctx))),TRUE);
if($denonmain['ZonePower']['value']=='ON') Schakel(123,'On');
else Schakel(123,'Off');
In my cronjob I have it like this:
Code: Select all
<?php
if (date('i')%10==0) {
$denonstatus = json_decode(json_encode(simplexml_load_string(file_get_contents($denon_address.'/goform/formMainZone_MainZoneXml.xml?_='.$time,false, stream_context_create(array('http'=>array('timeout' => 2,)))))), TRUE);
if($Sdenon=='On') {
if($Ssubwoofer!='On') Schakel($SIsubwoofer,'On','subwoofer');
if($denonstatus['Power']['value']!='ON') file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutSystem_OnStandby%2FON&cmd1=aspMainZone_WebUpdateStatus%2F');
}
else if($Sdenon=='Off') {
if($Ssubwoofer!='Off') Schakel($SIsubwoofer,'Off','subwoofer');
if($denonstatus['Power']['value']!='OFF') file_get_contents($denon_address.'/MainZone/index.put.asp?cmd0=PutSystem_OnStandby%2FSTANDBY&cmd1=aspMainZone_WebUpdateStatus%2F');
}
}
It gets the current status and pushes that status to the virtual Denon switch in domoticz and switches the subwoofer on/off.
Because I almost always use my webinterface to switch it's basically not needed for me, this was just to update domoticz in case someone switches the amp on with the button or the remote.
-
- Posts: 612
- Joined: Wednesday 07 August 2013 19:09
- Target OS: -
- Domoticz version:
- Location: UK
- Contact:
Re: Denon AV Reciver - plugin
Egregious,
That's exactly it, usually domoticz turns the amp on however with Airplay domoticz is in aware the Denon has powered up. I'll take a look at your code when I get in and fingers crossed I can get it to work. Thank you!
Update:- Just took a quick look, Could I run the cron job only if the Denon is shown as off in Domoticz, If its switched on in Domoticz then there isn't any point in it running every minute
That's exactly it, usually domoticz turns the amp on however with Airplay domoticz is in aware the Denon has powered up. I'll take a look at your code when I get in and fingers crossed I can get it to work. Thank you!
Update:- Just took a quick look, Could I run the cron job only if the Denon is shown as off in Domoticz, If its switched on in Domoticz then there isn't any point in it running every minute

- Egregius
- Posts: 2589
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Denon AV Reciver - plugin
It does when someone power off the amp with remote.
A call every minute is really not much.
You could also schedule the cron every 2 min.
Having the cron only when switch is off would mean that you also need to ask domoticz what the state is, before asking denon. I do that because I ask domoticz every minute the state of all used devices.
A call every minute is really not much.
You could also schedule the cron every 2 min.
Having the cron only when switch is off would mean that you also need to ask domoticz what the state is, before asking denon. I do that because I ask domoticz every minute the state of all used devices.
-
- Posts: 612
- Joined: Wednesday 07 August 2013 19:09
- Target OS: -
- Domoticz version:
- Location: UK
- Contact:
Re: Denon AV Reciver - plugin
Right, I'll just run it every minute then
Although we don't even have the remote out to manually turn it off. I shall try and get this to work soon. All I need to do is copy your cron script and change the IP addresses and I noticed your port is different for Domoticz and add the IDX of the virtual switch I want to toggle.. Thats it right?
Cheers
I have the script running every minute with Executable privilege . But the switch in Domocticz isn't changing at all. I don't think I have PHP installed on my Pi. Is this the only way? This is what my .php looks like

Cheers

I have the script running every minute with Executable privilege . But the switch in Domocticz isn't changing at all. I don't think I have PHP installed on my Pi. Is this the only way? This is what my .php looks like
Code: Select all
<?php
$domoticzurl='http://192.168.1.26:8080/';
$denon_address = 'http://192.168.1.12';
$time=$_SERVER['REQUEST_TIME'];
function Schakel($idx,$cmd) {
global $domoticzurl;
$reply=json_decode(file_get_contents($domoticzurl.'json.htm?type=command¶m=switchlight&idx='.$idx.'&switchcmd='.$cmd.'&level=0&passcode='),true);
if($reply['status']=='OK') $reply='OK';else $reply='ERROR';
return $reply;
}
$denonmain=json_decode(json_encode(simplexml_load_string(file_get_contents($denon_address.'/goform/formMainZone_MainZoneXml.xml?_='.$time,false,$ctx))),TRUE);
if($denonmain['ZonePower']['value']=='ON') Schakel(216,’On');
else Schakel(216,’Off');
- Egregius
- Posts: 2589
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Denon AV Reciver - plugin
How do you start the script?
/usr/bin/php /volume1/web/secure/cron.php ?
or just
/volume1/web/secure/cron.php ?
In the first case cron.php is good and doesn't need to be executable.
In the second case you need to add a line on top and it has to be executable.
/usr/bin/php /volume1/web/secure/cron.php ?
or just
/volume1/web/secure/cron.php ?
In the first case cron.php is good and doesn't need to be executable.
In the second case you need to add a line on top and it has to be executable.
Code: Select all
#!/usr/bin/php
-
- Posts: 612
- Joined: Wednesday 07 August 2013 19:09
- Target OS: -
- Domoticz version:
- Location: UK
- Contact:
Re: Denon AV Reciver - plugin
But to run a php script don't I have to have php installed?
I've put this in my cron * * * * * /usr/local/bin/Denon_Airplay_Check.php &> /dev/null
What else should I have done, also made the Denon_Airplay_Check.php Executable. I can't seem to run the script on its own. How would I do that?
If I could run the script from command line and see if it works but I can't seem to do that. Whats the command?
Cheers
Sent from my iPhone using Tapatalk
I've put this in my cron * * * * * /usr/local/bin/Denon_Airplay_Check.php &> /dev/null
What else should I have done, also made the Denon_Airplay_Check.php Executable. I can't seem to run the script on its own. How would I do that?
If I could run the script from command line and see if it works but I can't seem to do that. Whats the command?
Cheers
Sent from my iPhone using Tapatalk
-
- Posts: 612
- Joined: Wednesday 07 August 2013 19:09
- Target OS: -
- Domoticz version:
- Location: UK
- Contact:
Re: Denon AV Reciver - plugin
This is my new script saved as Denon_Airplay_Checl.php
How do I run that from command line? Cheers
Code: Select all
#!/usr/bin/php
<?php
$domoticzurl='http://127.0.0.1:8080/';
$denon_address = 'http://192.168.1.12';
$time=$_SERVER['REQUEST_TIME'];
function Schakel($idx,$cmd) {
global $domoticzurl;
$reply=json_decode(file_get_contents($domoticzurl.'json.htm?type=command¶m=switchlight&idx='.$idx.'&switchcmd='.$cmd.'&level=0&passcode='),true);
if($reply['status']=='OK') $reply='OK';else $reply='ERROR';
return $reply;
}
$denonmain=json_decode(json_encode(simplexml_load_string(file_get_contents($denon_address.'/goform/formMainZone_MainZoneXml.xml?_='.$time,false,$ctx))),TRUE);
if($denonmain['ZonePower']['value']=='ON') Schakel(216,’On');
else Schakel(216,’Off');
- Egregius
- Posts: 2589
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Denon AV Reciver - plugin
If you put 'echo ' in front of 'Schakel' you should see 'OK' or 'ERROR' as output.
If you dont have php installed it should be just apt-get install php (or php5, can't remember).
If you dont have php installed it should be just apt-get install php (or php5, can't remember).
Who is online
Users browsing this forum: No registered users and 1 guest