The line with information is
Code: Select all
<InputFuncSelect>
<value>Squeezebox</value>
</InputFuncSelect>
Moderator: leecollings
Code: Select all
<InputFuncSelect>
<value>Squeezebox</value>
</InputFuncSelect>
Code: Select all
curl http://$DENONIP/goform/formMainZone_MainZoneXml.xml | grep -oP '(?<=<InputFuncSelect><value>).*(?=</value)'
Code: Select all
curl http://DENON_IP/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FON
Code: Select all
#!/bin/bash
# Settings
DENONIP="192.168.1.18" # Denon IP Address
DOMO_IP="192.168.1.26" # Domoticz IP Address
DOMO_PORT="8080" # Domoticz Port
DENON_IDX="73" # Denon Switch IDX
DENON_VOL_IDX="64" # Denon volume IDX
DENON_INPUT_IDX="72" # Denon input IDX
DENON_STATUS_IDX="63" # Denon status IDX
# Check if receiver in online
PINGTIME=`ping -c 1 -q $DENONIP | awk -F"/" '{print $5}' | xargs`
echo $PINGTIME
if expr "$PINGTIME" '>' 0
then
curl http://$DENONIP/goform/formMainZone_MainZoneXml.xml | grep -oP '(?<=<Power><value>).*(?=</value)' | grep "ON"
if [ $? -eq 0 ] ; then
echo "Denon already ON"
# get xml
curl http://$DENONIP/goform/formMainZone_MainZoneXml.xml > test.txt
# Volume
AVvolume=`grep -oP '(?<=<MasterVolume><value>-).*(?=</value)' test.txt`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$DENON_VOL_IDX&nvalue=0&svalue=$AVvolume"
# Status
AVstatus=`grep -oP '(?<=<Power><value>).*(?=</value)' test.txt`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$DENON_STATUS_IDX&nvalue=0&svalue=$AVstatus"
# Input
AVinput=`grep -oP '(?<=<InputFuncSelect><value>).*(?=</value)' test.txt`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$DENON_INPUT_IDX&nvalue=0&svalue=$AVinput"
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=switchlight&idx=$DENON_IDX&switchcmd=On"
else
# get xml
curl http://$DENONIP/goform/formMainZone_MainZoneXml.xml > test.txt
echo "Denon OFF"
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=switchlight&idx=$DENON_IDX&switchcmd=Off"
# Status
AVstatus=`grep -oP '(?<=<Power><value>).*(?=</value)' test.txt`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$DENON_STATUS_IDX&nvalue=0&svalue=$AVstatus"
fi
else
echo "Denon already OFF"
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=switchlight&idx=$DENON_IDX&switchcmd=Off"
fi
Code: Select all
curl http://DENON_IP/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FON # receiver on
curl http://DENON_IP/MainZone/index.put.asp?cmd0=PutSystem_OnStandby%2FSTANDBY # receiver standby
Code: Select all
pi@raspberrypi ~/domoticz/scripts $ ./Denon.sh
0.683
1
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1510 0 1510 0 0 19329 0 --:--:-- --:--:-- --:--:-- 26491
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1510 0 1510 0 0 21287 0 --:--:-- --:--:-- --:--:-- 29607
Denon OFF
HTTP/1.0 200 OK
Content-Length: 24
Content-Type: text/html;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
{
"status" : "ERR"
}
HTTP/1.0 200 OK
Content-Length: 24
Content-Type: text/html;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
{
"status" : "ERR"
}
Code: Select all
pi@raspberrypi ~/domoticz/scripts $ ./Denon.sh
4.730
1
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1504 0 1504 0 0 21973 0 --:--:-- --:--:-- --:--:-- 28377
ON
Denon already ON
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1504 0 1504 0 0 27870 0 --:--:-- --:--:-- --:--:-- 39578
HTTP/1.0 200 OK
Content-Length: 53
Content-Type: text/html;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
{
"status" : "OK",
"title" : "Update Device"
}
HTTP/1.0 200 OK
Content-Length: 53
Content-Type: text/html;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
{
"status" : "OK",
"title" : "Update Device"
}
HTTP/1.0 200 OK
Content-Length: 53
Content-Type: text/html;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
{
"status" : "OK",
"title" : "Update Device"
}
HTTP/1.0 200 OK
Content-Length: 51
Content-Type: text/html;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
{
"status" : "OK",
"title" : "SwitchLight"
}
Code: Select all
*/2 * * * * /home/pi/domoticz/scripts/denon.sh
There are 2 modes you can use for Volume control with Denon. The first one is sound level - between 0 and 80 and the other one is attenuation, so muting. With the first one, you set the level to (ie. 30) and the value you set is 30-80, meaning you mute it by -50. With db, it is even more visible as you are specifying directly, you are attenuating by ie. 30db. I hope, I made myself clear.Panda wrote:Thank you for the script, strange thing is that my Denon Avr-x1200 displays 44db but the script and xml page returns 36, what could cause this?
Would be cool to have all this info into one switch.
Edit: When I put it on 40db it will show 40db but when I put it higher then 40db it will go down, so 40.5 gives me 39.5 strange..., what I also noticed is that when you changed input name like I did, e.g. Mac Mini it will return http error bad request because the input name contains a space. Anyway to fix this to send space to domoticz?
Users browsing this forum: No registered users and 1 guest