Sorry I'm once coming again with the Trigger Output Voltage for my
Amplifier.

There is a solution in on the regular Pi & Squeezeboxsetup. Could it be
possible to implement this on the PiCorePlayer? And maby better straight
with the Play comand and not Power of the Player, would make more sense
for me


Here it is: 
My LMS is 192.168.1.39 Playername: Esszimmer

code:

import sys, string, select
from socket import *
import RPi.GPIO as GPIO

# Define maximum xPL message size
buff = 1500

# Define xPL base port
port = 3865

# Sub routine for sending a heartbeat
def SendHeartbeat() :
hbSock = socket(AF_INET,SOCK_DGRAM)
hbSock.setsockopt(SOL_SOCKET,SO_BROADCAST,1)
msg =
"xpl-stat\n{\nhop=1\nsource=johnb-monitor.python\ntarget=*\n}\nhbeat.app\n{\ninterval=5\nport="
+ str(port) + "\n}\n"
hbSock.sendto(msg,("192.168.1.255",3865))


# Initialise the socket
UDPSock = socket(AF_INET,SOCK_DGRAM)
addr = ("0.0.0.0",port)

# Try and bind to the base port
try :
UDPSock.bind(addr)
except :
# A hub is running, so bind to a high port
port = 50000

addr = ("192.168.1.39",port)
try :
UDPSock.bind(addr)
except :
port += 1

print "xPL Monitor for Python, bound to port " + str(port)

SendHeartbeat()

while 1==1 :
readable, writeable, errored = select.select([UDPSock],[],[],60)

if len(readable) == 1 :
data,addr = UDPSock.recvfrom(buff)
print data
radioname = "Esszimmer"
if radioname in data :
if "POWER=1" in data :
print radioname + " is on"
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, True)
elif "POWER=0" in data :
print radioname + " is off"
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, False)
else :
print "other message for " + radioname


------------------------------------------------------------------------
palmerx's Profile: http://forums.slimdevices.com/member.php?userid=63498
View this thread: http://forums.slimdevices.com/showthread.php?t=97803

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to