Skip to content

Instantly share code, notes, and snippets.

@eruvanos
Created August 22, 2017 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eruvanos/bb600eddd2f2cdf5327c8b53b7736f5d to your computer and use it in GitHub Desktop.
Save eruvanos/bb600eddd2f2cdf5327c8b53b7736f5d to your computer and use it in GitHub Desktop.
Sonos Remote Volume Control 433 MHz
std::cout << std::flush
import soco
from subprocess import Popen, PIPE, STDOUT
INC_CODE = '4216115'
DEC_CODE = '4216124'
AMOUNT = 5
SONOS_IP=192.168.178.24
print("Start sonosremote")
livingroom = soco.SoCo(SONOS_IP)
print("Actual volume:", livingroom.volume)
def inc_volume():
livingroom.volume += AMOUNT
print('volume is now: %s' % livingroom.volume)
def dec_volume():
livingroom.volume -= AMOUNT
print('volume is now: %s' % livingroom.volume)
# RFSniffer has to get modified like file below
proc = Popen(['RFSniffer'], stdout=PIPE, universal_newlines=True)
while True:
line = proc.stdout.readline()
if line != '':
line = line.strip()
print("Received code:", line)
if line == INC_CODE:
inc_volume()
elif line == DEC_CODE:
dec_volume()
else:
break
print('Programm ended')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment