def volumedown(): """Decreases the Sonos volume by 10""" sonos.volume = sonos.volume - 10; resp = Response("Sonos volume now set to " + str(sonos.volume)) resp.volume = sonos.volume return jsonpickle.encode(resp, unpicklable=False)
def volume(): """Returns (GET) or sets (POST) the current Sonos volume (0 - 100)""" if request.method == 'POST': sonos.volume = request.form.get('volume') resp = Response("Sonos volume now set to " + str(sonos.volume)) resp.volume = sonos.volume return jsonpickle.encode(resp, unpicklable=False)