Created
August 22, 2017 20:48
-
-
Save eruvanos/bb600eddd2f2cdf5327c8b53b7736f5d to your computer and use it in GitHub Desktop.
Sonos Remote Volume Control 433 MHz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::cout << std::flush |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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