diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-05 06:46:27 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 06:46:27 +0000 |
| commit | 64992cd414300ddde27170340a20fa29f7436b19 (patch) | |
| tree | 9ab63de26d165cc4f419817f2bbd504af3b9f1b1 | |
| parent | 56d0c42e91dfd554b87a32029c0a7c09774afa04 (diff) | |
automatic import of python-pysmartthingsopeneuler20.03
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-pysmartthings.spec | 502 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 504 insertions, 0 deletions
@@ -0,0 +1 @@ +/pysmartthings-0.7.7.tar.gz diff --git a/python-pysmartthings.spec b/python-pysmartthings.spec new file mode 100644 index 0000000..6cc9e28 --- /dev/null +++ b/python-pysmartthings.spec @@ -0,0 +1,502 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pysmartthings +Version: 0.7.7 +Release: 1 +Summary: A python library for interacting with the SmartThings cloud API build with asyncio and aiohttp. +License: ASL 2.0 +URL: https://github.com/andrewsayre/pysmartthings +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ba/bc/8d364c93d9f9b10d04a28835aff00bc89a960684ccabdcdf30fcf367064e/pysmartthings-0.7.7.tar.gz +BuildArch: noarch + +Requires: python3-aiohttp + +%description +# pysmartthings + +[](https://pypi.org/project/pysmartthings/) +[](https://pypi.org/project/pysmartthings/) +[](https://pypi.org/project/pysmartthings/) + +A python library for interacting with the SmartThings cloud API build with [asyncio](https://docs.python.org/3/library/asyncio.html) and [aiohttp](https://aiohttp.readthedocs.io/en/stable/). + +## Features + +The package is still in beta, but the following features are available: + +1. Locations: List, Get +1. Rooms: List, Get, Create, Update, Deletegit +1. Devices: List, Get, Command, Status +1. Apps: List, Get, Create, Update, Delete, Settings Get & Update, OAuth: Get, Update, & Generate +1. InstalledApps: List, Get, Delete +1. Subscriptions: List, Get, Create, Delete, Delete All +1. Scenes: List, Execute +1. OAuth: Generate refresh/access token pair + +## Installation + +```commandline +pip install pysmartthings +``` + +or + +```commandline +pip install --use-wheel pysmartthings +``` + +## Usage + +### Initialization + +The SmartThings class encapsulates the API operations and the constructor accepts the aiohttp `WebSession` and your [personal access token](https://account.smartthings.com/tokens). + +```pythonstub +import aiohttp +import pysmartthings + +token = 'PERSONAL_ACCESS_TOKEN' + +async with aiohttp.ClientSession() as session: + api = pysmartthings.SmartThings(session, token) + # ... +``` + +### Locations + +A list of locations in SmartThings can be retrieved by invoking the coroutine `locations()`. + +```pythonstub + locations = await api.locations() + print(len(locations)) + + location = locations[0] + print(location.name) + print(location.location_id) +``` + +Outputs: + +```pythonstub +2 +'Test Home' +'5c03e518-118a-44cb-85ad-7877d0b302e4' +``` + +### Devices + +A list of devices can be retrieved by invoking the coroutine `devices(location_ids=None, capabilities=None, device_ids=None)`. The optional parameters allow filtering the returned list. + +```pythonstub + devices = await api.devices() + print(len(devices)) + + device = devices[0] + print(device.device_id) + print(device.name) + print(device.label) + print(device.capabilities) +``` + +Outputs: + +```pythonstub +19 +'0d38d5ca-705f-44f7-89bd-36a8cf73678d' +'GE In-Wall Smart Dimmer' +'Back Patio Light' +['switch', 'switchLevel', 'refresh', 'indicator', 'button', 'sensor', 'actuator', 'healthCheck', 'light'] +``` + +The current status of the device is populated when the coroutine `status.refresh()` is called. The DeviceStatus class represents the current values of the capabilities and provides several normalized property accessors. + +```pythonstub + await device.status.refresh() + print(device.status.values) + print(device.status.switch) + print(device.status.level) +``` + +Outputs: + +```pythonstub +{'button': 'pressed', 'numberOfButtons': None, 'supportedButtonValues': None, 'indicatorStatus': 'when off', 'switch': 'on', 'checkInterval': 1920, 'healthStatus': None, 'DeviceWatch-DeviceStatus': None, 'level': 100} +True +100 +``` + +#### Device Commands + +You can execute a command on a device by calling the coroutine `command(component_id, capability, command, args=None)` function. The `component_id` parameter is the identifier of the component within the device (`main` is the device itself); `capability` is the name of the capability implemented by the device; and `command` is one of the defined operations within the capability. `args` is an array of parameters to pass to the command when it accepts parameters (optional). See the [SmartThings Capability Reference](https://smartthings.developer.samsung.com/develop/api-ref/capabilities.html) for more information. + +```pythonstub + result = await device.command("main", "switch", "on") + assert result == True + + result = await device.command("main", "switchLevel", "setLevel", [75, 2]) + assert result == True +``` + +Devices with the `switch` capability have the following coroutines: + +```pythonstub + result = await device.switch_on() + assert result == True + + result = await device.switch_off() + assert result == True +``` + +Devices with the `switchLevel` capability have the following function that sets the target brightness level and transitions using a specific duration (seconds). + +```pythonstub + result = await device.set_level(75, 2) + assert result == True +``` + + + + +%package -n python3-pysmartthings +Summary: A python library for interacting with the SmartThings cloud API build with asyncio and aiohttp. +Provides: python-pysmartthings +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pysmartthings +# pysmartthings + +[](https://pypi.org/project/pysmartthings/) +[](https://pypi.org/project/pysmartthings/) +[](https://pypi.org/project/pysmartthings/) + +A python library for interacting with the SmartThings cloud API build with [asyncio](https://docs.python.org/3/library/asyncio.html) and [aiohttp](https://aiohttp.readthedocs.io/en/stable/). + +## Features + +The package is still in beta, but the following features are available: + +1. Locations: List, Get +1. Rooms: List, Get, Create, Update, Deletegit +1. Devices: List, Get, Command, Status +1. Apps: List, Get, Create, Update, Delete, Settings Get & Update, OAuth: Get, Update, & Generate +1. InstalledApps: List, Get, Delete +1. Subscriptions: List, Get, Create, Delete, Delete All +1. Scenes: List, Execute +1. OAuth: Generate refresh/access token pair + +## Installation + +```commandline +pip install pysmartthings +``` + +or + +```commandline +pip install --use-wheel pysmartthings +``` + +## Usage + +### Initialization + +The SmartThings class encapsulates the API operations and the constructor accepts the aiohttp `WebSession` and your [personal access token](https://account.smartthings.com/tokens). + +```pythonstub +import aiohttp +import pysmartthings + +token = 'PERSONAL_ACCESS_TOKEN' + +async with aiohttp.ClientSession() as session: + api = pysmartthings.SmartThings(session, token) + # ... +``` + +### Locations + +A list of locations in SmartThings can be retrieved by invoking the coroutine `locations()`. + +```pythonstub + locations = await api.locations() + print(len(locations)) + + location = locations[0] + print(location.name) + print(location.location_id) +``` + +Outputs: + +```pythonstub +2 +'Test Home' +'5c03e518-118a-44cb-85ad-7877d0b302e4' +``` + +### Devices + +A list of devices can be retrieved by invoking the coroutine `devices(location_ids=None, capabilities=None, device_ids=None)`. The optional parameters allow filtering the returned list. + +```pythonstub + devices = await api.devices() + print(len(devices)) + + device = devices[0] + print(device.device_id) + print(device.name) + print(device.label) + print(device.capabilities) +``` + +Outputs: + +```pythonstub +19 +'0d38d5ca-705f-44f7-89bd-36a8cf73678d' +'GE In-Wall Smart Dimmer' +'Back Patio Light' +['switch', 'switchLevel', 'refresh', 'indicator', 'button', 'sensor', 'actuator', 'healthCheck', 'light'] +``` + +The current status of the device is populated when the coroutine `status.refresh()` is called. The DeviceStatus class represents the current values of the capabilities and provides several normalized property accessors. + +```pythonstub + await device.status.refresh() + print(device.status.values) + print(device.status.switch) + print(device.status.level) +``` + +Outputs: + +```pythonstub +{'button': 'pressed', 'numberOfButtons': None, 'supportedButtonValues': None, 'indicatorStatus': 'when off', 'switch': 'on', 'checkInterval': 1920, 'healthStatus': None, 'DeviceWatch-DeviceStatus': None, 'level': 100} +True +100 +``` + +#### Device Commands + +You can execute a command on a device by calling the coroutine `command(component_id, capability, command, args=None)` function. The `component_id` parameter is the identifier of the component within the device (`main` is the device itself); `capability` is the name of the capability implemented by the device; and `command` is one of the defined operations within the capability. `args` is an array of parameters to pass to the command when it accepts parameters (optional). See the [SmartThings Capability Reference](https://smartthings.developer.samsung.com/develop/api-ref/capabilities.html) for more information. + +```pythonstub + result = await device.command("main", "switch", "on") + assert result == True + + result = await device.command("main", "switchLevel", "setLevel", [75, 2]) + assert result == True +``` + +Devices with the `switch` capability have the following coroutines: + +```pythonstub + result = await device.switch_on() + assert result == True + + result = await device.switch_off() + assert result == True +``` + +Devices with the `switchLevel` capability have the following function that sets the target brightness level and transitions using a specific duration (seconds). + +```pythonstub + result = await device.set_level(75, 2) + assert result == True +``` + + + + +%package help +Summary: Development documents and examples for pysmartthings +Provides: python3-pysmartthings-doc +%description help +# pysmartthings + +[](https://pypi.org/project/pysmartthings/) +[](https://pypi.org/project/pysmartthings/) +[](https://pypi.org/project/pysmartthings/) + +A python library for interacting with the SmartThings cloud API build with [asyncio](https://docs.python.org/3/library/asyncio.html) and [aiohttp](https://aiohttp.readthedocs.io/en/stable/). + +## Features + +The package is still in beta, but the following features are available: + +1. Locations: List, Get +1. Rooms: List, Get, Create, Update, Deletegit +1. Devices: List, Get, Command, Status +1. Apps: List, Get, Create, Update, Delete, Settings Get & Update, OAuth: Get, Update, & Generate +1. InstalledApps: List, Get, Delete +1. Subscriptions: List, Get, Create, Delete, Delete All +1. Scenes: List, Execute +1. OAuth: Generate refresh/access token pair + +## Installation + +```commandline +pip install pysmartthings +``` + +or + +```commandline +pip install --use-wheel pysmartthings +``` + +## Usage + +### Initialization + +The SmartThings class encapsulates the API operations and the constructor accepts the aiohttp `WebSession` and your [personal access token](https://account.smartthings.com/tokens). + +```pythonstub +import aiohttp +import pysmartthings + +token = 'PERSONAL_ACCESS_TOKEN' + +async with aiohttp.ClientSession() as session: + api = pysmartthings.SmartThings(session, token) + # ... +``` + +### Locations + +A list of locations in SmartThings can be retrieved by invoking the coroutine `locations()`. + +```pythonstub + locations = await api.locations() + print(len(locations)) + + location = locations[0] + print(location.name) + print(location.location_id) +``` + +Outputs: + +```pythonstub +2 +'Test Home' +'5c03e518-118a-44cb-85ad-7877d0b302e4' +``` + +### Devices + +A list of devices can be retrieved by invoking the coroutine `devices(location_ids=None, capabilities=None, device_ids=None)`. The optional parameters allow filtering the returned list. + +```pythonstub + devices = await api.devices() + print(len(devices)) + + device = devices[0] + print(device.device_id) + print(device.name) + print(device.label) + print(device.capabilities) +``` + +Outputs: + +```pythonstub +19 +'0d38d5ca-705f-44f7-89bd-36a8cf73678d' +'GE In-Wall Smart Dimmer' +'Back Patio Light' +['switch', 'switchLevel', 'refresh', 'indicator', 'button', 'sensor', 'actuator', 'healthCheck', 'light'] +``` + +The current status of the device is populated when the coroutine `status.refresh()` is called. The DeviceStatus class represents the current values of the capabilities and provides several normalized property accessors. + +```pythonstub + await device.status.refresh() + print(device.status.values) + print(device.status.switch) + print(device.status.level) +``` + +Outputs: + +```pythonstub +{'button': 'pressed', 'numberOfButtons': None, 'supportedButtonValues': None, 'indicatorStatus': 'when off', 'switch': 'on', 'checkInterval': 1920, 'healthStatus': None, 'DeviceWatch-DeviceStatus': None, 'level': 100} +True +100 +``` + +#### Device Commands + +You can execute a command on a device by calling the coroutine `command(component_id, capability, command, args=None)` function. The `component_id` parameter is the identifier of the component within the device (`main` is the device itself); `capability` is the name of the capability implemented by the device; and `command` is one of the defined operations within the capability. `args` is an array of parameters to pass to the command when it accepts parameters (optional). See the [SmartThings Capability Reference](https://smartthings.developer.samsung.com/develop/api-ref/capabilities.html) for more information. + +```pythonstub + result = await device.command("main", "switch", "on") + assert result == True + + result = await device.command("main", "switchLevel", "setLevel", [75, 2]) + assert result == True +``` + +Devices with the `switch` capability have the following coroutines: + +```pythonstub + result = await device.switch_on() + assert result == True + + result = await device.switch_off() + assert result == True +``` + +Devices with the `switchLevel` capability have the following function that sets the target brightness level and transitions using a specific duration (seconds). + +```pythonstub + result = await device.set_level(75, 2) + assert result == True +``` + + + + +%prep +%autosetup -n pysmartthings-0.7.7 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pysmartthings -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.7.7-1 +- Package Spec generated @@ -0,0 +1 @@ +dd025b0fefbbd7203e64dd187b2e9b11 pysmartthings-0.7.7.tar.gz |
