From 6590c046997268dca520a486f54c8a6534c68d25 Mon Sep 17 00:00:00 2001 From: Aruna Tennakoon Date: Mon, 14 Feb 2022 16:26:42 +0700 Subject: [PATCH] clean up --- README.md | 103 +---------------------------------------------------- README.rst | 50 +++----------------------- setup.py | 8 +++-- 3 files changed, 10 insertions(+), 151 deletions(-) diff --git a/README.md b/README.md index a07a231..8bb3a2f 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,6 @@ ## Dependencies * Python 3.9.7 or newer * websockets 8.1 - -### Check the examples [here](https://github.com/sinricpro/Python-Examples) - -### How to set it up? click [here](https://dev.to/imdhanush/automation-with-alexa-jo) - ### Install pip install sinricpro --user @@ -22,100 +17,4 @@ pip install sinricpro --upgrade --user -### Simple example - -```python -from sinric import SinricPro -from sinric import SinricProUdp -import asyncio - -appKey = '' # d89f1***-****-****-****-************ -secretKey = '' # f44d1d31-1c19-****-****-9bc96c34b5bb-d19f42dd-****-****-****-************ -device1 = '' # 5d7e7d96069e275ea9****** -device2 = '' # 5d80ac5713fa175e99****** -deviceIdArr = [device1,device2] - -def Events(): - while True: - # Select as per your requirements - # REMOVE THE COMMENTS TO USE - # client.event_handler.raiseEvent(device1, 'setPowerState',data={'state': 'On'}) - pass -def onPowerState(did, state): - # Alexa, turn ON/OFF Device - print(did, state) - return True, state - - -eventsCallbacks={ - "Events": Events -} - -callbacks = { -'powerState': onPowerState -} - -if __name__ == '__main__': - loop = asyncio.get_event_loop() - - client = SinricPro(appKey, deviceIdArr, callbacks,event_callbacks=eventsCallbacks, - enable_log=False,restore_states=True,secretKey=secretKey) - - udp_client = SinricProUdp(callbacks,deviceIdArr, - enable_trace=False, loopInstance=loop) # Set enable_trace to True to start logging request Offline Request/Response - - loop.run_until_complete(client.connect(udp_client=udp_client)) - -``` - -### Credentials file (credential.py) - -```python -appKey = 'd89f1***-****-****-****-************' -secretKey = 'f44d1d31-1c19-****-****-9bc96c34b5bb-d19f42dd-****-****-****-************' -deviceId1 = '5d7e7d96069e275ea9******' -deviceId2 = ' 5j7e7d96069e275ea9******' -deviceId3 = ' 5d7e7d96069e275ea9******' -lock = ' 5d7e7d96069e275ea9******' -deviceIdArr = [deviceId1, deviceId2, deviceId3, lock] -``` - -### Pro Switch [Demo](https://github.com/sinricpro/Python-Examples/tree/master/pro_switch_example): - -```python -from sinric import SinricPro -from sinric import SinricProUdp -from credentials import appKey, deviceIdArr, secretKey -from time import sleep - -def Events(): - while True: - # Select as per your requirements - # REMOVE THE COMMENTS TO USE - # client.event_handler.raiseEvent(device1, 'setPowerState',data={'state': 'On'}) - pass -def onPowerState(did, state): - # Alexa, turn ON/OFF Device - print(did, state) - return True, state - - -eventsCallbacks={ - "Events": Events -} - -callbacks = { -'powerState': onPowerState -} - -if __name__ == '__main__': - loop = asyncio.get_event_loop() - - client = SinricPro(appKey, deviceIdArr, callbacks,event_callbacks=eventsCallbacks, - enable_log=False,restore_states=True,secretKey=secretKey) - - udp_client = SinricProUdp(callbacks,deviceIdArr, - enable_trace=False, loopInstance=loop) # Set enable_trace to True to start logging request Offline Request/Response - - loop.run_until_complete(client.connect(udp_client=udp_client)) -``` +### Check the examples [here](https://github.com/sinricpro/Python-Examples) \ No newline at end of file diff --git a/README.rst b/README.rst index c28e98a..3d9060a 100644 --- a/README.rst +++ b/README.rst @@ -1,17 +1,7 @@ SINRIC PRO =============== -This is a python library for alexa home automation skill - SINRIC PRO https://sinric.pro/ - - -Python-2.7 Not Supported -======================== - - -Functions: ----------- -* Automate your home using alexa with sinricpro +Automate your home using Amazon Alexa, Google Home, SmartThings with Sinric Pro https://sinric.pro/ Installation : -------------- @@ -23,39 +13,7 @@ Python3 python3 -m pip install sinricpro --user +Examples : +-------------- -Pro Switch Demo: -~~~~~~~~~~~~~~~~~ - -:: - - from sinric import SinricPro - from sinric import SinricProUdp - from credentials import appKey, deviceId, secretKey - from time import sleep - - def Events(): - while True: - # Select as per your requirements - # REMOVE THE COMMENTS TO USE - # client.event_handler.raiseEvent(deviceId1, 'setPowerState',data={'state': 'On'}) - sleep(2) #Sleep for 2 seconds - - def onPowerState(did, state): - # Alexa, turn ON/OFF Device - print(did, state) - return True, state - - - eventsCallbacks={ - "Events": Events - } - - callbacks = { - 'powerState': onPowerState - } - - if __name__ == '__main__': - client = SinricPro(appKey, deviceId, callbacks,event_callbacks=eventsCallbacks, enable_trace=False,secretKey=secretKey) - udp_client = SinricProUdp(callbacks,deviceId,enable_trace=False) # Set it to True to start logging request Offline Request/Response - client.handle_all(udp_client) +https://github.com/sinricpro/python-examples \ No newline at end of file diff --git a/setup.py b/setup.py index 9ffaa73..43b3d78 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ if sys.version_info < (3,6): sys.exit('Sorry, Python < 3.6 is not supported') -VERSION = "2.4.2" +VERSION = "2.5.1" with open('README.rst', 'r') as f: long_description = f.read() @@ -20,11 +20,13 @@ version=VERSION, author="Dhanush", author_email="dhanushdazz@gmail.com", - description="A python package for your sinric-pro alexa skill", + maintainer = 'sinric', + maintainer_email = 'support@sinric.com', + description="A python package for your Sinric Pro", long_description=long_description, url="https://github.com/sinricpro/python-sdk", packages=['sinric'], - install_requires=["websockets","loguru"], + install_requires=["websockets==8.1","loguru"], keywords=['alexa', 'alexa-skill', 'sinric', 'sinric-alexa-skill', 'alexa-home-automation', 'sinric-pro', 'sinric-pro-alexa-skill'], classifiers=[