volumio-control.py Pinbelegung
This commit is contained in:
+10
-9
@@ -11,8 +11,9 @@
|
|||||||
#
|
#
|
||||||
# nano volumio-control.py # s.u.
|
# nano volumio-control.py # s.u.
|
||||||
#
|
#
|
||||||
|
# # wait 25 seconds for the API to come online
|
||||||
# sudo nano /etc/rc.local
|
# sudo nano /etc/rc.local
|
||||||
# # su volumio -c 'sleep 20 && python3 /home/volumio/volumio-control.py >> /home/volumio/volumio-control.log 2>&1 &'
|
# # su volumio -c 'sleep 25 && python3 /home/volumio/volumio-control.py >> /home/volumio/volumio-control.log 2>&1 &'
|
||||||
#
|
#
|
||||||
# sudo reboot
|
# sudo reboot
|
||||||
#
|
#
|
||||||
@@ -31,10 +32,10 @@ sio.connect('http://localhost:3000')
|
|||||||
status = 'pause'
|
status = 'pause'
|
||||||
|
|
||||||
def button_pressed(channel):
|
def button_pressed(channel):
|
||||||
if channel == 11:
|
if channel == 19:
|
||||||
print('next')
|
print('prev')
|
||||||
sio.emit('next')
|
sio.emit('prev')
|
||||||
elif channel == 13:
|
elif channel == 21:
|
||||||
# print('state', status)
|
# print('state', status)
|
||||||
if status == 'play':
|
if status == 'play':
|
||||||
print('pause')
|
print('pause')
|
||||||
@@ -42,9 +43,9 @@ def button_pressed(channel):
|
|||||||
else:
|
else:
|
||||||
print('play')
|
print('play')
|
||||||
sio.emit('play')
|
sio.emit('play')
|
||||||
elif channel == 15:
|
elif channel == 23:
|
||||||
print('prev')
|
print('next')
|
||||||
sio.emit('prev')
|
sio.emit('next')
|
||||||
|
|
||||||
def setup_channel(channel):
|
def setup_channel(channel):
|
||||||
try:
|
try:
|
||||||
@@ -55,7 +56,7 @@ def setup_channel(channel):
|
|||||||
except (ValueError, RuntimeError) as e:
|
except (ValueError, RuntimeError) as e:
|
||||||
print('ERROR:', e)
|
print('ERROR:', e)
|
||||||
|
|
||||||
for x in [11, 13, 15]:
|
for x in [19, 21, 23]:
|
||||||
setup_channel(x)
|
setup_channel(x)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user