diff options
Diffstat (limited to 'python-smarthab.spec')
| -rw-r--r-- | python-smarthab.spec | 291 |
1 files changed, 291 insertions, 0 deletions
diff --git a/python-smarthab.spec b/python-smarthab.spec new file mode 100644 index 0000000..251cf78 --- /dev/null +++ b/python-smarthab.spec @@ -0,0 +1,291 @@ +%global _empty_manifest_terminate_build 0 +Name: python-SmartHab +Version: 0.21 +Release: 1 +Summary: This package allows controlling devices in a SmartHab-powered home. +License: GNU General Public License v3 or later (GPLv3+) +URL: https://gitlab.com/outadoc/python-smarthab/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/bb/76/4991f8e82015613fbb041f57fb1da481237dfa24f03c8f9e9519fceb7257/SmartHab-0.21.tar.gz +BuildArch: noarch + + +%description +# python-smarthab +This Python library allows you to programmatically control your SmartHab-powered +home. + +[](https://badge.fury.io/py/SmartHab) + +## What is SmartHab? +[SmartHab](https://www.smarthab.fr/) is a company that installs their home +automation solution in new buildings, and offers a mobile application for +home owners or renters to control their home over the Internet. + +Mobile App → API → SmartHab box (1 at each floor) → Z-Wave devices + +## What does this library do? +`python-smarthab` connects to the SmartHab API and allows you to automate your +home without having to use the mobile application. + +It might prove particularly useful if integrated into a home automation box or +software. Feel free to use it, it's under the GPL! + +## How do I use it? +```bash +pip3 install SmartHab +``` + +```python +import pysmarthab + +hub = pysmarthab.SmartHab() + +# Login +await hub.async_login('smarthab.user@example.com', '1234567') + +if not hub.is_logged_in: + # Bad credentials :( + raise SystemExit + +# Get the list of available devices +devices = await hub.async_get_device_list() + +# Close all roller shutters and turn on all lights +for device in devices: + if isinstance(device, pysmarthab.Light): + device.async_turn_on() + + if isinstance(device, pysmarthab.Shutter): + device.async_close() +``` + +If you prefer to use it synchronously: + +```python +import pysmarthab + +hub = pysmarthab.SmartHab() + +# Login +hub.login('smarthab.user@example.com', '1234567') + +if not hub.is_logged_in: + # Bad credentials :( + raise SystemExit + +# Get the list of available devices +devices = hub.get_device_list() + +# Close all roller shutters and turn on all lights +for device in devices: + if isinstance(device, pysmarthab.Light): + device.turn_on() + + if isinstance(device, pysmarthab.Shutter): + device.close() +``` + +%package -n python3-SmartHab +Summary: This package allows controlling devices in a SmartHab-powered home. +Provides: python-SmartHab +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-SmartHab +# python-smarthab +This Python library allows you to programmatically control your SmartHab-powered +home. + +[](https://badge.fury.io/py/SmartHab) + +## What is SmartHab? +[SmartHab](https://www.smarthab.fr/) is a company that installs their home +automation solution in new buildings, and offers a mobile application for +home owners or renters to control their home over the Internet. + +Mobile App → API → SmartHab box (1 at each floor) → Z-Wave devices + +## What does this library do? +`python-smarthab` connects to the SmartHab API and allows you to automate your +home without having to use the mobile application. + +It might prove particularly useful if integrated into a home automation box or +software. Feel free to use it, it's under the GPL! + +## How do I use it? +```bash +pip3 install SmartHab +``` + +```python +import pysmarthab + +hub = pysmarthab.SmartHab() + +# Login +await hub.async_login('smarthab.user@example.com', '1234567') + +if not hub.is_logged_in: + # Bad credentials :( + raise SystemExit + +# Get the list of available devices +devices = await hub.async_get_device_list() + +# Close all roller shutters and turn on all lights +for device in devices: + if isinstance(device, pysmarthab.Light): + device.async_turn_on() + + if isinstance(device, pysmarthab.Shutter): + device.async_close() +``` + +If you prefer to use it synchronously: + +```python +import pysmarthab + +hub = pysmarthab.SmartHab() + +# Login +hub.login('smarthab.user@example.com', '1234567') + +if not hub.is_logged_in: + # Bad credentials :( + raise SystemExit + +# Get the list of available devices +devices = hub.get_device_list() + +# Close all roller shutters and turn on all lights +for device in devices: + if isinstance(device, pysmarthab.Light): + device.turn_on() + + if isinstance(device, pysmarthab.Shutter): + device.close() +``` + +%package help +Summary: Development documents and examples for SmartHab +Provides: python3-SmartHab-doc +%description help +# python-smarthab +This Python library allows you to programmatically control your SmartHab-powered +home. + +[](https://badge.fury.io/py/SmartHab) + +## What is SmartHab? +[SmartHab](https://www.smarthab.fr/) is a company that installs their home +automation solution in new buildings, and offers a mobile application for +home owners or renters to control their home over the Internet. + +Mobile App → API → SmartHab box (1 at each floor) → Z-Wave devices + +## What does this library do? +`python-smarthab` connects to the SmartHab API and allows you to automate your +home without having to use the mobile application. + +It might prove particularly useful if integrated into a home automation box or +software. Feel free to use it, it's under the GPL! + +## How do I use it? +```bash +pip3 install SmartHab +``` + +```python +import pysmarthab + +hub = pysmarthab.SmartHab() + +# Login +await hub.async_login('smarthab.user@example.com', '1234567') + +if not hub.is_logged_in: + # Bad credentials :( + raise SystemExit + +# Get the list of available devices +devices = await hub.async_get_device_list() + +# Close all roller shutters and turn on all lights +for device in devices: + if isinstance(device, pysmarthab.Light): + device.async_turn_on() + + if isinstance(device, pysmarthab.Shutter): + device.async_close() +``` + +If you prefer to use it synchronously: + +```python +import pysmarthab + +hub = pysmarthab.SmartHab() + +# Login +hub.login('smarthab.user@example.com', '1234567') + +if not hub.is_logged_in: + # Bad credentials :( + raise SystemExit + +# Get the list of available devices +devices = hub.get_device_list() + +# Close all roller shutters and turn on all lights +for device in devices: + if isinstance(device, pysmarthab.Light): + device.turn_on() + + if isinstance(device, pysmarthab.Shutter): + device.close() +``` + +%prep +%autosetup -n SmartHab-0.21 + +%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-SmartHab -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 17 2023 Python_Bot <Python_Bot@openeuler.org> - 0.21-1 +- Package Spec generated |
