Skip to content

Commit

Permalink
Merge pull request #42 from sinricpro/2.6.2
Browse files Browse the repository at this point in the history
2.6.2 - Fix NoneType object is not callable
  • Loading branch information
kakopappa authored Jun 26, 2022
2 parents 5c13f9a + fdeb715 commit e1004e8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 43 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [2.6.2]

### Bugfix
* **'NoneType' object is not callable**

## [2.6.1]

### Features
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
if sys.version_info < (3,6):
sys.exit('Sorry, Python < 3.6 is not supported')

VERSION = "2.6.1"
VERSION = "2.6.2"

with open('README.rst', 'r') as f:
long_description = f.read()
Expand All @@ -26,8 +26,7 @@
url="https://github.com/sinricpro/python-sdk",
packages=['sinric'],
install_requires=["websockets==10.1","loguru"],
keywords=['alexa', 'alexa-skill', 'sinric', 'sinric-alexa-skill', 'alexa-home-automation', 'sinric-pro',
'sinric-pro-alexa-skill'],
keywords=['sinric', 'sinric-pro'],
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
Expand Down
43 changes: 5 additions & 38 deletions sinric/_cbhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ def jsnHandle(action, resp, dataDict, instanceId='') -> dict:
except Exception as e:
self.logger.error(str(e))



elif jsn.get('payload').get('action') == JSON_COMMANDS.get('ADJUSTRANGEVALUE'):
try:
assert (self.verifySignature(jsn.get('payload'), jsn.get("signature").get("HMAC")))
Expand Down Expand Up @@ -300,7 +298,6 @@ def jsnHandle(action, resp, dataDict, instanceId='') -> dict:
except Exception as e:
self.logger.error(str(e))


elif jsn.get('payload').get('action') == JSON_COMMANDS.get('SETVOLUME'):
try:
assert (self.verifySignature(jsn.get('payload'), jsn.get("signature").get("HMAC")))
Expand All @@ -317,8 +314,6 @@ def jsnHandle(action, resp, dataDict, instanceId='') -> dict:
except Exception as e:
self.logger.error(str(e))



elif jsn.get('payload').get('action') == 'adjustVolume':
try:
assert (self.verifySignature(jsn.get('payload'), jsn.get("signature").get("HMAC")))
Expand All @@ -335,8 +330,6 @@ def jsnHandle(action, resp, dataDict, instanceId='') -> dict:
except Exception as e:
self.logger.error(str(e))



elif jsn.get('payload').get('action') == 'mediaControl':
try:
assert (self.verifySignature(jsn.get('payload'), jsn.get("signature").get("HMAC")))
Expand Down Expand Up @@ -365,7 +358,6 @@ def jsnHandle(action, resp, dataDict, instanceId='') -> dict:
except Exception as e:
self.logger.error(str(e))


elif jsn.get('payload').get('action') == 'changeChannel':
try:
assert (self.verifySignature(jsn.get('payload'), jsn.get("signature").get("HMAC")))
Expand All @@ -383,7 +375,6 @@ def jsnHandle(action, resp, dataDict, instanceId='') -> dict:
except Exception as e:
self.logger.error(str(e))


elif jsn.get('payload').get('action') == 'skipChannels':
try:
assert (self.verifySignature(jsn.get('payload'), jsn.get("signature").get("HMAC")))
Expand Down Expand Up @@ -456,7 +447,6 @@ def jsnHandle(action, resp, dataDict, instanceId='') -> dict:
except Exception as e:
self.logger.error(str(e))


elif jsn.get('payload').get('action') == 'resetBands':
try:
assert (self.verifySignature(jsn.get('payload'), jsn.get("signature").get("HMAC")))
Expand All @@ -482,10 +472,7 @@ def jsnHandle(action, resp, dataDict, instanceId='') -> dict:
self.logger.error("Signature verification failed for " + jsn.get('payload').get('action'))
except Exception as e:
self.logger.error(str(e))





elif jsn.get('payload').get('action') == 'setMode':
try:
assert (self.verifySignature(jsn.get('payload'), jsn.get("signature").get("HMAC")))
Expand All @@ -500,8 +487,7 @@ def jsnHandle(action, resp, dataDict, instanceId='') -> dict:
self.logger.error("Signature verification failed for " + jsn.get('payload').get('action'))
except Exception as e:
self.logger.error(str(e))



elif jsn.get('payload').get('action') == 'setLockState':
try:
assert (self.verifySignature(jsn.get('payload'), jsn.get("signature").get("HMAC")))
Expand All @@ -517,117 +503,98 @@ def jsnHandle(action, resp, dataDict, instanceId='') -> dict:
except Exception as e:
self.logger.error(str(e))

############################ EVENTS ###########################################################
############################ EVENTS ###########################################################

if Trace == 'doorbell_event_response':
if self.bucket.addDrop():
self.logger.info('Sending Doorbell Event Response')
await connection.send(dumps(jsn))


elif Trace == 'temp_hum_event_response':
if self.bucket.addDrop():
self.logger.info('Sending temperature humidity response')
await connection.send(dumps(jsn))


elif Trace == 'setpowerstate_event_response':
if self.bucket.addDrop():
self.logger.info('Sending setpowerstate_event_response')
await connection.send(dumps(jsn))


elif Trace == 'setPowerLevel_event_response':
if self.bucket.addDrop():
self.logger.info('Sending setPowerLevel_event_response')
await connection.send(dumps(jsn))


elif Trace == 'setBrightness_event_response':
if self.bucket.addDrop():
self.logger.info('Sending setBrightness_event_response')
await connection.send(dumps(jsn))


elif Trace == 'setColor_event_response':
if self.bucket.addDrop():
self.logger.info('Sending setColor_event_response')
await connection.send(dumps(jsn))


elif Trace == 'setColorTemperature_event_response':
if self.bucket.addDrop():
self.logger.info('Sending setColorTemperature_event_response')
await connection.send(dumps(jsn))


elif Trace == 'setThermostatMode_event_response':
if self.bucket.addDrop():
self.logger.info('Sending setThermostatMode_event_response')
await connection.send(dumps(jsn))


elif Trace == 'setRangeValue_event_response':
if self.bucket.addDrop():
self.logger.info('Sending setRangeValue_event_response')
await connection.send(dumps(jsn))


elif Trace == 'motion_event_response':
if self.bucket.addDrop():
self.logger.info('Sending motion_event_response')
await connection.send(dumps(jsn))


elif Trace == 'contact_event_response':
if self.bucket.addDrop():
self.logger.info('Sending contact_event_response')
await connection.send(dumps(jsn))


elif Trace == 'set_volume_event_response':
if self.bucket.addDrop():
self.logger.info('Sending set_volume_event_response')
await connection.send(dumps(jsn))


elif Trace == 'select_input_event_response':
if self.bucket.addDrop():
self.logger.info('Sending select_input_event_response')
await connection.send(dumps(jsn))


elif Trace == 'media_control_event_response':
if self.bucket.addDrop():
self.logger.info('Sending media_control_event_response')
await connection.send(dumps(jsn))


elif Trace == 'change_channel_event_response':
if self.bucket.addDrop():
self.logger.info('Sending change_channel_event_response')
await connection.send(dumps(jsn))


elif Trace == 'set_bands_event_response':
if self.bucket.addDrop():
self.logger.info('Sending set_bands_event_response')
await connection.send(dumps(jsn))



elif Trace == 'set_mode_event_response':
if self.bucket.addDrop():
self.logger.info('Sending set_mode_event_response')
await connection.send(dumps(jsn))


elif Trace == 'set_lock_event_response':
if self.bucket.addDrop():
self.logger.info('Sending set_lock_event_response')
await connection.send(dumps(jsn))


elif Trace == 'reset_bands_event_response':
if self.bucket.addDrop():
self.logger.info('Sending reset_bands_event_response')
Expand All @@ -638,5 +605,5 @@ def jsnHandle(action, resp, dataDict, instanceId='') -> dict:
self.logger.info('Sending pushNotification_event')
await connection.send(dumps(jsn))

else:
self.logger.info(Trace + ' not found!')
#else:
# self.logger.info(Trace + ' not found!')
7 changes: 5 additions & 2 deletions sinric/_sinricpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ async def connect(self, udp_client=None, sleep=0):
self.connection = await self.socket.connect()
receive_message_task = asyncio.create_task(self.socket.receiveMessage(connection=self.connection))
handle_queue_task = asyncio.create_task(self.socket.handleQueue())
handle_event_queue_task = asyncio.create_task(self.event_callbacks())

await receive_message_task
await handle_queue_task
await handle_event_queue_task

if self.event_callbacks is not None:
handle_event_queue_task = asyncio.create_task(self.event_callbacks())
await handle_event_queue_task

except KeyboardInterrupt:
self.logger.error('Keyboard interrupt')
Expand Down

0 comments on commit e1004e8

Please sign in to comment.