jrodan
October 6, 2019, 7:22pm
1
Hi everyone,
I am working on a small raspberry webradio with a rotary encoder to control start, stop, louder, quieter commands for mopidy.
Here is my python file to control that:
# TODO stabilize script
# TODO play sounds on detected rotary event -> louder, quieter, start, stop
# coding=utf-8
import RPi.GPIO as GPIO
import time
import requests
import json
print("script loaded ... start init now")
playStatus = 0
initStatus = 0
volume = 20
def setVolume(status):
global volume
#volumeLocal = int(getState('core.mixer.get_volume'))
if(status == 0):
volume -= 5
This file has been truncated. show original
Is there something similar I could use?
Is there a better way to fulfill this requirement?
What I additionally want:
play a sound before a command is executed
cleanup script and maybe make a python module for it
Any feedback is welcome - thank you!
PS: Using a raspberry B+ I have rustle on the music boxes. Is that a known issue with the pi?
There is a Python MPD library that allows you to interface with Mopidy and query the status. I’m not sure it’s any better than what you’ve come up with.