summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-wirelesstagpy.spec641
-rw-r--r--sources1
3 files changed, 643 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..7228227 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/wirelesstagpy-0.8.1.tar.gz
diff --git a/python-wirelesstagpy.spec b/python-wirelesstagpy.spec
new file mode 100644
index 0000000..ea6ca49
--- /dev/null
+++ b/python-wirelesstagpy.spec
@@ -0,0 +1,641 @@
+%global _empty_manifest_terminate_build 0
+Name: python-wirelesstagpy
+Version: 0.8.1
+Release: 1
+Summary: Simple python wrapper over wirelesstags REST API
+License: MIT
+URL: https://github.com/sergeymaysak/wirelesstagpy/
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f6/ba/ffa6588000be0319adf3750273c150e48f5a15e167839867e277401fa68a/wirelesstagpy-0.8.1.tar.gz
+BuildArch: noarch
+
+Requires: python3-requests
+Requires: python3-unittest
+
+%description
+# WirelessSensorTags [![Build Status](https://travis-ci.org/sergeymaysak/wirelesstagpy.svg?branch=master)](https://travis-ci.com/sergeymaysak/wirelesstagpy) [![Coverage Status](https://coveralls.io/repos/github/sergeymaysak/wirelesstagpy/badge.svg?branch=master)](https://coveralls.io/github/sergeymaysak/wirelesstagpy?branch=master) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/wirelesstagpy.svg) ![PyPi - Version](https://img.shields.io/pypi/v/wirelesstagpy.svg)
+
+A simple python wrapper library for Wireless Sensor Tag platform (`http://wirelesstag.net`).
+
+Supports getting data for registered by end user sensor tags.
+wirelesstag.net account credentials are needed to use this lib.
+Enabling tags sharing is not required.
+
+Verified with:
+
+- 13-bit motion/temperature/humidity tags (type 13)
+- Water/Moisture tags (type 32)
+- ALS Pro tag (type 26)
+- PIR Kumo sensor (type 72)
+
+## Installation
+
+```shell
+pip3 install wirelesstagpy
+```
+
+## Development notes
+
+See [apidoc.html](http://wirelesstag.net/apidoc.html) for API details.
+
+## Usage
+
+### Fetch all tags
+
+```python
+
+import wirelesstagpy
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+tags = api.load_tags()
+for (uuid, tag) in tags.items():
+ print('Loaded tag: {}, temp: {}, humidity: {} probe taken: {}'.format(
+ tag.name, tag.temperature,
+ tag.humidity, tag.time_since_last_update))
+
+```
+
+## Install custom push notifications
+
+Wireless Sensor Tags platforms allows to setup custom url calls for set of specific events.
+
+```python
+
+
+import wirelesstagpy
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+notifications = [
+ NotificationConfig('update', {
+ 'url': 'http://some_local_ip/update_tags',
+ 'verb': 'POST'
+ 'disabled': False,
+ 'nat': True
+ })
+]
+
+# install notification for tag with id=1 only
+# use it you have only one tag manager
+succeed = api.install_push_notification(1, notifications, False)
+
+# if you have multiple tag managers you need specify its 'mac' stored in each tag as following
+succeed = api.install_push_notification(sensor.tag_id, notifications, False,
+ sensor.tag_manager_mac)
+
+```
+
+## Monitor push events from cloud
+
+Wireless Sensor Tags platform allows to monitor state of sensors with push notification on change right from cloud.
+
+```python
+
+import wirelesstagspy
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+def callback(tags_spec, events_spec):
+ for (uuid, tag) in tags_spec.items():
+ if uuid in events_spec:
+ events = events_spec[uuid]
+ print("triggered events: {}".format(events))
+ print("updated tag: {}".format(tag))
+
+# starts long running thread with getting updates from cloud immidiately when change happens.
+# it is not a polling, but rather a similar to WebSockets get update logic
+api.start_monitoring(callback)
+
+```
+
+## Arm/Disarm sensor monitoring for specific event
+
+Supported events include: motion, temperature, humidity, light
+
+```python
+
+import wirelesstagpy
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+
+# arm humidity monitoring for tag with id 1,
+# returned instance is updated SensorTag
+sensor = api.arm_humidity(1)
+
+# Disarm it
+sensor = api.disarm_humidity(1)
+
+# Specify tag manager if you have multiple tag managers
+sensor = api.arm_humidity(sensor.tag_id, sensor.tag_manager_mac)
+
+```
+
+## Working with sensors and binary events
+
+Single tag holds notion of multiple sensors and binary events.
+Each sensor is entity representing single sensing metric such as temperature, humidity, moisture, light or motion.
+You can get list of supported sensors and binary events by calling `tag.allowed_sensor_types` for sensors,
+`tag.supported_binary_events_types` for binary events.
+Also you can query tag on list of supported monitoring conditions that can be represented as switches to be armed/disarmed by calling `tag.allowed_monitoring_types`.
+
+Handling sensors:
+
+```python
+
+import wirelesstagpy
+import wirelesstagpy.constants as CONST
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+tags = api.load_tags()
+
+# get temperature sensor value for tag
+for (uuid, tag) in tags.items():
+ sensor = tag.sensor[CONST.SENSOR_TEMPERATURE]
+ if sensor is not None:
+ print('{} temperature: {}'.format(tag.name, sensor.value))
+
+```
+
+Handling binary events:
+
+```python
+
+import wirelesstagpy
+import wirelesstagpy.constants as CONST
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+tags = api.load_tags()
+
+# get motion binary event state for each tag
+for (uuid, tag) in tags.items():
+ if CONST.EVENT_MOTION in tag.supported_binary_events_types:
+ event = tag.event[CONST.EVENT_MOTION]
+ print('tag {} event state: {}'.format(tag.name, event.is_state_on))
+
+```
+
+Use binary events to build custom push notifications configurations
+
+```python
+
+import wirelesstagpy
+import wirelesstagpy.constants as CONST
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+tags = api.load_tags()
+tag = tags['uuid-of-tag-in-question']
+event = tag.event[CONST.EVENT_MOISTURE]
+if event is not None:
+ configs = event.build_notifications('http://path_to_post', tag.tag_manager_mac)
+ # install it for any tags of tag manager
+ succeed = api.install_push_notification(0, configs, True,
+ tag.tag_manager_mac)
+```
+
+## Disclaimer
+
+"Wireless Sensor Tags", "KumoSensor" and "Kumostat" are trademarks of Cao Gadgets LLC,
+see www.wirelesstag.net for more information.
+
+I am in no way affiliated with Cao Gadgets LLC.
+
+## Copyright
+
+See [LICENSE](LICENSE)
+
+
+
+
+%package -n python3-wirelesstagpy
+Summary: Simple python wrapper over wirelesstags REST API
+Provides: python-wirelesstagpy
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-wirelesstagpy
+# WirelessSensorTags [![Build Status](https://travis-ci.org/sergeymaysak/wirelesstagpy.svg?branch=master)](https://travis-ci.com/sergeymaysak/wirelesstagpy) [![Coverage Status](https://coveralls.io/repos/github/sergeymaysak/wirelesstagpy/badge.svg?branch=master)](https://coveralls.io/github/sergeymaysak/wirelesstagpy?branch=master) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/wirelesstagpy.svg) ![PyPi - Version](https://img.shields.io/pypi/v/wirelesstagpy.svg)
+
+A simple python wrapper library for Wireless Sensor Tag platform (`http://wirelesstag.net`).
+
+Supports getting data for registered by end user sensor tags.
+wirelesstag.net account credentials are needed to use this lib.
+Enabling tags sharing is not required.
+
+Verified with:
+
+- 13-bit motion/temperature/humidity tags (type 13)
+- Water/Moisture tags (type 32)
+- ALS Pro tag (type 26)
+- PIR Kumo sensor (type 72)
+
+## Installation
+
+```shell
+pip3 install wirelesstagpy
+```
+
+## Development notes
+
+See [apidoc.html](http://wirelesstag.net/apidoc.html) for API details.
+
+## Usage
+
+### Fetch all tags
+
+```python
+
+import wirelesstagpy
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+tags = api.load_tags()
+for (uuid, tag) in tags.items():
+ print('Loaded tag: {}, temp: {}, humidity: {} probe taken: {}'.format(
+ tag.name, tag.temperature,
+ tag.humidity, tag.time_since_last_update))
+
+```
+
+## Install custom push notifications
+
+Wireless Sensor Tags platforms allows to setup custom url calls for set of specific events.
+
+```python
+
+
+import wirelesstagpy
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+notifications = [
+ NotificationConfig('update', {
+ 'url': 'http://some_local_ip/update_tags',
+ 'verb': 'POST'
+ 'disabled': False,
+ 'nat': True
+ })
+]
+
+# install notification for tag with id=1 only
+# use it you have only one tag manager
+succeed = api.install_push_notification(1, notifications, False)
+
+# if you have multiple tag managers you need specify its 'mac' stored in each tag as following
+succeed = api.install_push_notification(sensor.tag_id, notifications, False,
+ sensor.tag_manager_mac)
+
+```
+
+## Monitor push events from cloud
+
+Wireless Sensor Tags platform allows to monitor state of sensors with push notification on change right from cloud.
+
+```python
+
+import wirelesstagspy
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+def callback(tags_spec, events_spec):
+ for (uuid, tag) in tags_spec.items():
+ if uuid in events_spec:
+ events = events_spec[uuid]
+ print("triggered events: {}".format(events))
+ print("updated tag: {}".format(tag))
+
+# starts long running thread with getting updates from cloud immidiately when change happens.
+# it is not a polling, but rather a similar to WebSockets get update logic
+api.start_monitoring(callback)
+
+```
+
+## Arm/Disarm sensor monitoring for specific event
+
+Supported events include: motion, temperature, humidity, light
+
+```python
+
+import wirelesstagpy
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+
+# arm humidity monitoring for tag with id 1,
+# returned instance is updated SensorTag
+sensor = api.arm_humidity(1)
+
+# Disarm it
+sensor = api.disarm_humidity(1)
+
+# Specify tag manager if you have multiple tag managers
+sensor = api.arm_humidity(sensor.tag_id, sensor.tag_manager_mac)
+
+```
+
+## Working with sensors and binary events
+
+Single tag holds notion of multiple sensors and binary events.
+Each sensor is entity representing single sensing metric such as temperature, humidity, moisture, light or motion.
+You can get list of supported sensors and binary events by calling `tag.allowed_sensor_types` for sensors,
+`tag.supported_binary_events_types` for binary events.
+Also you can query tag on list of supported monitoring conditions that can be represented as switches to be armed/disarmed by calling `tag.allowed_monitoring_types`.
+
+Handling sensors:
+
+```python
+
+import wirelesstagpy
+import wirelesstagpy.constants as CONST
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+tags = api.load_tags()
+
+# get temperature sensor value for tag
+for (uuid, tag) in tags.items():
+ sensor = tag.sensor[CONST.SENSOR_TEMPERATURE]
+ if sensor is not None:
+ print('{} temperature: {}'.format(tag.name, sensor.value))
+
+```
+
+Handling binary events:
+
+```python
+
+import wirelesstagpy
+import wirelesstagpy.constants as CONST
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+tags = api.load_tags()
+
+# get motion binary event state for each tag
+for (uuid, tag) in tags.items():
+ if CONST.EVENT_MOTION in tag.supported_binary_events_types:
+ event = tag.event[CONST.EVENT_MOTION]
+ print('tag {} event state: {}'.format(tag.name, event.is_state_on))
+
+```
+
+Use binary events to build custom push notifications configurations
+
+```python
+
+import wirelesstagpy
+import wirelesstagpy.constants as CONST
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+tags = api.load_tags()
+tag = tags['uuid-of-tag-in-question']
+event = tag.event[CONST.EVENT_MOISTURE]
+if event is not None:
+ configs = event.build_notifications('http://path_to_post', tag.tag_manager_mac)
+ # install it for any tags of tag manager
+ succeed = api.install_push_notification(0, configs, True,
+ tag.tag_manager_mac)
+```
+
+## Disclaimer
+
+"Wireless Sensor Tags", "KumoSensor" and "Kumostat" are trademarks of Cao Gadgets LLC,
+see www.wirelesstag.net for more information.
+
+I am in no way affiliated with Cao Gadgets LLC.
+
+## Copyright
+
+See [LICENSE](LICENSE)
+
+
+
+
+%package help
+Summary: Development documents and examples for wirelesstagpy
+Provides: python3-wirelesstagpy-doc
+%description help
+# WirelessSensorTags [![Build Status](https://travis-ci.org/sergeymaysak/wirelesstagpy.svg?branch=master)](https://travis-ci.com/sergeymaysak/wirelesstagpy) [![Coverage Status](https://coveralls.io/repos/github/sergeymaysak/wirelesstagpy/badge.svg?branch=master)](https://coveralls.io/github/sergeymaysak/wirelesstagpy?branch=master) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/wirelesstagpy.svg) ![PyPi - Version](https://img.shields.io/pypi/v/wirelesstagpy.svg)
+
+A simple python wrapper library for Wireless Sensor Tag platform (`http://wirelesstag.net`).
+
+Supports getting data for registered by end user sensor tags.
+wirelesstag.net account credentials are needed to use this lib.
+Enabling tags sharing is not required.
+
+Verified with:
+
+- 13-bit motion/temperature/humidity tags (type 13)
+- Water/Moisture tags (type 32)
+- ALS Pro tag (type 26)
+- PIR Kumo sensor (type 72)
+
+## Installation
+
+```shell
+pip3 install wirelesstagpy
+```
+
+## Development notes
+
+See [apidoc.html](http://wirelesstag.net/apidoc.html) for API details.
+
+## Usage
+
+### Fetch all tags
+
+```python
+
+import wirelesstagpy
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+tags = api.load_tags()
+for (uuid, tag) in tags.items():
+ print('Loaded tag: {}, temp: {}, humidity: {} probe taken: {}'.format(
+ tag.name, tag.temperature,
+ tag.humidity, tag.time_since_last_update))
+
+```
+
+## Install custom push notifications
+
+Wireless Sensor Tags platforms allows to setup custom url calls for set of specific events.
+
+```python
+
+
+import wirelesstagpy
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+notifications = [
+ NotificationConfig('update', {
+ 'url': 'http://some_local_ip/update_tags',
+ 'verb': 'POST'
+ 'disabled': False,
+ 'nat': True
+ })
+]
+
+# install notification for tag with id=1 only
+# use it you have only one tag manager
+succeed = api.install_push_notification(1, notifications, False)
+
+# if you have multiple tag managers you need specify its 'mac' stored in each tag as following
+succeed = api.install_push_notification(sensor.tag_id, notifications, False,
+ sensor.tag_manager_mac)
+
+```
+
+## Monitor push events from cloud
+
+Wireless Sensor Tags platform allows to monitor state of sensors with push notification on change right from cloud.
+
+```python
+
+import wirelesstagspy
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+def callback(tags_spec, events_spec):
+ for (uuid, tag) in tags_spec.items():
+ if uuid in events_spec:
+ events = events_spec[uuid]
+ print("triggered events: {}".format(events))
+ print("updated tag: {}".format(tag))
+
+# starts long running thread with getting updates from cloud immidiately when change happens.
+# it is not a polling, but rather a similar to WebSockets get update logic
+api.start_monitoring(callback)
+
+```
+
+## Arm/Disarm sensor monitoring for specific event
+
+Supported events include: motion, temperature, humidity, light
+
+```python
+
+import wirelesstagpy
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+
+# arm humidity monitoring for tag with id 1,
+# returned instance is updated SensorTag
+sensor = api.arm_humidity(1)
+
+# Disarm it
+sensor = api.disarm_humidity(1)
+
+# Specify tag manager if you have multiple tag managers
+sensor = api.arm_humidity(sensor.tag_id, sensor.tag_manager_mac)
+
+```
+
+## Working with sensors and binary events
+
+Single tag holds notion of multiple sensors and binary events.
+Each sensor is entity representing single sensing metric such as temperature, humidity, moisture, light or motion.
+You can get list of supported sensors and binary events by calling `tag.allowed_sensor_types` for sensors,
+`tag.supported_binary_events_types` for binary events.
+Also you can query tag on list of supported monitoring conditions that can be represented as switches to be armed/disarmed by calling `tag.allowed_monitoring_types`.
+
+Handling sensors:
+
+```python
+
+import wirelesstagpy
+import wirelesstagpy.constants as CONST
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+tags = api.load_tags()
+
+# get temperature sensor value for tag
+for (uuid, tag) in tags.items():
+ sensor = tag.sensor[CONST.SENSOR_TEMPERATURE]
+ if sensor is not None:
+ print('{} temperature: {}'.format(tag.name, sensor.value))
+
+```
+
+Handling binary events:
+
+```python
+
+import wirelesstagpy
+import wirelesstagpy.constants as CONST
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+tags = api.load_tags()
+
+# get motion binary event state for each tag
+for (uuid, tag) in tags.items():
+ if CONST.EVENT_MOTION in tag.supported_binary_events_types:
+ event = tag.event[CONST.EVENT_MOTION]
+ print('tag {} event state: {}'.format(tag.name, event.is_state_on))
+
+```
+
+Use binary events to build custom push notifications configurations
+
+```python
+
+import wirelesstagpy
+import wirelesstagpy.constants as CONST
+
+api = wirelesstagpy.WirelessTags(username='login_email', password='your_password')
+tags = api.load_tags()
+tag = tags['uuid-of-tag-in-question']
+event = tag.event[CONST.EVENT_MOISTURE]
+if event is not None:
+ configs = event.build_notifications('http://path_to_post', tag.tag_manager_mac)
+ # install it for any tags of tag manager
+ succeed = api.install_push_notification(0, configs, True,
+ tag.tag_manager_mac)
+```
+
+## Disclaimer
+
+"Wireless Sensor Tags", "KumoSensor" and "Kumostat" are trademarks of Cao Gadgets LLC,
+see www.wirelesstag.net for more information.
+
+I am in no way affiliated with Cao Gadgets LLC.
+
+## Copyright
+
+See [LICENSE](LICENSE)
+
+
+
+
+%prep
+%autosetup -n wirelesstagpy-0.8.1
+
+%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-wirelesstagpy -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.8.1-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..009b7fb
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+fe60a8578830de3213e51cf10974e114 wirelesstagpy-0.8.1.tar.gz