diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-aioswitcher.spec | 696 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 698 insertions, 0 deletions
@@ -0,0 +1 @@ +/aioswitcher-3.3.0.tar.gz diff --git a/python-aioswitcher.spec b/python-aioswitcher.spec new file mode 100644 index 0000000..23bff0d --- /dev/null +++ b/python-aioswitcher.spec @@ -0,0 +1,696 @@ +%global _empty_manifest_terminate_build 0 +Name: python-aioswitcher +Version: 3.3.0 +Release: 1 +Summary: Switcher Python Integration. +License: Apache-2.0 +URL: https://pypi.org/project/aioswitcher/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/94/fc/a467027e6a50c70bf86d865e0397ed8145f4a4bb20f7f0b5c218729fbfb6/aioswitcher-3.3.0.tar.gz +BuildArch: noarch + + +%description +# Help Wanted + +<p align="left"> +<strong> +Aioswitcher project is looking for maintainers and contributors!<br/> +For various reasons, I can only keep maintaining this project as far as dependency bumps and publishing.<br/> +As for new features and the occasional bug support, these will require other maintainers/contributors.<br/> +<br/> +If that's you - please feel free to ping me and I will do all I can to make the onboarding process easy. +</strong> +</p> + +# Switcher Python Integration</br>[![pypi-version]][11] [![pypi-downloads]][11] [![license-badge]][4] + +[![gh-build-status]][7] [![gh-pages-status]][8] [![codecov]][3] + +PyPi module integrating with various [Switcher][12] devices.</br> +Check out the [wiki pages][0] for a list of supported devices. + +```shell +pip install aioswitcher +``` + +<table> + <td><a href="https://aioswitcher.tomfi.info/">Documentation</a></td> + <td><a href="https://github.com/TomerFi/aioswitcher/wiki">Wiki</a></td> + <td><a href="https://github.com/TomerFi/aioswitcher/blob/dev/CONTRIBUTING.md">Contributing</a></td> +</table> + +## Example Usage + +<details> + <summary>State Bridge</summary> + +```python +async def print_devices(delay): + def on_device_found_callback(device): + # a switcher device will broadcast a state message approximately every 4 seconds + print(asdict(device)) + + async with SwitcherBridge(on_device_found_callback): + await asyncio.sleep(delay) + +# run the bridge for 60 seconds +asyncio.run(print_devices(60)) +``` + +</details> + +<details> + <summary>Power Plug API</summary> + + ```python + async def control_power_plug(device_ip, device_id) : + # for connecting to a device we need its id and ip address + async with SwitcherType1Api(device_ip, device_id) as api: + # get the device current state + await api.get_state() + # turn the device on + await api.control_device(Command.ON) + # turn the device off + await api.control_device(Command.OFF) + # set the device name to 'my new name' + await api.set_device_name("my new name") + + asyncio.run(control_power_plug("111.222.11.22", "ab1c2d")) + ``` + +</details> + +<details> + <summary>Water Heater API</summary> + + ```python + async def control_water_heater(device_ip, device_id) : + # for connecting to a device we need its id and ip address + async with SwitcherType1Api(device_ip, device_id) as api: + # get the device current state + await api.get_state() + # turn the device on for 15 minutes + await api.control_device(Command.ON, 15) + # turn the device off + await api.control_device(Command.OFF) + # set the device name to 'my new name' + await api.set_device_name("my new name") + # configure the device for 02:30 auto shutdown + await api.set_auto_shutdown(timedelta(hours=2, minutes=30)) + # get the schedules from the device + await api.get_schedules() + # delete and existing schedule with id 1 + await api.delete_schedule("1") + # create a new recurring schedule for 13:00-14:30 + # executing on sunday and friday + await api.create_schedule("13:00", "14:30", {Days.SUNDAY, Days.FRIDAY}) + + asyncio.run(control_water_heater("111.222.11.22", "ab1c2d")) + ``` + +</details> + +<details> + <summary>Runner API</summary> + + ```python + async def control_runner(device_ip, device_id) : + # for connecting to a device we need its id and ip address + async with SwitcherType2Api(device_ip, device_id) as api: + # get the device current state + await api.get_shutter_state() + # open the shutter to 30% + await api.set_position(30) + # stop the shutter if currently rolling + await api.stop() + + asyncio.run(control_runner("111.222.11.22", "ab1c2d")) + ``` + +</details> + +<details> + <summary>Breeze API</summary> + + ```python + async def control_breeze(device_ip, device_id, remote_manager, remote_id) : + # for connecting to a device we need its id and ip address + async with SwitcherType2Api(device_ip, device_id) as api: + # get the device current state + await api.get_breeze_state() + # initialize the Breeze RemoteManager and get the remote + remote = remote_manager.get_remote(remote_id) + # prepare a control command that turns on the Breeze + # set to 24 degree (Celsius) cooling with vertical swing + # send command to the device + await api.control_breeze_device( + remote, + DeviceState.ON, + ThermostatMode.COOL, + 24, + ThermostatFanLevel.MEDIUM, + ThermostatSwing.ON, + ) + + # create the remote manager outside the context for re-using + remote_manager = SwitcherBreezeRemoteManager() + asyncio.run(control_breeze("111.222.11.22", "ab1c2d", remote_manager, "DLK65863")) + ``` + +</details> + +## Command Line Helper Scripts + +- [discover_devices.py](https://github.com/TomerFi/aioswitcher/blob/dev/scripts/discover_devices.py) can discover devices and their + states. +- [control_device.py](https://github.com/TomerFi/aioswitcher/blob/dev/scripts/control_device.py) can control a device. + +## Disclaimer + +This is **NOT** an official module and it is **NOT** officially supported by the vendor.</br> +That said, thanks are in order to all the people at [Switcher][12] for their cooperation and general support. + +## Contributors + +Thanks goes to these wonderful people ([emoji key][1]): + +<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> +<!-- prettier-ignore-start --> +<!-- markdownlint-disable --> +<table> + <tbody> + <tr> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/aviadgolan"><img src="https://avatars.githubusercontent.com/u/17742111?v=4?s=100" width="100px;" alt="Aviad Golan"/><br /><sub><b>Aviad Golan</b></sub></a><br /><a href="#data-AviadGolan" title="Data">🔣</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/dolby360"><img src="https://avatars.githubusercontent.com/u/22151399?v=4?s=100" width="100px;" alt="Dolev Ben Aharon"/><br /><sub><b>Dolev Ben Aharon</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=dolby360" title="Documentation">📖</a></td> + <td align="center" valign="top" width="14.28%"><a href="http://fabian-affolter.ch/blog/"><img src="https://avatars.githubusercontent.com/u/116184?v=4?s=100" width="100px;" alt="Fabian Affolter"/><br /><sub><b>Fabian Affolter</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=fabaff" title="Code">💻</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/oranja"><img src="https://avatars.githubusercontent.com/u/679184?v=4?s=100" width="100px;" alt="Itzik Ephraim"/><br /><sub><b>Itzik Ephraim</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=oranja" title="Code">💻</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/Kesav890"><img src="https://avatars.githubusercontent.com/u/82559951?v=4?s=100" width="100px;" alt="Kesav890"/><br /><sub><b>Kesav890</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=Kesav890" title="Documentation">📖</a></td> + <td align="center" valign="top" width="14.28%"><a href="http://liad.avrah.am"><img src="https://avatars.githubusercontent.com/u/7263223?v=4?s=100" width="100px;" alt="Liad Avraham"/><br /><sub><b>Liad Avraham</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=liadav" title="Code">💻</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/OrBin"><img src="https://avatars.githubusercontent.com/u/6897234?v=4?s=100" width="100px;" alt="Or Bin"/><br /><sub><b>Or Bin</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=OrBin" title="Code">💻</a></td> + </tr> + <tr> + <td align="center" valign="top" width="14.28%"><a href="http://exploit.co.il"><img src="https://avatars.githubusercontent.com/u/1768915?v=4?s=100" width="100px;" alt="Shai rod"/><br /><sub><b>Shai rod</b></sub></a><br /><a href="#data-nightrang3r" title="Data">🔣</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/thecode"><img src="https://avatars.githubusercontent.com/u/1858925?v=4?s=100" width="100px;" alt="Shay Levy"/><br /><sub><b>Shay Levy</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=thecode" title="Code">💻</a> <a href="#ideas-thecode" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-thecode" title="Maintenance">🚧</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/dmatik"><img src="https://avatars.githubusercontent.com/u/5577386?v=4?s=100" width="100px;" alt="dmatik"/><br /><sub><b>dmatik</b></sub></a><br /><a href="#blog-dmatik" title="Blogposts">📝</a> <a href="#ideas-dmatik" title="Ideas, Planning, & Feedback">🤔</a> <a href="#userTesting-dmatik" title="User Testing">📓</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/jafar-atili"><img src="https://avatars.githubusercontent.com/u/19508787?v=4?s=100" width="100px;" alt="jafar-atili"/><br /><sub><b>jafar-atili</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=jafar-atili" title="Code">💻</a> <a href="https://github.com/TomerFi/aioswitcher/commits?author=jafar-atili" title="Documentation">📖</a></td> + </tr> + </tbody> +</table> + +<!-- markdownlint-restore --> +<!-- prettier-ignore-end --> + +<!-- ALL-CONTRIBUTORS-LIST:END --> + +<!-- Real Links --> +[0]: https://github.com/TomerFi/aioswitcher/wiki +[1]: https://allcontributors.org/docs/en/emoji-key +[3]: https://codecov.io/gh/TomerFi/aioswitcher +[4]: https://github.com/TomerFi/aioswitcher +[7]: https://github.com/TomerFi/aioswitcher/actions/workflows/stage.yml +[8]: https://aioswitcher.tomfi.info/ +[11]: https://pypi.org/project/aioswitcher +[12]: https://www.switcher.co.il/ +<!-- Badges Links --> +[codecov]: https://codecov.io/gh/TomerFi/aioswitcher/graph/badge.svg +[gh-build-status]: https://github.com/TomerFi/aioswitcher/actions/workflows/stage.yml/badge.svg +[gh-pages-status]: https://github.com/TomerFi/aioswitcher/actions/workflows/pages.yml/badge.svg +[license-badge]: https://img.shields.io/github/license/tomerfi/aioswitcher +[pypi-downloads]: https://img.shields.io/pypi/dm/aioswitcher.svg?logo=pypi&color=1082C2 +[pypi-version]: https://img.shields.io/pypi/v/aioswitcher?logo=pypi + + +%package -n python3-aioswitcher +Summary: Switcher Python Integration. +Provides: python-aioswitcher +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-aioswitcher +# Help Wanted + +<p align="left"> +<strong> +Aioswitcher project is looking for maintainers and contributors!<br/> +For various reasons, I can only keep maintaining this project as far as dependency bumps and publishing.<br/> +As for new features and the occasional bug support, these will require other maintainers/contributors.<br/> +<br/> +If that's you - please feel free to ping me and I will do all I can to make the onboarding process easy. +</strong> +</p> + +# Switcher Python Integration</br>[![pypi-version]][11] [![pypi-downloads]][11] [![license-badge]][4] + +[![gh-build-status]][7] [![gh-pages-status]][8] [![codecov]][3] + +PyPi module integrating with various [Switcher][12] devices.</br> +Check out the [wiki pages][0] for a list of supported devices. + +```shell +pip install aioswitcher +``` + +<table> + <td><a href="https://aioswitcher.tomfi.info/">Documentation</a></td> + <td><a href="https://github.com/TomerFi/aioswitcher/wiki">Wiki</a></td> + <td><a href="https://github.com/TomerFi/aioswitcher/blob/dev/CONTRIBUTING.md">Contributing</a></td> +</table> + +## Example Usage + +<details> + <summary>State Bridge</summary> + +```python +async def print_devices(delay): + def on_device_found_callback(device): + # a switcher device will broadcast a state message approximately every 4 seconds + print(asdict(device)) + + async with SwitcherBridge(on_device_found_callback): + await asyncio.sleep(delay) + +# run the bridge for 60 seconds +asyncio.run(print_devices(60)) +``` + +</details> + +<details> + <summary>Power Plug API</summary> + + ```python + async def control_power_plug(device_ip, device_id) : + # for connecting to a device we need its id and ip address + async with SwitcherType1Api(device_ip, device_id) as api: + # get the device current state + await api.get_state() + # turn the device on + await api.control_device(Command.ON) + # turn the device off + await api.control_device(Command.OFF) + # set the device name to 'my new name' + await api.set_device_name("my new name") + + asyncio.run(control_power_plug("111.222.11.22", "ab1c2d")) + ``` + +</details> + +<details> + <summary>Water Heater API</summary> + + ```python + async def control_water_heater(device_ip, device_id) : + # for connecting to a device we need its id and ip address + async with SwitcherType1Api(device_ip, device_id) as api: + # get the device current state + await api.get_state() + # turn the device on for 15 minutes + await api.control_device(Command.ON, 15) + # turn the device off + await api.control_device(Command.OFF) + # set the device name to 'my new name' + await api.set_device_name("my new name") + # configure the device for 02:30 auto shutdown + await api.set_auto_shutdown(timedelta(hours=2, minutes=30)) + # get the schedules from the device + await api.get_schedules() + # delete and existing schedule with id 1 + await api.delete_schedule("1") + # create a new recurring schedule for 13:00-14:30 + # executing on sunday and friday + await api.create_schedule("13:00", "14:30", {Days.SUNDAY, Days.FRIDAY}) + + asyncio.run(control_water_heater("111.222.11.22", "ab1c2d")) + ``` + +</details> + +<details> + <summary>Runner API</summary> + + ```python + async def control_runner(device_ip, device_id) : + # for connecting to a device we need its id and ip address + async with SwitcherType2Api(device_ip, device_id) as api: + # get the device current state + await api.get_shutter_state() + # open the shutter to 30% + await api.set_position(30) + # stop the shutter if currently rolling + await api.stop() + + asyncio.run(control_runner("111.222.11.22", "ab1c2d")) + ``` + +</details> + +<details> + <summary>Breeze API</summary> + + ```python + async def control_breeze(device_ip, device_id, remote_manager, remote_id) : + # for connecting to a device we need its id and ip address + async with SwitcherType2Api(device_ip, device_id) as api: + # get the device current state + await api.get_breeze_state() + # initialize the Breeze RemoteManager and get the remote + remote = remote_manager.get_remote(remote_id) + # prepare a control command that turns on the Breeze + # set to 24 degree (Celsius) cooling with vertical swing + # send command to the device + await api.control_breeze_device( + remote, + DeviceState.ON, + ThermostatMode.COOL, + 24, + ThermostatFanLevel.MEDIUM, + ThermostatSwing.ON, + ) + + # create the remote manager outside the context for re-using + remote_manager = SwitcherBreezeRemoteManager() + asyncio.run(control_breeze("111.222.11.22", "ab1c2d", remote_manager, "DLK65863")) + ``` + +</details> + +## Command Line Helper Scripts + +- [discover_devices.py](https://github.com/TomerFi/aioswitcher/blob/dev/scripts/discover_devices.py) can discover devices and their + states. +- [control_device.py](https://github.com/TomerFi/aioswitcher/blob/dev/scripts/control_device.py) can control a device. + +## Disclaimer + +This is **NOT** an official module and it is **NOT** officially supported by the vendor.</br> +That said, thanks are in order to all the people at [Switcher][12] for their cooperation and general support. + +## Contributors + +Thanks goes to these wonderful people ([emoji key][1]): + +<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> +<!-- prettier-ignore-start --> +<!-- markdownlint-disable --> +<table> + <tbody> + <tr> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/aviadgolan"><img src="https://avatars.githubusercontent.com/u/17742111?v=4?s=100" width="100px;" alt="Aviad Golan"/><br /><sub><b>Aviad Golan</b></sub></a><br /><a href="#data-AviadGolan" title="Data">🔣</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/dolby360"><img src="https://avatars.githubusercontent.com/u/22151399?v=4?s=100" width="100px;" alt="Dolev Ben Aharon"/><br /><sub><b>Dolev Ben Aharon</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=dolby360" title="Documentation">📖</a></td> + <td align="center" valign="top" width="14.28%"><a href="http://fabian-affolter.ch/blog/"><img src="https://avatars.githubusercontent.com/u/116184?v=4?s=100" width="100px;" alt="Fabian Affolter"/><br /><sub><b>Fabian Affolter</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=fabaff" title="Code">💻</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/oranja"><img src="https://avatars.githubusercontent.com/u/679184?v=4?s=100" width="100px;" alt="Itzik Ephraim"/><br /><sub><b>Itzik Ephraim</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=oranja" title="Code">💻</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/Kesav890"><img src="https://avatars.githubusercontent.com/u/82559951?v=4?s=100" width="100px;" alt="Kesav890"/><br /><sub><b>Kesav890</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=Kesav890" title="Documentation">📖</a></td> + <td align="center" valign="top" width="14.28%"><a href="http://liad.avrah.am"><img src="https://avatars.githubusercontent.com/u/7263223?v=4?s=100" width="100px;" alt="Liad Avraham"/><br /><sub><b>Liad Avraham</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=liadav" title="Code">💻</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/OrBin"><img src="https://avatars.githubusercontent.com/u/6897234?v=4?s=100" width="100px;" alt="Or Bin"/><br /><sub><b>Or Bin</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=OrBin" title="Code">💻</a></td> + </tr> + <tr> + <td align="center" valign="top" width="14.28%"><a href="http://exploit.co.il"><img src="https://avatars.githubusercontent.com/u/1768915?v=4?s=100" width="100px;" alt="Shai rod"/><br /><sub><b>Shai rod</b></sub></a><br /><a href="#data-nightrang3r" title="Data">🔣</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/thecode"><img src="https://avatars.githubusercontent.com/u/1858925?v=4?s=100" width="100px;" alt="Shay Levy"/><br /><sub><b>Shay Levy</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=thecode" title="Code">💻</a> <a href="#ideas-thecode" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-thecode" title="Maintenance">🚧</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/dmatik"><img src="https://avatars.githubusercontent.com/u/5577386?v=4?s=100" width="100px;" alt="dmatik"/><br /><sub><b>dmatik</b></sub></a><br /><a href="#blog-dmatik" title="Blogposts">📝</a> <a href="#ideas-dmatik" title="Ideas, Planning, & Feedback">🤔</a> <a href="#userTesting-dmatik" title="User Testing">📓</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/jafar-atili"><img src="https://avatars.githubusercontent.com/u/19508787?v=4?s=100" width="100px;" alt="jafar-atili"/><br /><sub><b>jafar-atili</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=jafar-atili" title="Code">💻</a> <a href="https://github.com/TomerFi/aioswitcher/commits?author=jafar-atili" title="Documentation">📖</a></td> + </tr> + </tbody> +</table> + +<!-- markdownlint-restore --> +<!-- prettier-ignore-end --> + +<!-- ALL-CONTRIBUTORS-LIST:END --> + +<!-- Real Links --> +[0]: https://github.com/TomerFi/aioswitcher/wiki +[1]: https://allcontributors.org/docs/en/emoji-key +[3]: https://codecov.io/gh/TomerFi/aioswitcher +[4]: https://github.com/TomerFi/aioswitcher +[7]: https://github.com/TomerFi/aioswitcher/actions/workflows/stage.yml +[8]: https://aioswitcher.tomfi.info/ +[11]: https://pypi.org/project/aioswitcher +[12]: https://www.switcher.co.il/ +<!-- Badges Links --> +[codecov]: https://codecov.io/gh/TomerFi/aioswitcher/graph/badge.svg +[gh-build-status]: https://github.com/TomerFi/aioswitcher/actions/workflows/stage.yml/badge.svg +[gh-pages-status]: https://github.com/TomerFi/aioswitcher/actions/workflows/pages.yml/badge.svg +[license-badge]: https://img.shields.io/github/license/tomerfi/aioswitcher +[pypi-downloads]: https://img.shields.io/pypi/dm/aioswitcher.svg?logo=pypi&color=1082C2 +[pypi-version]: https://img.shields.io/pypi/v/aioswitcher?logo=pypi + + +%package help +Summary: Development documents and examples for aioswitcher +Provides: python3-aioswitcher-doc +%description help +# Help Wanted + +<p align="left"> +<strong> +Aioswitcher project is looking for maintainers and contributors!<br/> +For various reasons, I can only keep maintaining this project as far as dependency bumps and publishing.<br/> +As for new features and the occasional bug support, these will require other maintainers/contributors.<br/> +<br/> +If that's you - please feel free to ping me and I will do all I can to make the onboarding process easy. +</strong> +</p> + +# Switcher Python Integration</br>[![pypi-version]][11] [![pypi-downloads]][11] [![license-badge]][4] + +[![gh-build-status]][7] [![gh-pages-status]][8] [![codecov]][3] + +PyPi module integrating with various [Switcher][12] devices.</br> +Check out the [wiki pages][0] for a list of supported devices. + +```shell +pip install aioswitcher +``` + +<table> + <td><a href="https://aioswitcher.tomfi.info/">Documentation</a></td> + <td><a href="https://github.com/TomerFi/aioswitcher/wiki">Wiki</a></td> + <td><a href="https://github.com/TomerFi/aioswitcher/blob/dev/CONTRIBUTING.md">Contributing</a></td> +</table> + +## Example Usage + +<details> + <summary>State Bridge</summary> + +```python +async def print_devices(delay): + def on_device_found_callback(device): + # a switcher device will broadcast a state message approximately every 4 seconds + print(asdict(device)) + + async with SwitcherBridge(on_device_found_callback): + await asyncio.sleep(delay) + +# run the bridge for 60 seconds +asyncio.run(print_devices(60)) +``` + +</details> + +<details> + <summary>Power Plug API</summary> + + ```python + async def control_power_plug(device_ip, device_id) : + # for connecting to a device we need its id and ip address + async with SwitcherType1Api(device_ip, device_id) as api: + # get the device current state + await api.get_state() + # turn the device on + await api.control_device(Command.ON) + # turn the device off + await api.control_device(Command.OFF) + # set the device name to 'my new name' + await api.set_device_name("my new name") + + asyncio.run(control_power_plug("111.222.11.22", "ab1c2d")) + ``` + +</details> + +<details> + <summary>Water Heater API</summary> + + ```python + async def control_water_heater(device_ip, device_id) : + # for connecting to a device we need its id and ip address + async with SwitcherType1Api(device_ip, device_id) as api: + # get the device current state + await api.get_state() + # turn the device on for 15 minutes + await api.control_device(Command.ON, 15) + # turn the device off + await api.control_device(Command.OFF) + # set the device name to 'my new name' + await api.set_device_name("my new name") + # configure the device for 02:30 auto shutdown + await api.set_auto_shutdown(timedelta(hours=2, minutes=30)) + # get the schedules from the device + await api.get_schedules() + # delete and existing schedule with id 1 + await api.delete_schedule("1") + # create a new recurring schedule for 13:00-14:30 + # executing on sunday and friday + await api.create_schedule("13:00", "14:30", {Days.SUNDAY, Days.FRIDAY}) + + asyncio.run(control_water_heater("111.222.11.22", "ab1c2d")) + ``` + +</details> + +<details> + <summary>Runner API</summary> + + ```python + async def control_runner(device_ip, device_id) : + # for connecting to a device we need its id and ip address + async with SwitcherType2Api(device_ip, device_id) as api: + # get the device current state + await api.get_shutter_state() + # open the shutter to 30% + await api.set_position(30) + # stop the shutter if currently rolling + await api.stop() + + asyncio.run(control_runner("111.222.11.22", "ab1c2d")) + ``` + +</details> + +<details> + <summary>Breeze API</summary> + + ```python + async def control_breeze(device_ip, device_id, remote_manager, remote_id) : + # for connecting to a device we need its id and ip address + async with SwitcherType2Api(device_ip, device_id) as api: + # get the device current state + await api.get_breeze_state() + # initialize the Breeze RemoteManager and get the remote + remote = remote_manager.get_remote(remote_id) + # prepare a control command that turns on the Breeze + # set to 24 degree (Celsius) cooling with vertical swing + # send command to the device + await api.control_breeze_device( + remote, + DeviceState.ON, + ThermostatMode.COOL, + 24, + ThermostatFanLevel.MEDIUM, + ThermostatSwing.ON, + ) + + # create the remote manager outside the context for re-using + remote_manager = SwitcherBreezeRemoteManager() + asyncio.run(control_breeze("111.222.11.22", "ab1c2d", remote_manager, "DLK65863")) + ``` + +</details> + +## Command Line Helper Scripts + +- [discover_devices.py](https://github.com/TomerFi/aioswitcher/blob/dev/scripts/discover_devices.py) can discover devices and their + states. +- [control_device.py](https://github.com/TomerFi/aioswitcher/blob/dev/scripts/control_device.py) can control a device. + +## Disclaimer + +This is **NOT** an official module and it is **NOT** officially supported by the vendor.</br> +That said, thanks are in order to all the people at [Switcher][12] for their cooperation and general support. + +## Contributors + +Thanks goes to these wonderful people ([emoji key][1]): + +<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> +<!-- prettier-ignore-start --> +<!-- markdownlint-disable --> +<table> + <tbody> + <tr> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/aviadgolan"><img src="https://avatars.githubusercontent.com/u/17742111?v=4?s=100" width="100px;" alt="Aviad Golan"/><br /><sub><b>Aviad Golan</b></sub></a><br /><a href="#data-AviadGolan" title="Data">🔣</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/dolby360"><img src="https://avatars.githubusercontent.com/u/22151399?v=4?s=100" width="100px;" alt="Dolev Ben Aharon"/><br /><sub><b>Dolev Ben Aharon</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=dolby360" title="Documentation">📖</a></td> + <td align="center" valign="top" width="14.28%"><a href="http://fabian-affolter.ch/blog/"><img src="https://avatars.githubusercontent.com/u/116184?v=4?s=100" width="100px;" alt="Fabian Affolter"/><br /><sub><b>Fabian Affolter</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=fabaff" title="Code">💻</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/oranja"><img src="https://avatars.githubusercontent.com/u/679184?v=4?s=100" width="100px;" alt="Itzik Ephraim"/><br /><sub><b>Itzik Ephraim</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=oranja" title="Code">💻</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/Kesav890"><img src="https://avatars.githubusercontent.com/u/82559951?v=4?s=100" width="100px;" alt="Kesav890"/><br /><sub><b>Kesav890</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=Kesav890" title="Documentation">📖</a></td> + <td align="center" valign="top" width="14.28%"><a href="http://liad.avrah.am"><img src="https://avatars.githubusercontent.com/u/7263223?v=4?s=100" width="100px;" alt="Liad Avraham"/><br /><sub><b>Liad Avraham</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=liadav" title="Code">💻</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/OrBin"><img src="https://avatars.githubusercontent.com/u/6897234?v=4?s=100" width="100px;" alt="Or Bin"/><br /><sub><b>Or Bin</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=OrBin" title="Code">💻</a></td> + </tr> + <tr> + <td align="center" valign="top" width="14.28%"><a href="http://exploit.co.il"><img src="https://avatars.githubusercontent.com/u/1768915?v=4?s=100" width="100px;" alt="Shai rod"/><br /><sub><b>Shai rod</b></sub></a><br /><a href="#data-nightrang3r" title="Data">🔣</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/thecode"><img src="https://avatars.githubusercontent.com/u/1858925?v=4?s=100" width="100px;" alt="Shay Levy"/><br /><sub><b>Shay Levy</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=thecode" title="Code">💻</a> <a href="#ideas-thecode" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-thecode" title="Maintenance">🚧</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/dmatik"><img src="https://avatars.githubusercontent.com/u/5577386?v=4?s=100" width="100px;" alt="dmatik"/><br /><sub><b>dmatik</b></sub></a><br /><a href="#blog-dmatik" title="Blogposts">📝</a> <a href="#ideas-dmatik" title="Ideas, Planning, & Feedback">🤔</a> <a href="#userTesting-dmatik" title="User Testing">📓</a></td> + <td align="center" valign="top" width="14.28%"><a href="https://github.com/jafar-atili"><img src="https://avatars.githubusercontent.com/u/19508787?v=4?s=100" width="100px;" alt="jafar-atili"/><br /><sub><b>jafar-atili</b></sub></a><br /><a href="https://github.com/TomerFi/aioswitcher/commits?author=jafar-atili" title="Code">💻</a> <a href="https://github.com/TomerFi/aioswitcher/commits?author=jafar-atili" title="Documentation">📖</a></td> + </tr> + </tbody> +</table> + +<!-- markdownlint-restore --> +<!-- prettier-ignore-end --> + +<!-- ALL-CONTRIBUTORS-LIST:END --> + +<!-- Real Links --> +[0]: https://github.com/TomerFi/aioswitcher/wiki +[1]: https://allcontributors.org/docs/en/emoji-key +[3]: https://codecov.io/gh/TomerFi/aioswitcher +[4]: https://github.com/TomerFi/aioswitcher +[7]: https://github.com/TomerFi/aioswitcher/actions/workflows/stage.yml +[8]: https://aioswitcher.tomfi.info/ +[11]: https://pypi.org/project/aioswitcher +[12]: https://www.switcher.co.il/ +<!-- Badges Links --> +[codecov]: https://codecov.io/gh/TomerFi/aioswitcher/graph/badge.svg +[gh-build-status]: https://github.com/TomerFi/aioswitcher/actions/workflows/stage.yml/badge.svg +[gh-pages-status]: https://github.com/TomerFi/aioswitcher/actions/workflows/pages.yml/badge.svg +[license-badge]: https://img.shields.io/github/license/tomerfi/aioswitcher +[pypi-downloads]: https://img.shields.io/pypi/dm/aioswitcher.svg?logo=pypi&color=1082C2 +[pypi-version]: https://img.shields.io/pypi/v/aioswitcher?logo=pypi + + +%prep +%autosetup -n aioswitcher-3.3.0 + +%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-aioswitcher -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 3.3.0-1 +- Package Spec generated @@ -0,0 +1 @@ +8fe16e006b52178e67d69af4b00ff952 aioswitcher-3.3.0.tar.gz |