volumio-control.py Pinbelegung

This commit is contained in:
2024-09-01 16:29:40 +00:00
parent c80b969453
commit 6782aaccd7
+10 -9
View File
@@ -11,8 +11,9 @@
#
# nano volumio-control.py # s.u.
#
# # wait 25 seconds for the API to come online
# 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
#
@@ -31,10 +32,10 @@ sio.connect('http://localhost:3000')
status = 'pause'
def button_pressed(channel):
if channel == 11:
print('next')
sio.emit('next')
elif channel == 13:
if channel == 19:
print('prev')
sio.emit('prev')
elif channel == 21:
# print('state', status)
if status == 'play':
print('pause')
@@ -42,9 +43,9 @@ def button_pressed(channel):
else:
print('play')
sio.emit('play')
elif channel == 15:
print('prev')
sio.emit('prev')
elif channel == 23:
print('next')
sio.emit('next')
def setup_channel(channel):
try:
@@ -55,7 +56,7 @@ def setup_channel(channel):
except (ValueError, RuntimeError) as e:
print('ERROR:', e)
for x in [11, 13, 15]:
for x in [19, 21, 23]:
setup_channel(x)