Skip to content

Commit

Permalink
Demo update
Browse files Browse the repository at this point in the history
  • Loading branch information
thegoliathgeek committed Aug 21, 2019
1 parent 7ac97d1 commit 6202931
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ sinricpro_logfile*
tests/
test_bulb.py
credentials.py
test_eve*
test_eve*
localdata*
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ from credentials import apiKey, deviceId

def onPowerState(did, state):
# Alexa, turn ON/OFF Device
print(did, state['state'])
return True, state['state']
print(did, state)
return True, state


callbacks = {
Expand All @@ -43,8 +43,8 @@ from credentials import apiKey, deviceId

def onPowerState(did, state):
# Alexa, turn ON/OFF Device
print(did, state['state'])
return True, state['state']
print(did, state)
return True, state


def onSetPowerLevel(did, state):
Expand Down Expand Up @@ -81,8 +81,8 @@ from sinric import SinricProUdp

def onPowerState(did, state):
# Alexa, turn ON/OFF Device
print(did, state['state'])
return True, state['state']
print(did, state)
return True, state


def onSetBrightness(did, state):
Expand Down
6 changes: 2 additions & 4 deletions sinric/_dataTracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,24 @@ class DataTracker:
def __init__(self, enable_track):
self.enable_track = enable_track
if os.path.exists('localdata.json'):
f = open('localdata.json','r')
f = open('localdata.json', 'r')
self.data = json.load(f)
f.close()
else:
f = open('localdata.json', 'w')
data = {'volume': 0, 'powerLevel': 0, 'brightness': 0, 'bands': 0, 'colorTemperature': 0, 'temperature': 0,
'rangeValue': 0}
'rangeValue': 0, "bands": {"name": "", "level": 0}}
json.dump(data, f)
self.data = data
f.close()


@classmethod
def readData(self, key):
f = open('localdata.json', 'r')
data = json.load(f).get(key, False)
f.close()
return data


def writeData(self, key, value):
f = open('localdata.json', 'w')
self.data.update({key: value})
Expand Down
4 changes: 2 additions & 2 deletions sinric/_speakerController.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class SpeakerController:

def __init__(self, x):
self.band=0
# self.bands = DataTracker.readData('bands')
# self.band = self.bands.get('level')
self.bands = DataTracker.readData('bands')
self.band = self.bands.get('level')


async def setBands(self, jsn, callback):
Expand Down

0 comments on commit 6202931

Please sign in to comment.