I have this small python file that I wrote in Python 2.7.9 and now I am testing it in Python 3.4.3.
All works, for I am able to send commands to my RPI. But when I send the command to change the volume on the speaker (ranging 1-100), they are all read by the python script as 100%.
Example:
Volume 26
, is seen as Volume 100. I add commented out the line with volume = ... and it works now but I can not prevent people from spamming the volume to the max @ 100%.
Code:
def setVolume(volume):
volume = max(60, min(30, volume)) #Volume Spam Protection
sendPost(speakerAddress+"volume","<volume>"+str(volume)+"</volume>")