Switcher Python Integration.
Project description
Help Wanted
Aioswitcher project is looking for maintainers and contributors!
For various reasons, I can only keep maintaining this project as far as dependency bumps and publishing.
As for new features and the occasional bug support, these will require other maintainers/contributors.
If that's you - please feel free to ping me and I will do all I can to make the onboarding process easy.
Switcher Python Integration
PyPi module integrating with various Switcher devices.
Check out the wiki pages for a list of supported devices.
pip install aioswitcher
Documentation | Wiki | Contributing |
Example Usage
State Bridge
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))
Power Plug API
async def control_power_plug(device_ip, device_id, device_key) :
# for connecting to a device we need its id, login key and ip address
async with SwitcherType1Api(device_ip, device_id, device_key) 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", "00"))
Water Heater API
async def control_water_heater(device_ip, device_id, device_key) :
# for connecting to a device we need its id, login key and ip address
async with SwitcherType1Api(device_ip, device_id, device_key) 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", "00"))
Runner API
async def control_runner(device_ip, device_id, device_key) :
# for connecting to a device we need its id, login key and ip address
async with SwitcherType2Api(device_ip, device_id, device_key) 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", "00"))
Breeze API
async def control_breeze(device_ip, device_id, device_key, remote_manager, remote_id) :
# for connecting to a device we need its id, login key and ip address
async with SwitcherType2Api(device_ip, device_id, device_key) 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", "00", remote_manager, "DLK65863"))
Command Line Helper Scripts
- discover_devices.py can discover devices and their states.
- control_device.py can control a device.
Disclaimer
This is NOT an official module and it is NOT officially supported by the vendor.
That said, thanks are in order to all the people at Switcher for their cooperation and general support.
Contributors
Thanks goes to these wonderful people (emoji key):
Aviad Golan 🔣 |
Dolev Ben Aharon 📖 |
Fabian Affolter 💻 |
Itzik Ephraim 💻 |
Kesav890 📖 |
Liad Avraham 💻 |
Or Bin 💻 |
Shai rod 🔣 |
Shay Levy 💻 🤔 |
YogevBokobza 💻 ⚠️ 🚧 |
dmatik 📝 🤔 📓 |
jafar-atili 💻 📖 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aioswitcher-3.4.2.tar.gz
.
File metadata
- Download URL: aioswitcher-3.4.2.tar.gz
- Upload date:
- Size: 520.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.13 Linux/6.2.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7133934c914e75c807a79c71679520fbe5f78f196b50fe33308e2e31363fa4f |
|
MD5 | 058f2da0d9393941d201ae1b338fee1e |
|
BLAKE2b-256 | def6f5a974334b2ae0583c31e2e2e9d1ad91157b991557a18962745a2a5f5a8c |
File details
Details for the file aioswitcher-3.4.2-py3-none-any.whl
.
File metadata
- Download URL: aioswitcher-3.4.2-py3-none-any.whl
- Upload date:
- Size: 555.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.13 Linux/6.2.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 942cd4374a26f58f902cbfae99520060ca7fb833361264bb54c18a84c173bfbb |
|
MD5 | ad1540251e96ba263062a2799680fc2b |
|
BLAKE2b-256 | 6d8bfe297dab7a059e971cca730796f29980dc03124166948edea494a8613976 |