aioswitcher documentation⚓︎
Install⚓︎
pip install aioswitcher
Usage⚓︎
Bridge⚓︎
We can use the Bridge implementation to discover devices and their state. The following code will print all discovered devices for 60 seconds.
async def print_devices(delay):
def on_device_found_callback(device):
print(asdict(device)) # (1)
async with SwitcherBridge(on_device_found_callback):
await asyncio.sleep(delay)
asyncio.run(print_devices(60))
- the callback device will be an implementation of SwitcherBase, i.e. SwitcherPowerPlug, SwitcherWaterHeater, SwitcherThermostat, and SwitcherShutter.
Note
A Switcher device will broadcast a state message to the bridge approximately every 4 seconds.
API⚓︎
Type1 API (Switcher Plug, V2, Touch, V4)⚓︎
We can use the Type1 API to gain the following capabilities:
- Get the current state
- Turn on and off
- Set the name
- Configure auto shutdown
- Retrieve the schedules
- Create and Delete schedules
async def control_device(device_type, device_ip, device_id, device_key) :
# for connecting to a device we need its type, id, login key and ip address
async with SwitcherApi(device_type, device_ip, device_id, device_key) as api:
# get the device current state (1)
await api.get_state()
# turn the device on for 15 minutes (2)
await api.control_device(Command.ON, 15)
# turn the device off (3)
await api.control_device(Command.OFF)
# set the device name to 'my new name' (4)
await api.set_device_name("my new name")
# configure the device for 02:30 auto shutdown (5)
await api.set_auto_shutdown(timedelta(hours=2, minutes=30))
# get the schedules from the device (6)
await api.get_schedules()
# delete and existing schedule with id 1 (7)
await api.delete_schedule("1")
# create a new recurring schedule for 13:00-14:30
# executing on sunday and friday (8)
await api.create_schedule("13:00", "14:30", {Days.SUNDAY, Days.FRIDAY})
asyncio.run(
control_device(DeviceType.POWER_PLUG, "111.222.11.22", "ab1c2d", "00")
)
asyncio.run(
control_device(DeviceType.MINI, "111.222.11.22", "ab1c2d", "00")
)
asyncio.run(
control_device(DeviceType.TOUCH, "111.222.11.22", "ab1c2d", "00")
)
asyncio.run(
control_device(DeviceType.V2_ESP, "111.222.11.22", "ab1c2d", "00")
)
asyncio.run(
control_device(DeviceType.V2_QCA, "111.222.11.22", "ab1c2d", "00")
)
asyncio.run(
control_device(DeviceType.V4, "111.222.11.22", "ab1c2d", "00")
)
- SwitcherStateResponse
- SwitcherBaseResponse
- SwitcherBaseResponse
- SwitcherBaseResponse
- SwitcherBaseResponse
- SwitcherGetSchedulesResponse
- SwitcherBaseResponse
- SwitcherBaseResponse
Type2 API (Switcher Breeze, Runner and Lights)⚓︎
We can use the Type2 API to gain the following capabilities on Switcher Breeze, Runner and Lights:
- Get the current state
- Control Runner position
- Control Breeze (State, Mode, Fan Level, Target Temperature, Vertical Swing)
- Control Lights (State, Turn On, Turn Off)
async def control_runner(device_type, device_ip, device_id, device_key, token) :
# for connecting to a device we need its type, id, login key, token and ip address
async with SwitcherApi(device_type, device_ip, device_id, device_key, token) as api:
# get the shutter current state, circuit number is 0
await api.get_shutter_state(0)
# open the shutter to 30%, circuit number is 0
await api.set_position(30, 0)
# stop the shutter if currently rolling, circuit number is 0
await api.stop_shutter(0)
# turn on the light, circuit number is 0 (Only for Runner S11 and Runner S12)
await api.set_light(DeviceState.ON, 0)
# turn off the light, circuit number is 0 (Only for Runner S11 and Runner S12)
await api.set_light(DeviceState.OFF, 0)
asyncio.run(
control_runner(DeviceType.RUNNER, "111.222.11.22", "ab1c2d", "00")
)
asyncio.run(
control_runner(DeviceType.RUNNER_MINI, "111.222.11.22", "ab1c2d", "00")
)
asyncio.run(
control_runner(DeviceType.RUNNER_S11, "111.222.11.22", "ab1c2d", "00", "zvVvd7JxtN7CgvkD1Psujw==")
)
asyncio.run(
control_runner(DeviceType.RUNNER_S12, "111.222.11.22", "ab1c2d", "00", "zvVvd7JxtN7CgvkD1Psujw==")
)
async def control_light(device_type, device_ip, device_id, device_key, token) :
# for connecting to a device we need its type, id, login key and ip address
async with SwitcherApi(device_type, device_ip, device_id, device_key, token) as api:
# get the light current state, circuit number is 0
await api.get_light_state(0)
# turn on the light, circuit number is 0 (Only for Runner S11, Runner S12 and Lights)
await api.set_light(DeviceState.ON, 0)
# turn off the light, circuit number is 0 (Only for Runner S11, Runner S12 and Lights)
await api.set_light(DeviceState.OFF, 0)
asyncio.run(control_light(DeviceType.LIGHT_SL01, "111.222.11.22", "ab1c2d", "00", "zvVvd7JxtN7CgvkD1Psujw=="))
asyncio.run(control_light(DeviceType.LIGHT_SL01_MINI, "111.222.11.22", "ab1c2d", "00", "zvVvd7JxtN7CgvkD1Psujw=="))
asyncio.run(control_light(DeviceType.LIGHT_SL02, "111.222.11.22", "ab1c2d", "00", "zvVvd7JxtN7CgvkD1Psujw=="))
asyncio.run(control_light(DeviceType.LIGHT_SL02_MINI, "111.222.11.22", "ab1c2d", "00", "zvVvd7JxtN7CgvkD1Psujw=="))
asyncio.run(control_light(DeviceType.LIGHT_SL03, "111.222.11.22", "ab1c2d", "00", "zvVvd7JxtN7CgvkD1Psujw=="))
async def control_breeze(device_type, device_ip, device_id, device_key, remote_manager, remote_id) :
# for connecting to a device we need its type, id, login key and ip address
async with SwitcherApi(device_type, device_ip, device_id, device_key) as api:
# get the device current state (1)
await api.get_breeze_state()
# initialize the Breeze RemoteManager and get the remote (2)
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 (3)
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 (4)
remote_manager = SwitcherBreezeRemoteManager()
asyncio.run(
control_breeze(DeviceType.BREEZE, "111.222.11.22", "ab1c2d", "00", remote_manager, "DLK65863")
)
- SwitcherThermostatStateResponse
- SwitcherBreezeRemote
- SwitcherBaseResponse
- SwitcherBreezeRemoteManager
Info
You can find the supported device types stated in this enum members.
Command line scripts⚓︎
scripts/discover_devices.py⚓︎
usage: discover_devices.py [-h] [-t {1,2,all}] [delay]
Discover and print info of Switcher devices
positional arguments:
delay number of seconds to run, defaults to 60
options:
-h, --help show this help message and exit
-t {1,2,all}, --type {1,2,all}
set protocol type: ['1', '2', 'all']
Executing this script will print a serialized version of the discovered Switcher
devices broadcasting on the local network for 60 seconds.
You can change the delay by passing an int argument: discover_devices.py 30
Switcher devices uses two protocol types:
Protocol type 1 (UDP port 20002 or port 10002), used by: Switcher Mini, Switcher Power Plug, Switcher Touch, Switcher V2 (esp), Switcher V2 (qualcomm), Switcher V4
Protocol type 2 (UDP port 20003 or port 10003), used by: Switcher Breeze, Switcher Runner, Switcher Runner Mini, Switcher Runner S11, Switcher Runner S12, Switcher Light SL01, Switcher Light SL01 Mini, Switcher Light SL02, Switcher Light SL02 Mini, Switcher Light SL03
You can change the scanned protocol type by passing an int argument: discover_devices.py -t 1
Note:
WILL PRINT PRIVATE INFO SUCH AS DEVICE ID AND MAC.
Example output:
Switcher devices broadcast a status message every approximately 4 seconds. This
script listens for these messages and prints a serialized version of the to the
standard output, for example (note the ``device_id`` and ``mac_address`` properties)::
```
{ 'auto_shutdown': '03:00:00',
'device_id': 'aaaaaa',
'device_state': <DeviceState.OFF: ('0000', 'off')>,
'device_type': <DeviceType.V2_ESP: ('Switcher V2 (esp)', 'a7', <DeviceCategory.WATER_HEATER: 1>)>,
'electric_current': 0.0,
'ip_address': '192.168.1.33',
'last_data_update': datetime.datetime(2021, 6, 13, 11, 11, 44, 883003),
'mac_address': '12:A1:A2:1A:BC:1A',
'name': 'My Switcher Boiler',
'power_consumption': 0,
'remaining_time': '00:00:00'}
```
Print all protocol types devices for 30 seconds:
python discover_devices.py 30 -t all
Print only protocol type 1 devices:
python discover_devices.py -t 1
Print only protocol type 2 devices:
python discover_devices.py -t 2
script/control_device.py⚓︎
usage: control_device.py [-h]
{control_thermostat,create_schedule,delete_schedule,get_schedules,get_state,get_thermostat_state,set_auto_shutdown,set_name,set_shutter_position,stop_shutter,turn_off,turn_on}
...
Control your Switcher device
options:
-h, --help show this help message and exit
subcommands:
supported actions
{control_thermostat,create_schedule,delete_schedule,get_schedules,get_state,get_thermostat_state,set_auto_shutdown,set_name,set_shutter_position,stop_shutter,turn_off,turn_on}
control_thermostat control a breeze device
create_schedule create a new schedule
delete_schedule delete a device schedule
get_schedules retrieve a device schedules
get_state get the current state of a device
get_thermostat_state
get the current state a thermostat (breeze) device
set_auto_shutdown set the auto shutdown property (1h-24h)
set_name set the name of the device
set_shutter_position
set shutter position
stop_shutter stop shutter
turn_off turn off the device
turn_on turn on the device
turn_off_light turn off light
turn_on_light turn on light
example usage:
python control_device.py get_state -c "Switcher Touch" -d ab1c2d -i "111.222.11.22"
python control_device.py turn_on -c "Switcher Touch" -d ab1c2d -i "111.222.11.22"
python control_device.py turn_on -c "Switcher Touch" -d ab1c2d -l 18 -i "111.222.11.22"
python control_device.py turn_on -c "Switcher Touch" -d ab1c2d -i "111.222.11.22" -t 15
python control_device.py turn_off -c "Switcher Touch" -d ab1c2d -i "111.222.11.22"
python control_device.py turn_off -c "Switcher Touch" -d ab1c2d -l 18 -i "111.222.11.22"
python control_device.py set_name -c "Switcher Touch" -d ab1c2d -i "111.222.11.22" -n "My Boiler"
python control_device.py set_auto_shutdown -c "Switcher Touch" -d ab1c2d -i "111.222.11.22" -r 2 -m 30
python control_device.py get_schedules -c "Switcher Touch" -d ab1c2d -i "111.222.11.22"
python control_device.py delete_schedule -c "Switcher Touch" -d ab1c2d -i "111.222.11.22" -s 3
python control_device.py create_schedule -c "Switcher Touch" -d ab1c2d -i "111.222.11.22" -n "14:00" -f "14:30"
python control_device.py create_schedule -c "Switcher Touch" -d ab1c2d -i "111.222.11.22" -n "17:30" -f "18:30" -w Sunday Monday Friday
python control_device.py get_shutter_state -c "Switcher Runner" -d f2239a -i "192.168.50.98"
python control_device.py get_shutter_state -c "Switcher Runner S11" -k "zvVvd7JxtN7CgvkD1Psujw==" -d f2239a -i "192.168.50.98"
python control_device.py get_shutter_state -c "Switcher Runner S12" -k "zvVvd7JxtN7CgvkD1Psujw==" -d f2239a -i "192.168.50.98" -x 0
python control_device.py get_shutter_state -c "Switcher Runner S12" -k "zvVvd7JxtN7CgvkD1Psujw==" -d f2239a -i "192.168.50.98" -x 1
python control_device.py stop_shutter -c "Switcher Runner" -d f2239a -i "192.168.50.98"
python control_device.py stop_shutter -c "Switcher Runner S11" -k "zvVvd7JxtN7CgvkD1Psujw==" -d f2239a -i "192.168.50.98"
python control_device.py stop_shutter -c "Switcher Runner S12" -k "zvVvd7JxtN7CgvkD1Psujw==" -d f2239a -i "192.168.50.98" -x 0
python control_device.py stop_shutter -c "Switcher Runner S12" -k "zvVvd7JxtN7CgvkD1Psujw==" -d f2239a -i "192.168.50.98" -x 1
python control_device.py set_shutter_position -c "Switcher Runner" -d f2239a -i "192.168.50.98" -p 50
python control_device.py set_shutter_position -c "Switcher Runner S11" -k "zvVvd7JxtN7CgvkD1Psujw==" -d f2239a -i "192.168.50.98" -p 50
python control_device.py set_shutter_position -c "Switcher Runner S12" -k "zvVvd7JxtN7CgvkD1Psujw==" -d f2239a -i "192.168.50.98" -p 50 -x 0
python control_device.py set_shutter_position -c "Switcher Runner S12" -k "zvVvd7JxtN7CgvkD1Psujw==" -d f2239a -i "192.168.50.98" -p 50 -x 1
python control_device.py get_light_state -c "Switcher Runner S11" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 0
python control_device.py get_light_state -c "Switcher Runner S11" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 1
python control_device.py get_light_state -c "Switcher Runner S12" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22"
python control_device.py get_light_state -c "Switcher Light SL01" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22"
python control_device.py get_light_state -c "Switcher Light SL01 Mini" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22"
python control_device.py get_light_state -c "Switcher Light SL02" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 0
python control_device.py get_light_state -c "Switcher Light SL02" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 1
python control_device.py get_light_state -c "Switcher Light SL02 Mini" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 0
python control_device.py get_light_state -c "Switcher Light SL02 Mini" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 1
python control_device.py get_light_state -c "Switcher Light SL03" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 0
python control_device.py get_light_state -c "Switcher Light SL03" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 1
python control_device.py get_light_state -c "Switcher Light SL03" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 2
python control_device.py turn_on_light -c "Switcher Runner S11" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 0
python control_device.py turn_on_light -c "Switcher Runner S11" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 1
python control_device.py turn_on_light -c "Switcher Runner S12" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22"
python control_device.py turn_on_light -c "Switcher Light SL01" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22"
python control_device.py turn_on_light -c "Switcher Light SL01 Mini" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22"
python control_device.py turn_on_light -c "Switcher Light SL02" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 0
python control_device.py turn_on_light -c "Switcher Light SL02" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 1
python control_device.py turn_on_light -c "Switcher Light SL02 Mini" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 0
python control_device.py turn_on_light -c "Switcher Light SL02 Mini" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 1
python control_device.py turn_on_light -c "Switcher Light SL03" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22 -x 0
python control_device.py turn_on_light -c "Switcher Light SL03" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22 -x 1
python control_device.py turn_on_light -c "Switcher Light SL03" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22 -x 2
python control_device.py turn_off_light -c "Switcher Runner S11" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 0
python control_device.py turn_off_light -c "Switcher Runner S11" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 1
python control_device.py turn_off_light -c "Switcher Runner S12" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22"
python control_device.py turn_off_light -c "Switcher Light SL01" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22"
python control_device.py turn_off_light -c "Switcher Light SL01 Mini" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22"
python control_device.py turn_off_light -c "Switcher Light SL02" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 0
python control_device.py turn_off_light -c "Switcher Light SL02" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 1
python control_device.py turn_off_light -c "Switcher Light SL02 Mini" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 0
python control_device.py turn_off_light -c "Switcher Light SL02 Mini" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 1
python control_device.py turn_off_light -c "Switcher Light SL03" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 0
python control_device.py turn_off_light -c "Switcher Light SL03" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 1
python control_device.py turn_off_light -c "Switcher Light SL03" -k "zvVvd7JxtN7CgvkD1Psujw==" -d ab1c2d -i "111.222.11.22" -x 2
python control_device.py get_thermostat_state -c "Switcher Breeze" -d 3a20b7 -i "192.168.50.77"
python control_device.py control_thermostat -c "Switcher Breeze" -d 3a20b7 -i "192.168.50.77" -r ELEC7001 -s on
python control_device.py control_thermostat -c "Switcher Breeze" -d 3a20b7 -i "192.168.50.77" -r ELEC7001 -m cool -f high -t 24
python control_device.py control_thermostat -c "Switcher Breeze" -d 3a20b7 -i "192.168.50.77" -r ELEC7001 -m cool -f high -t 24 -u
python control_device.py control_thermostat -c "Switcher Breeze" -d 3a20b7 -i "192.168.50.77" -r ELEC7001 -m dry
python control_device.py control_thermostat -c "Switcher Breeze" -d 3a20b7 -i "192.168.50.77" -r ELEC7001 -s off
script/control_device.py control_thermostat⚓︎
usage: control_device.py control_thermostat [-h] [-v] -c DEVICE_TYPE -d DEVICE_ID [-l DEVICE_KEY] -i
IP_ADDRESS -r REMOTE_ID
[-s {on,off}]
[-m {auto,dry,fan,cool,heat}]
[-f {low,medium,high,auto}]
[-w {off,on}] [-t TEMPERATURE]
[-u]
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-r REMOTE_ID, --remote-id REMOTE_ID
remote id of your device
-s {on,off}, --state {on,off}
thermostat state
-m {auto,dry,fan,cool,heat}, --mode {auto,dry,fan,cool,heat}
thermostat mode
-f {low,medium,high,auto}, --fan-level {low,medium,high,auto}
thermostat fan level
-w {off,on}, --swing {off,on}
thermostat swing
-t TEMPERATURE, --temperature TEMPERATURE
thermostat temperature, a positive integer
-u, --update update state without control
script/control_device.py create_schedule⚓︎
usage: control_device.py create_schedule [-h] [-v] -c DEVICE_TYPE -d DEVICE_ID [-l DEVICE_KEY] -i IP_ADDRESS
-n START_TIME -f END_TIME
[-w [{Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday} ...]]
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-n START_TIME, --start-time START_TIME
the on time for the schedule, e.g. 13:00
-f END_TIME, --end-time END_TIME
the off time for the schedule, e.g. 13:30
-w [{Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday} ...], --weekdays [{Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday} ...]
days for recurring schedules
script/control_device.py delete_schedule⚓︎
usage: control_device.py delete_schedule [-h] [-v] -c DEVICE_TYPE -d DEVICE_ID [-l DEVICE_KEY] -i IP_ADDRESS
-s SCHEDULE_ID
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-s SCHEDULE_ID, --schedule-id SCHEDULE_ID
the id of the schedule for deletion
script/control_device.py get_schedules⚓︎
usage: control_device.py get_schedules [-h] [-v] -c DEVICE_TYPE -d DEVICE_ID [-l DEVICE_KEY] -i IP_ADDRESS
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
script/control_device.py get_state⚓︎
usage: control_device.py get_state [-h] [-v] -c DEVICE_TYPE -d DEVICE_ID [-l DEVICE_KEY] -i IP_ADDRESS
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
script/control_device.py get_thermostat_state⚓︎
usage: control_device.py get_thermostat_state [-h] [-v] -c DEVICE_TYPE -d DEVICE_ID [-l DEVICE_KEY] -i
IP_ADDRESS
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
script/control_device.py set_auto_shutdown⚓︎
usage: control_device.py set_auto_shutdown [-h] [-v] -c DEVICE_TYPE -d DEVICE_ID [-l DEVICE_KEY] -i
IP_ADDRESS -r HOURS [-m [MINUTES]]
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-r HOURS, --hours HOURS
number hours for the auto shutdown
-m [MINUTES], --minutes [MINUTES]
number hours for the auto shutdown
script/control_device.py set_name⚓︎
usage: control_device.py set_name [-h] [-v] -c DEVICE_TYPE -d DEVICE_ID [-l DEVICE_KEY] -i IP_ADDRESS -n NAME
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-n NAME, --name NAME new name for the device
script/control_device.py get_shutter_state⚓︎
usage: control_device.py get_shutter_state [-h] [-v] -c DEVICE_TYPE [-k TOKEN] -d DEVICE_ID [-l DEVICE_KEY] -i IP_ADDRESS
[-x INDEX]
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-k TOKEN, --token TOKEN
the token for communicating with the new switcher devices
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-x INDEX, --index INDEX
the circuit number to operate
script/control_device.py set_shutter_position⚓︎
usage: control_device.py set_shutter_position [-h] [-v] -c DEVICE_TYPE [-k TOKEN] -d DEVICE_ID [-l DEVICE_KEY] -i
IP_ADDRESS -p POSITION [-x INDEX]
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-k TOKEN, --token TOKEN
the token for communicating with the new switcher devices
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-p POSITION, --position POSITION
Shutter position percentage
-x INDEX, --index INDEX
the circuit number to operate
script/control_device.py stop_shutter⚓︎
usage: control_device.py stop_shutter [-h] [-v] -c DEVICE_TYPE [-k TOKEN] -d DEVICE_ID [-l DEVICE_KEY] -i IP_ADDRESS [-x INDEX]
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-k TOKEN, --token TOKEN
the token for communicating with the new switcher devices
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-x INDEX, --index INDEX
the circuit number to operate
script/control_device.py turn_off⚓︎
usage: control_device.py turn_off [-h] [-v] -c DEVICE_TYPE -d DEVICE_ID [-l DEVICE_KEY] -i IP_ADDRESS
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
script/control_device.py turn_on⚓︎
usage: control_device.py turn_on [-h] [-v] -c DEVICE_TYPE -d DEVICE_ID [-l DEVICE_KEY] -i IP_ADDRESS
[-t [TIMER]]
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-t [TIMER], --timer [TIMER]
set minutes timer for turn on operation
script/control_device.py get_light_state⚓︎
usage: control_device.py get_light_state [-h] [-v] -c DEVICE_TYPE [-k TOKEN] -d DEVICE_ID [-l DEVICE_KEY] -i IP_ADDRESS [-x INDEX]
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-k TOKEN, --token TOKEN
the token for communicating with the new switcher devices
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-x INDEX, --index INDEX
the circuit number to turn off
script/control_device.py turn_off_light⚓︎
usage: control_device.py turn_off_light [-h] [-v] -c DEVICE_TYPE [-k TOKEN] -d DEVICE_ID [-l DEVICE_KEY] -i IP_ADDRESS [-x INDEX]
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-k TOKEN, --token TOKEN
the token for communicating with the new switcher devices
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-x INDEX, --index INDEX
the circuit number to turn off
script/control_device.py turn_on_light⚓︎
usage: control_device.py turn_on_light [-h] [-v] -c DEVICE_TYPE [-k TOKEN] -d DEVICE_ID [-l DEVICE_KEY] -i IP_ADDRESS [-x INDEX]
options:
-h, --help show this help message and exit
-v, --verbose include the raw message
-c DEVICE_TYPE, --device-type DEVICE_TYPE
the type of the device
-k TOKEN, --token TOKEN
the token for communicating with the new switcher devices
-d DEVICE_ID, --device-id DEVICE_ID
the identification of the device
-l DEVICE_KEY, --device-key DEVICE_KEY
the login key of the device
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-x INDEX, --index INDEX
the circuit number to turn on
script/get_device_login_key.py⚓︎
usage: get_device_login_key.py [-h] -i IP_ADDRESS -p {20002,10002,20003,10003}
Get the login key of your Switcher device
options:
-h, --help show this help message and exit
-i IP_ADDRESS, --ip-address IP_ADDRESS
the ip address assigned to the device
-p {20002,10002,20003,10003}, --port {20002,10002,20003,10003}
example usage:
python get_device_login_key.py -i "111.222.11.22" -p 10002
script/validate_token.py⚓︎
usage: validate_token.py [-h] -u USERNAME -t TOKEN
Validate a Token from Switcher by username and token
options:
-h, --help show this help message and exit
-u USERNAME, --username USERNAME
the username of the user (Email address)
-t TOKEN, --token TOKEN
the token of the user sent by Email
example usage:
python validate_token.py -u "email" -t "zvVvd7JxtN7CgvkD1Psujw=="
python validate_token.py --username "email" --token "zvVvd7JxtN7CgvkD1Psujw=="
Code documentation⚓︎
Switcher integration TCP socket API module.
Command
⚓︎
Bases: Enum
Enum for turning the device on or off.
Source code in src/aioswitcher/api/__init__.py
66 67 68 69 70 71 |
|
SwitcherApi
⚓︎
Switcher TCP based API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_type |
DeviceType
|
the type of the device. |
required |
ip_address |
str
|
the ip address assigned to the device. |
required |
device_id |
str
|
the id of the desired device. |
required |
device_key |
str
|
the login key of the device. |
required |
Source code in src/aioswitcher/api/__init__.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
|
connected: bool
property
⚓︎
Return true if api is connected.
__aenter__()
async
⚓︎
Enter SwitcherApi asynchronous context manager.
Returns:
Type | Description |
---|---|
SwitcherApi
|
This instance of |
Source code in src/aioswitcher/api/__init__.py
114 115 116 117 118 119 120 121 122 |
|
__aexit__(exc_type, exc_value, traceback)
async
⚓︎
Exit SwitcherApi asynchronous context manager.
Source code in src/aioswitcher/api/__init__.py
124 125 126 127 128 129 130 131 |
|
__init__(device_type, ip_address, device_id, device_key, token=None)
⚓︎
Initialize the Switcher TCP connection API.
Source code in src/aioswitcher/api/__init__.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
connect()
async
⚓︎
Connect to asynchronous socket and get reader and writer object.
Source code in src/aioswitcher/api/__init__.py
133 134 135 136 137 138 139 140 141 142 143 |
|
control_breeze_device(remote, state=None, mode=None, target_temp=0, fan_level=None, swing=None, update_state=False)
async
⚓︎
Use for sending the control packet to the Breeze device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
remote |
SwitcherBreezeRemote
|
the remote for the breeze device |
required |
state |
Union[DeviceState, None]
|
optionally the desired state of the device |
None
|
mode |
Union[ThermostatMode, None]
|
optionally the desired mode of the device |
None
|
target_temp |
int
|
optionally the target temperature |
0
|
fan_level |
Union[ThermostatFanLevel, None]
|
optionally the desired fan level |
None
|
swing |
Union[ThermostatSwing, None]
|
optionally the desired swing state |
None
|
update_state |
bool
|
update the device state without controlling the device |
False
|
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 |
|
control_device(command, minutes=0)
async
⚓︎
Use for sending the control packet to the device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command |
Command
|
use the |
required |
minutes |
int
|
if turning-on optionally incorporate a timer. |
0
|
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
|
create_schedule(start_time, end_time, days=set())
async
⚓︎
Use for creating a new schedule in the next empty schedule slot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_time |
str
|
a string start time in %H:%M format. e.g. 13:00. |
required |
end_time |
str
|
a string start time in %H:%M format. e.g. 13:00. |
required |
days |
Set[Days]
|
for recurring schedules, add |
set()
|
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
|
delete_schedule(schedule_id)
async
⚓︎
Use for deleting a schedule from the device.
Use get_schedules
to retrieve the schedule instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id |
str
|
the identification of the schedule for deletion. |
required |
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
|
disconnect()
async
⚓︎
Disconnect from asynchronous socket.
Source code in src/aioswitcher/api/__init__.py
145 146 147 148 149 150 151 152 153 |
|
get_breeze_state()
async
⚓︎
Use for sending the get state packet to the Breeze device.
Returns:
Type | Description |
---|---|
SwitcherThermostatStateResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
621 622 623 624 625 626 627 628 629 630 631 |
|
get_light_state(index=0)
async
⚓︎
Use for sending the get state packet to the Light devices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
which light to set get state, default to 0. |
0
|
Returns:
Type | Description |
---|---|
SwitcherLightStateResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 |
|
get_schedules()
async
⚓︎
Use for retrieval of the schedules from the device.
Returns:
Type | Description |
---|---|
SwitcherGetSchedulesResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
get_shutter_state(index=0)
async
⚓︎
Use for sending the get state packet to the Runners devices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
which runner to set get state, default to 0. |
0
|
Returns:
Type | Description |
---|---|
SwitcherShutterStateResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 |
|
get_state()
async
⚓︎
Use for sending the get state packet to the device.
Returns:
Type | Description |
---|---|
SwitcherStateResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
set_auto_shutdown(full_time)
async
⚓︎
Use for sending the set auto-off packet to the device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
full_time |
timedelta
|
timedelta value containing the configuration value for auto-shutdown. |
required |
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
|
set_device_name(name)
async
⚓︎
Use for sending the set name packet to the device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
string name with the length of 2 >= x >= 32. |
required |
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
|
set_light(command, index=0)
async
⚓︎
Use for turn on/off light.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command |
DeviceState
|
use the |
required |
index |
int
|
which light to turn on/off, default to 0. |
0
|
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
|
set_position(position=0, index=0)
async
⚓︎
Use for setting the shutter position of the Runners devices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
position |
int
|
the position to set the device to, default to 0. |
0
|
index |
int
|
which runner to set position, default to 0. |
0
|
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 |
|
stop_shutter(index=0)
async
⚓︎
Use for stopping the shutter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
which runner to stop position, default to 0. |
0
|
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 |
|
Switcher integration TCP socket API messages.
StateMessageParser
dataclass
⚓︎
Use for parsing api messages.
Source code in src/aioswitcher/api/messages.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
__post_init__(response)
⚓︎
Post initialization of the parser.
Source code in src/aioswitcher/api/messages.py
45 46 47 |
|
get_auto_shutdown()
⚓︎
Return the value of the auto shutdown configuration.
Source code in src/aioswitcher/api/messages.py
75 76 77 78 79 80 81 82 83 84 85 |
|
get_light_state(index)
⚓︎
Return the current light state.
Source code in src/aioswitcher/api/messages.py
154 155 156 157 158 159 160 161 162 163 164 |
|
get_power_consumption()
⚓︎
Return the current power consumption of the device.
Source code in src/aioswitcher/api/messages.py
49 50 51 52 |
|
get_shutter_direction(index)
⚓︎
Return the current shutter direction.
Source code in src/aioswitcher/api/messages.py
146 147 148 149 150 151 152 |
|
get_shutter_position(index)
⚓︎
Return the current shutter position.
Source code in src/aioswitcher/api/messages.py
139 140 141 142 143 144 |
|
get_state()
⚓︎
Return the current device state.
Source code in src/aioswitcher/api/messages.py
87 88 89 90 91 |
|
get_thermostat_fan_level()
⚓︎
Return the current thermostat fan level.
Source code in src/aioswitcher/api/messages.py
116 117 118 119 120 121 122 123 |
|
get_thermostat_mode()
⚓︎
Return the current thermostat mode.
Source code in src/aioswitcher/api/messages.py
98 99 100 101 102 103 104 105 |
|
get_thermostat_remote_id()
⚓︎
Return the current thermostat remote.
Source code in src/aioswitcher/api/messages.py
134 135 136 137 |
|
get_thermostat_state()
⚓︎
Return the current thermostat state.
Source code in src/aioswitcher/api/messages.py
93 94 95 96 |
|
get_thermostat_swing()
⚓︎
Return the current thermostat fan swing.
Source code in src/aioswitcher/api/messages.py
125 126 127 128 129 130 131 132 |
|
get_thermostat_target_temp()
⚓︎
Return the current temperature of the thermostat.
Source code in src/aioswitcher/api/messages.py
111 112 113 114 |
|
get_thermostat_temp()
⚓︎
Return the current temp of the thermostat.
Source code in src/aioswitcher/api/messages.py
107 108 109 |
|
get_time_left()
⚓︎
Return the time left for the device current run.
Source code in src/aioswitcher/api/messages.py
54 55 56 57 58 59 60 61 62 63 64 |
|
get_time_on()
⚓︎
Return how long the device has been on.
Source code in src/aioswitcher/api/messages.py
66 67 68 69 70 71 72 73 |
|
SwitcherBaseResponse
dataclass
⚓︎
Representation of the switcher base response message.
Applicable for all messages that do no require post initialization. e.g. not applicable for SwitcherLoginResponse, SwitcherStateResponse, SwitcherGetScheduleResponse.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
unparsed_response |
bytes
|
the raw response from the device. |
required |
Source code in src/aioswitcher/api/messages.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
successful: bool
property
⚓︎
Return true if the response is not empty.
Partially indicating the request was successful.
SwitcherGetSchedulesResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the switcher get schedule message.
Source code in src/aioswitcher/api/messages.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
|
found_schedules: bool
property
⚓︎
Return true if found schedules in the response.
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
237 238 239 |
|
SwitcherLightStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the Switcher light devices state response message.
Source code in src/aioswitcher/api/messages.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
|
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
301 302 303 304 305 306 |
|
SwitcherLoginResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representations of the switcher login response message.
Source code in src/aioswitcher/api/messages.py
191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
__post_init__()
⚓︎
Post initialization of the response.
Source code in src/aioswitcher/api/messages.py
198 199 200 201 202 203 |
|
SwitcherShutterStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the Switcher shutter devices state response message.
Source code in src/aioswitcher/api/messages.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
|
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
283 284 285 286 287 288 289 |
|
SwitcherStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the switcher state response message.
Source code in src/aioswitcher/api/messages.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
218 219 220 221 222 223 224 225 226 227 |
|
SwitcherThermostatStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the Switcher thermostat device state response message.
Source code in src/aioswitcher/api/messages.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
|
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
260 261 262 263 264 265 266 267 268 269 270 |
|
Switcher integration API remote related classes and functions.
SwitcherBreezeCommand
⚓︎
Representations of the Switcher Breeze command message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command |
str
|
a string command ready to be parsed and sent |
required |
Source code in src/aioswitcher/api/remotes.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
__init__(command)
⚓︎
Initialize the Breeze command.
Source code in src/aioswitcher/api/remotes.py
81 82 83 84 |
|
SwitcherBreezeRemote
⚓︎
Class that represent a remote for a Breeze device/s.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ir_set |
Dict[str, Any]
|
a dictionary for all supported remotes |
required |
Source code in src/aioswitcher/api/remotes.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
|
max_temperature: int
property
⚓︎
Getter for Maximum supported temperature.
min_temperature: int
property
⚓︎
Getter for Minimum supported temperature.
modes_features: Dict[ThermostatMode, Dict[str, Any]]
property
⚓︎
Getter for supported feature per mode.
on_off_type: bool
property
⚓︎
Getter for which indicates if the AC if on/off (toggle) type.
remote_id: str
property
⚓︎
Getter for remote id.
separated_swing_command: bool
property
⚓︎
Getter for which indicates if the AC has a separated swing command.
supported_modes: List[ThermostatMode]
property
⚓︎
Getter for supported modes.
__init__(ir_set)
⚓︎
Initialize the remote by parsing the ir_set data.
Source code in src/aioswitcher/api/remotes.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
build_command(state, mode, target_temp, fan_level, swing, current_state=None)
⚓︎
Build command that controls the Breeze device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state |
DeviceState
|
the desired state of the device |
required |
mode |
ThermostatMode
|
the desired mode of the device |
required |
target_temp |
int
|
the target temperature |
required |
fan_level |
ThermostatFanLevel
|
the desired fan level |
required |
swing |
ThermostatSwing
|
the desired swing state |
required |
current_state |
Union[DeviceState, None]
|
optionally, for toggle device, pass previous state to avoid redundant requests |
None
|
Returns:
Type | Description |
---|---|
SwitcherBreezeCommand
|
An instance of |
Source code in src/aioswitcher/api/remotes.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
|
build_swing_command(swing)
⚓︎
Build a special command to control swing on special remotes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
swing |
ThermostatSwing
|
the desired swing state |
required |
Returns:
Type | Description |
---|---|
SwitcherBreezeCommand
|
An instance of |
Source code in src/aioswitcher/api/remotes.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
|
SwitcherBreezeRemoteManager
⚓︎
Class for managing Breeze remotes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
remotes_db_path |
str
|
optional path of supported remote json file |
BREEZE_REMOTE_DB_FPATH
|
Source code in src/aioswitcher/api/remotes.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
|
__init__(remotes_db_path=BREEZE_REMOTE_DB_FPATH)
⚓︎
Initialize the Remote manager.
Source code in src/aioswitcher/api/remotes.py
416 417 418 419 |
|
get_remote(remote_id)
⚓︎
Get Breeze remote by the remote id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
remote_id |
str
|
the id of the desired remote |
required |
Returns:
Type | Description |
---|---|
SwitcherBreezeRemote
|
an instance of |
Source code in src/aioswitcher/api/remotes.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
|
Switcher integration, UDP Bridge module.
DatagramParser
dataclass
⚓︎
Utility class for parsing a datagram into various device properties.
Source code in src/aioswitcher/bridge.py
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 |
|
get_auto_shutdown()
⚓︎
Extract the auto shutdown value from the broadcast message.
Source code in src/aioswitcher/bridge.py
544 545 546 547 548 549 550 551 552 553 554 |
|
get_device_id()
⚓︎
Extract the device id from the broadcast message.
Source code in src/aioswitcher/bridge.py
527 528 529 |
|
get_device_key()
⚓︎
Extract the device id from the broadcast message.
Source code in src/aioswitcher/bridge.py
531 532 533 |
|
get_device_state()
⚓︎
Extract the device state from the broadcast message.
Source code in src/aioswitcher/bridge.py
535 536 537 538 539 540 541 542 |
|
get_device_type()
⚓︎
Extract the device type from the broadcast message.
Source code in src/aioswitcher/bridge.py
573 574 575 576 577 |
|
get_ip_type1()
⚓︎
Extract the IP address from the type1 broadcast message (Heater, Plug).
Source code in src/aioswitcher/bridge.py
477 478 479 480 481 |
|
get_ip_type2()
⚓︎
Extract the IP address from the broadcast message (Breeze, Runners).
Source code in src/aioswitcher/bridge.py
483 484 485 486 487 |
|
get_light_state(index)
⚓︎
Extract the light state from the broadcast message.
Source code in src/aioswitcher/bridge.py
596 597 598 599 600 601 602 603 604 605 606 |
|
get_mac_type1()
⚓︎
Extract the MAC address from the broadcast message (Heater, Plug).
Source code in src/aioswitcher/bridge.py
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
|
get_mac_type2()
⚓︎
Extract the MAC address from the broadcast message (Breeze, Runners).
Source code in src/aioswitcher/bridge.py
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 |
|
get_name()
⚓︎
Extract the device name from the broadcast message.
Source code in src/aioswitcher/bridge.py
523 524 525 |
|
get_power_consumption()
⚓︎
Extract the power consumption from the broadcast message.
Source code in src/aioswitcher/bridge.py
556 557 558 559 |
|
get_remaining()
⚓︎
Extract the time remains for the current execution.
Source code in src/aioswitcher/bridge.py
561 562 563 564 565 566 567 568 569 570 571 |
|
get_shutter_direction(index)
⚓︎
Return the current direction of the shutter (UP/DOWN/STOP).
Source code in src/aioswitcher/bridge.py
588 589 590 591 592 593 594 |
|
get_shutter_position(index)
⚓︎
Return the current position of the shutter 0 <= pos <= 100.
Source code in src/aioswitcher/bridge.py
581 582 583 584 585 586 |
|
get_thermostat_fan_level()
⚓︎
Return the current thermostat fan level.
Source code in src/aioswitcher/bridge.py
631 632 633 634 635 |
|
get_thermostat_mode()
⚓︎
Return the current thermostat mode.
Source code in src/aioswitcher/bridge.py
620 621 622 623 624 |
|
get_thermostat_remote_id()
⚓︎
Return the current thermostat remote.
Source code in src/aioswitcher/bridge.py
647 648 649 |
|
get_thermostat_state()
⚓︎
Return the current thermostat state.
Source code in src/aioswitcher/bridge.py
615 616 617 618 |
|
get_thermostat_swing()
⚓︎
Return the current thermostat fan swing.
Source code in src/aioswitcher/bridge.py
637 638 639 640 641 642 643 644 645 |
|
get_thermostat_target_temp()
⚓︎
Return the current temp of the thermostat.
Source code in src/aioswitcher/bridge.py
626 627 628 629 |
|
get_thermostat_temp()
⚓︎
Return the current temp of the thermostat.
Source code in src/aioswitcher/bridge.py
610 611 612 613 |
|
is_switcher_originator()
⚓︎
Verify the broadcast message had originated from a switcher device.
Source code in src/aioswitcher/bridge.py
465 466 467 468 469 470 471 472 473 474 475 |
|
SwitcherBridge
⚓︎
Use for running a UDP client for bridging Switcher devices broadcast messages.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
on_device |
Callable[[SwitcherBase], Any]
|
a callable to which every new SwitcherBase device found will be send. |
required |
broadcast_ports |
List[int]
|
broadcast ports list, default for type 1 devices is 20002, default for type 2 devices is 20003. On newer type1 devices, the port is 10002. On newer type2 devices, the port is 10003. |
[SWITCHER_UDP_PORT_TYPE1, SWITCHER_UDP_PORT_TYPE1_NEW_VERSION, SWITCHER_UDP_PORT_TYPE2, SWITCHER_UDP_PORT_TYPE2_NEW_VERSION]
|
Source code in src/aioswitcher/bridge.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
|
is_running: bool
property
⚓︎
bool: Return true if bridge is running.
__aenter__()
async
⚓︎
Enter SwitcherBridge asynchronous context manager.
Source code in src/aioswitcher/bridge.py
376 377 378 379 |
|
__aexit__(exc_type, exc_value, traceback)
async
⚓︎
Exit the SwitcherBridge asynchronous context manager.
Source code in src/aioswitcher/bridge.py
381 382 383 384 385 386 387 388 |
|
__init__(on_device, broadcast_ports=[SWITCHER_UDP_PORT_TYPE1, SWITCHER_UDP_PORT_TYPE1_NEW_VERSION, SWITCHER_UDP_PORT_TYPE2, SWITCHER_UDP_PORT_TYPE2_NEW_VERSION])
⚓︎
Initialize the switcher bridge.
Source code in src/aioswitcher/bridge.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
|
start()
async
⚓︎
Create an asynchronous listener and start the bridge.
Source code in src/aioswitcher/bridge.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
|
stop()
async
⚓︎
Stop the asynchronous bridge.
Source code in src/aioswitcher/bridge.py
407 408 409 410 411 412 413 414 415 416 417 418 |
|
UdpClientProtocol
⚓︎
Bases: DatagramProtocol
Implementation of the Asyncio UDP DatagramProtocol.
Source code in src/aioswitcher/bridge.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
|
__init__(on_datagram)
⚓︎
Initialize the protocol.
Source code in src/aioswitcher/bridge.py
430 431 432 433 |
|
connection_lost(exc)
⚓︎
Call on connection lost.
Source code in src/aioswitcher/bridge.py
450 451 452 453 454 455 |
|
connection_made(transport)
⚓︎
Call on connection established.
Source code in src/aioswitcher/bridge.py
435 436 437 |
|
datagram_received(data, addr)
⚓︎
Call on datagram received.
Source code in src/aioswitcher/bridge.py
439 440 441 |
|
error_received(exc)
⚓︎
Call on exception received.
Source code in src/aioswitcher/bridge.py
443 444 445 446 447 448 |
|
Switcher integration device module.
DeviceCategory
⚓︎
Bases: Enum
Enum for relaying the device category.
Source code in src/aioswitcher/device/__init__.py
24 25 26 27 28 29 30 31 32 33 34 |
|
DeviceState
⚓︎
Bases: Enum
Enum class representing the device's state.
Source code in src/aioswitcher/device/__init__.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
display: str
property
⚓︎
Return the display name of the state.
value: str
property
⚓︎
Return the value of the state.
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
150 151 152 153 154 155 |
|
DeviceType
⚓︎
Bases: Enum
Enum for relaying the type of the switcher devices.
Source code in src/aioswitcher/device/__init__.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
category: DeviceCategory
property
⚓︎
Return the category of the device type.
hex_rep: str
property
⚓︎
Return the hexadecimal representation of the device type.
protocol_type: int
property
⚓︎
Return the protocol type of the device.
token_needed: bool
property
⚓︎
Return true if token in needed for the device.
value: str
property
⚓︎
Return the value of the state.
__new__(value, hex_rep, protocol_type, category, token_needed)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
ShutterDirection
⚓︎
Bases: Enum
Enum class representing the shutter device's position.
Source code in src/aioswitcher/device/__init__.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
|
display: str
property
⚓︎
Return the display name of the direction.
value: str
property
⚓︎
Return the value of the direction.
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
253 254 255 256 257 258 |
|
SwitcherBase
dataclass
⚓︎
Bases: ABC
Abstraction for all switcher devices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_type |
DeviceType
|
the DeviceType appropriate member. |
required |
device_state |
DeviceState
|
the DeviceState appropriate member. |
required |
device_id |
str
|
the id retrieved from the device. |
required |
device_key |
str
|
the login key of the device. |
required |
ip_address |
str
|
the ip address assigned to the device. |
required |
mac_address |
str
|
the mac address assigned to the device. |
required |
name |
str
|
the name of the device. |
required |
Source code in src/aioswitcher/device/__init__.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
|
__post_init__()
⚓︎
Post initialization, set last_data_update to the instantiation datetime.
Source code in src/aioswitcher/device/__init__.py
296 297 298 |
|
SwitcherDualShutterSingleLight
dataclass
⚓︎
Bases: SwitcherDualShutterSingleLightBase
, SwitcherBase
Implementation of the Switcher dual Shutter with single light device.
Source code in src/aioswitcher/device/__init__.py
481 482 483 484 485 486 487 488 489 490 491 492 493 |
|
__post_init__()
⚓︎
Post initialization.
Validate device type category as DUAL_SHUTTER_SINGLE_LIGHT.
Source code in src/aioswitcher/device/__init__.py
486 487 488 489 490 491 492 493 |
|
SwitcherDualShutterSingleLightBase
dataclass
⚓︎
Bases: ABC
Abstraction for all switcher devices controlling dual shutter with single light.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
position |
List[int]
|
the current array of position of the shutter (integer percentage). |
required |
direction |
List[ShutterDirection]
|
the current array of direction of the shutter. |
required |
light |
List[DeviceState]
|
the current array of light state. |
required |
Source code in src/aioswitcher/device/__init__.py
383 384 385 386 387 388 389 390 391 392 393 394 395 |
|
SwitcherLight
dataclass
⚓︎
Bases: SwitcherLightBase
, SwitcherBase
Implementation of the Switcher Light device.
Source code in src/aioswitcher/device/__init__.py
496 497 498 499 500 501 502 503 504 505 |
|
__post_init__()
⚓︎
Post initialization validate device type category as LIGHT.
Source code in src/aioswitcher/device/__init__.py
501 502 503 504 505 |
|
SwitcherLightBase
dataclass
⚓︎
Bases: ABC
Abstraction for all switcher devices controlling light.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
light |
List[DeviceState]
|
the current array of light state. |
required |
Source code in src/aioswitcher/device/__init__.py
398 399 400 401 402 403 404 405 406 |
|
SwitcherPowerBase
dataclass
⚓︎
Bases: ABC
Abstraction for all switcher devices reporting power data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
power_consumption |
int
|
the current power consumption in watts. |
required |
electric_current |
float
|
the current power consumption in amps. |
required |
Source code in src/aioswitcher/device/__init__.py
301 302 303 304 305 306 307 308 309 310 311 312 |
|
SwitcherPowerPlug
dataclass
⚓︎
Bases: SwitcherPowerBase
, SwitcherBase
Implementation of the Switcher Power Plug device.
Please Note the order of the inherited classes to understand the order of the instantiation parameters and the super call.
Source code in src/aioswitcher/device/__init__.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
|
__post_init__()
⚓︎
Post initialization validate device type category as POWER_PLUG.
Source code in src/aioswitcher/device/__init__.py
418 419 420 421 422 |
|
SwitcherShutter
dataclass
⚓︎
Bases: SwitcherShutterBase
, SwitcherBase
Implementation of the Switcher Shutter device.
Source code in src/aioswitcher/device/__init__.py
454 455 456 457 458 459 460 461 462 463 |
|
__post_init__()
⚓︎
Post initialization validate device type category as SHUTTER.
Source code in src/aioswitcher/device/__init__.py
459 460 461 462 463 |
|
SwitcherShutterBase
dataclass
⚓︎
Bases: ABC
Abstraction for all switcher devices controlling shutter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
position |
List[int]
|
the current array of position of the shutter (integer percentage). |
required |
direction |
List[ShutterDirection]
|
the current array of direction of the shutter. |
required |
Source code in src/aioswitcher/device/__init__.py
355 356 357 358 359 360 361 362 363 364 365 |
|
SwitcherSingleShutterDualLight
dataclass
⚓︎
Bases: SwitcherSingleShutterDualLightBase
, SwitcherBase
Implementation of the Switcher Shutter with dual light device.
Source code in src/aioswitcher/device/__init__.py
466 467 468 469 470 471 472 473 474 475 476 477 478 |
|
__post_init__()
⚓︎
Post initialization.
Validate device type category as SINGLE_SHUTTER_DUAL_LIGHT.
Source code in src/aioswitcher/device/__init__.py
471 472 473 474 475 476 477 478 |
|
SwitcherSingleShutterDualLightBase
dataclass
⚓︎
Bases: ABC
Abstraction for all switcher devices controlling shutter with dual light.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
position |
List[int]
|
the current array of position of the shutter (integer percentage). |
required |
direction |
List[ShutterDirection]
|
the current array of direction of the shutter. |
required |
light |
List[DeviceState]
|
the current array of light state. |
required |
Source code in src/aioswitcher/device/__init__.py
368 369 370 371 372 373 374 375 376 377 378 379 380 |
|
SwitcherThermostat
dataclass
⚓︎
Bases: SwitcherThermostatBase
, SwitcherBase
Implementation of the Switcher Thermostat device.
Source code in src/aioswitcher/device/__init__.py
441 442 443 444 445 446 447 448 449 450 451 |
|
__post_init__()
⚓︎
Post initialization validate device type category as THERMOSTAT.
Source code in src/aioswitcher/device/__init__.py
446 447 448 449 450 451 |
|
SwitcherThermostatBase
dataclass
⚓︎
Bases: ABC
Abstraction for switcher thermostat devices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode |
ThermostatMode
|
the mode of the thermostat. |
required |
temperature |
float
|
the current temperature in celsius. |
required |
target_temperature |
int
|
the current target temperature in celsius. |
required |
fan_level |
ThermostatFanLevel
|
the current fan level in celsius. |
required |
swing |
ThermostatSwing
|
the current swing state. |
required |
remote_id |
str
|
the id of the remote used to control this thermostat |
required |
Source code in src/aioswitcher/device/__init__.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
SwitcherTimedBase
dataclass
⚓︎
Bases: ABC
Abstraction for all switcher devices supporting timed operations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
remaining_time |
str
|
remaining time to current run. |
required |
auto_shutdown |
str
|
configured value for auto shutdown. |
required |
Source code in src/aioswitcher/device/__init__.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
|
auto_off_set: str
property
⚓︎
Fix for backward compatibility issues with home assistant.
SwitcherWaterHeater
dataclass
⚓︎
Bases: SwitcherTimedBase
, SwitcherPowerBase
, SwitcherBase
Implementation of the Switcher Water Heater device.
Please Note the order of the inherited classes to understand the order of the instantiation parameters and the super call.
Source code in src/aioswitcher/device/__init__.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
|
__post_init__()
⚓︎
Post initialization validate device type category as WATER_HEATER.
Source code in src/aioswitcher/device/__init__.py
434 435 436 437 438 |
|
ThermostatFanLevel
⚓︎
Bases: Enum
Enum class representing the thermostat device's fan level.
Source code in src/aioswitcher/device/__init__.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
display: str
property
⚓︎
Return the display name of the fan level.
value: str
property
⚓︎
Return the value of the fan level.
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
203 204 205 206 207 208 |
|
ThermostatMode
⚓︎
Bases: Enum
Enum class representing the thermostat device's position.
Source code in src/aioswitcher/device/__init__.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
display: str
property
⚓︎
Return the display name of the mode.
value: str
property
⚓︎
Return the value of the mode.
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
177 178 179 180 181 182 |
|
ThermostatSwing
⚓︎
Bases: Enum
Enum class representing the thermostat device's swing state.
Source code in src/aioswitcher/device/__init__.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
display: str
property
⚓︎
Return the display name of the swing.
value: str
property
⚓︎
Return the value of the swing.
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
227 228 229 230 231 232 |
|
Switcher integration device module tools.
convert_str_to_devicetype(device_type)
⚓︎
Convert string name to DeviceType.
Source code in src/aioswitcher/device/tools.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
convert_token_to_packet(token)
⚓︎
Convert a token to token packet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token |
str
|
the token of the user sent by Email |
required |
Return
Token packet if token is valid, otherwise empty string or raise error.
Source code in src/aioswitcher/device/tools.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
current_timestamp_to_hexadecimal()
⚓︎
Generate hexadecimal representation of the current timestamp.
Return
Hexadecimal representation of the current unix time retrieved by time.time
.
Source code in src/aioswitcher/device/tools.py
125 126 127 128 129 130 131 132 133 134 135 |
|
get_light_api_packet_index(device_type, circuit_number)
⚓︎
Return the correct light api packet index.
Used in sending the light on/off status with the packet (based of device type and circuit number).
Source code in src/aioswitcher/device/tools.py
322 323 324 325 326 327 328 329 330 |
|
get_light_discovery_packet_index(device_type, circuit_number)
⚓︎
Return the correct light discovery packet index.
Used in retriving the light on/off status from the packet (based of device type and circuit number).
Source code in src/aioswitcher/device/tools.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
|
get_shutter_api_packet_index(device_type, circuit_number)
⚓︎
Return the correct shutter api packet index.
Used in sending the shutter position/direction with the packet (based of device type and circuit number).
Source code in src/aioswitcher/device/tools.py
311 312 313 314 315 316 317 318 319 |
|
get_shutter_discovery_packet_index(device_type, circuit_number)
⚓︎
Return the correct shutter discovery packet index.
Used in retriving the shutter position/direction from the packet (based of device type and circuit number).
Source code in src/aioswitcher/device/tools.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
|
minutes_to_hexadecimal_seconds(minutes)
⚓︎
Encode minutes to an hexadecimal packed as little endian unsigned int.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
minutes |
int
|
minutes to encode. |
required |
Return
Hexadecimal representation of the minutes argument.
Source code in src/aioswitcher/device/tools.py
74 75 76 77 78 79 80 81 82 83 84 |
|
seconds_to_iso_time(all_seconds)
⚓︎
Convert seconds to iso time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
all_seconds |
int
|
the total number of seconds to convert. |
required |
Return
A string representing the converted iso time in %H:%M:%S format. e.g. "02:24:37".
Source code in src/aioswitcher/device/tools.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
set_message_length(message)
⚓︎
Set the message length.
Source code in src/aioswitcher/device/tools.py
143 144 145 146 |
|
sign_packet_with_crc_key(hex_packet)
⚓︎
Sign the packets with the designated crc key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hex_packet |
str
|
packet to sign. |
required |
Return
The calculated and signed packet.
Source code in src/aioswitcher/device/tools.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
string_to_hexadecimale_device_name(name)
⚓︎
Encode string device name to an appropriate hexadecimal value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
the desired name for encoding. |
required |
Return
Hexadecimal representation of the name argument.
Source code in src/aioswitcher/device/tools.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
timedelta_to_hexadecimal_seconds(full_time)
⚓︎
Encode timedelta as seconds to an hexadecimal packed as little endian unsigned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
full_time |
datetime.timedelta
|
timedelta time between 1 and 24 hours, seconds are ignored. |
required |
Return
Hexadecimal representation of the seconds built fom the full_time argument.
Source code in src/aioswitcher/device/tools.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
validate_token(username, token)
async
⚓︎
Make an asynchronous API call to validate a Token by username and token.
Source code in src/aioswitcher/device/tools.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
|
watts_to_amps(watts)
⚓︎
Convert power consumption to watts to electric current in amps.
Source code in src/aioswitcher/device/tools.py
138 139 140 |
|
Switcher integration schedule module.
Days
⚓︎
Bases: Enum
Enum class representing the day entity.
Source code in src/aioswitcher/schedule/__init__.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
bit_rep: int
property
⚓︎
Return the bit representation of the day.
hex_rep: int
property
⚓︎
Return the hexadecimal representation of the day.
weekday: int
property
⚓︎
Return the weekday of the day.
__new__(value, hex_rep, bit_rep, weekday)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/schedule/__init__.py
40 41 42 43 44 45 46 47 |
|
ScheduleState
⚓︎
Bases: Enum
Enum representing the status of the schedule.
Source code in src/aioswitcher/schedule/__init__.py
20 21 22 23 24 25 |
|
Switcher integration schedule parser module.
ScheduleParser
dataclass
⚓︎
Schedule parsing tool.
Source code in src/aioswitcher/schedule/parser.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
get_days()
⚓︎
Retun a set of the scheduled Days.
Source code in src/aioswitcher/schedule/parser.py
82 83 84 85 86 87 88 |
|
get_end_time()
⚓︎
Return the schedule end time in %H:%M format.
Source code in src/aioswitcher/schedule/parser.py
101 102 103 |
|
get_id()
⚓︎
Return the id of the schedule.
Source code in src/aioswitcher/schedule/parser.py
70 71 72 |
|
get_start_time()
⚓︎
Return the schedule start time in %H:%M format.
Source code in src/aioswitcher/schedule/parser.py
97 98 99 |
|
get_state()
⚓︎
Return the current state of the device.
Not sure if this needs to be included in the schedule object.
Source code in src/aioswitcher/schedule/parser.py
90 91 92 93 94 95 |
|
is_enabled()
⚓︎
Return true if enbaled.
Source code in src/aioswitcher/schedule/parser.py
74 75 76 |
|
is_recurring()
⚓︎
Return true if a recurring schedule.
Source code in src/aioswitcher/schedule/parser.py
78 79 80 |
|
SwitcherSchedule
dataclass
⚓︎
representation of the Switcher schedule slot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id |
str
|
the id of the schedule |
required |
recurring |
bool
|
is a recurring schedule |
required |
days |
Set[Days]
|
a set of schedule days, or empty set for non recurring schedules |
required |
start_time |
str
|
the start time of the schedule |
required |
end_time |
str
|
the end time of the schedule |
required |
Source code in src/aioswitcher/schedule/parser.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
__eq__(obj)
⚓︎
For usage with set, implementation of the eq magic method.
Source code in src/aioswitcher/schedule/parser.py
56 57 58 59 60 |
|
__hash__()
⚓︎
For usage with set, implementation of the hash magic method.
Source code in src/aioswitcher/schedule/parser.py
52 53 54 |
|
__post_init__()
⚓︎
Post initialization, set duration and display.
Source code in src/aioswitcher/schedule/parser.py
47 48 49 50 |
|
get_schedules(message)
⚓︎
Use to create a list of schedule from a response message from the device.
Source code in src/aioswitcher/schedule/parser.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
Switcher integration schedule module tools.
bit_summary_to_days(sum_weekdays_bit)
⚓︎
Decode a weekdays bit summary to a set of weekdays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sum_weekdays_bit |
int
|
the sum of all weekdays |
required |
Return
Set of Weekday members decoded from the summary value.
Todo
Should an existing remainder in the sum value throw an error? E.g. 3 will result in a set of MONDAY and the remainder will be 1.
Source code in src/aioswitcher/schedule/tools.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
calc_duration(start_time, end_time)
⚓︎
Use to calculate the delta between two time values formated as %H:%M.
Source code in src/aioswitcher/schedule/tools.py
77 78 79 80 81 82 83 |
|
hexadecimale_timestamp_to_localtime(hex_timestamp)
⚓︎
Decode an hexadecimale timestamp to localtime with the format %H:%M.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hex_timestamp |
bytes
|
the hexadecimale timestamp. |
required |
Return
Localtime string with %H:%M format. e.g. "20:30".
Source code in src/aioswitcher/schedule/tools.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
pretty_next_run(start_time, days=set())
⚓︎
Create a literal for displaying the next run time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_time |
str
|
the start of the schedule in "%H:%M" format, e.g. "17:00". |
required |
days |
Set[Days]
|
for recurring schedules, a list of days when none, will be today. |
set()
|
Returns:
Type | Description |
---|---|
str
|
A pretty string describing the next due run. |
str
|
e.g. "Due next Sunday at 17:00". |
Source code in src/aioswitcher/schedule/tools.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
time_to_hexadecimal_timestamp(time_value)
⚓︎
Convert hours and minutes to a timestamp with the current date and encode.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time_value |
str
|
time to convert. e.g. "21:00". |
required |
Return
Hexadecimal representation of the timestamp.
Source code in src/aioswitcher/schedule/tools.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
weekdays_to_hexadecimal(days)
⚓︎
Sum the requested weekdays bit representation and return as hexadecimal value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
days |
Union[Days, Set[Days]]
|
the requested Weekday members. |
required |
Return
Hexadecimale representation of the sum of all requested days.
Source code in src/aioswitcher/schedule/tools.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|