Code documentation⚓︎
Switcher integration TCP socket API module.
Modules:
Name | Description |
---|---|
messages |
Switcher integration TCP socket API messages. |
packets |
Switcher integration TCP socket API packet formats. |
remotes |
Switcher integration API remote related classes and functions. |
Command
⚓︎
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 |
Methods:
Name | Description |
---|---|
connect |
Connect to asynchronous socket and get reader and writer object. |
control_breeze_device |
Use for sending the control packet to the Breeze device. |
control_device |
Use for sending the control packet to the device. |
create_schedule |
Use for creating a new schedule in the next empty schedule slot. |
delete_schedule |
Use for deleting a schedule from the device. |
disconnect |
Disconnect from asynchronous socket. |
get_breeze_state |
Use for sending the get state packet to the Breeze device. |
get_light_state |
Use for sending the get state packet to the Light devices. |
get_schedules |
Use for retrieval of the schedules from the device. |
get_shutter_state |
Use for sending the get state packet to the Runners devices. |
get_state |
Use for sending the get state packet to the device. |
set_auto_shutdown |
Use for sending the set auto-off packet to the device. |
set_device_name |
Use for sending the set name packet to the device. |
set_light |
Use for turn on/off light. |
set_position |
Use for setting the shutter position of the Runners devices. |
set_shutter_child_lock |
Use for turn on/off shutter child lock. |
stop_shutter |
Use for stopping the shutter. |
Source code in src/aioswitcher/api/__init__.py
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 |
|
connected: bool
property
⚓︎
Return true if api is connected.
connect()
async
⚓︎
Connect to asynchronous socket and get reader and writer object.
Source code in src/aioswitcher/api/__init__.py
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
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 |
|
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
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
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
disconnect()
async
⚓︎
Disconnect from asynchronous socket.
Source code in src/aioswitcher/api/__init__.py
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
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
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
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
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
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
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
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
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
set_shutter_child_lock(command, index=0)
async
⚓︎
Use for turn on/off shutter child lock.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command
|
ShutterChildLock
|
use the |
required |
index
|
int
|
which shutter child lock to turn on/off, default to 0. |
0
|
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
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
Switcher integration TCP socket API messages.
StateMessageParser
dataclass
⚓︎
Use for parsing api messages.
Methods:
Name | Description |
---|---|
get_auto_shutdown |
Return the value of the auto shutdown configuration. |
get_light_state |
Return the current light state. |
get_power_consumption |
Return the current power consumption of the device. |
get_shutter_child_lock |
Return the current shutter child lock. |
get_shutter_direction |
Return the current shutter direction. |
get_shutter_position |
Return the current shutter position. |
get_state |
Return the current device state. |
get_thermostat_fan_level |
Return the current thermostat fan level. |
get_thermostat_mode |
Return the current thermostat mode. |
get_thermostat_remote_id |
Return the current thermostat remote. |
get_thermostat_state |
Return the current thermostat state. |
get_thermostat_swing |
Return the current thermostat fan swing. |
get_thermostat_target_temp |
Return the current temperature of the thermostat. |
get_thermostat_temp |
Return the current temp of the thermostat. |
get_time_left |
Return the time left for the device current run. |
get_time_on |
Return how long the device has been on. |
Source code in src/aioswitcher/api/messages.py
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 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
get_auto_shutdown()
⚓︎
Return the value of the auto shutdown configuration.
Source code in src/aioswitcher/api/messages.py
get_light_state(index)
⚓︎
Return the current light state.
Source code in src/aioswitcher/api/messages.py
get_power_consumption()
⚓︎
get_shutter_child_lock(index)
⚓︎
Return the current shutter child lock.
Source code in src/aioswitcher/api/messages.py
get_shutter_direction(index)
⚓︎
Return the current shutter direction.
Source code in src/aioswitcher/api/messages.py
get_shutter_position(index)
⚓︎
Return the current shutter position.
Source code in src/aioswitcher/api/messages.py
get_state()
⚓︎
get_thermostat_fan_level()
⚓︎
Return the current thermostat fan level.
Source code in src/aioswitcher/api/messages.py
get_thermostat_mode()
⚓︎
Return the current thermostat mode.
Source code in src/aioswitcher/api/messages.py
get_thermostat_remote_id()
⚓︎
get_thermostat_state()
⚓︎
Return the current thermostat state.
get_thermostat_swing()
⚓︎
Return the current thermostat fan swing.
Source code in src/aioswitcher/api/messages.py
get_thermostat_target_temp()
⚓︎
get_thermostat_temp()
⚓︎
get_time_left()
⚓︎
Return the time left for the device current run.
Source code in src/aioswitcher/api/messages.py
get_time_on()
⚓︎
Return how long the device has been on.
Source code in src/aioswitcher/api/messages.py
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
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
found_schedules: bool
property
⚓︎
Return true if found schedules in the response.
SwitcherLightStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the Switcher light devices state response message.
Source code in src/aioswitcher/api/messages.py
SwitcherLoginResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representations of the switcher login response message.
Source code in src/aioswitcher/api/messages.py
SwitcherShutterStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the Switcher shutter devices state response message.
Source code in src/aioswitcher/api/messages.py
SwitcherStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the switcher state response message.
Source code in src/aioswitcher/api/messages.py
SwitcherThermostatStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the Switcher thermostat device state response message.
Source code in src/aioswitcher/api/messages.py
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
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 |
Methods:
Name | Description |
---|---|
build_command |
Build command that controls the Breeze device. |
build_swing_command |
Build a special command to control swing on special remotes. |
Source code in src/aioswitcher/api/remotes.py
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 |
|
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.
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
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 |
|
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
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
|
Methods:
Name | Description |
---|---|
get_remote |
Get Breeze remote by the remote id. |
Source code in src/aioswitcher/api/remotes.py
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
Switcher integration, UDP Bridge module.
DatagramParser
dataclass
⚓︎
Utility class for parsing a datagram into various device properties.
Methods:
Name | Description |
---|---|
get_auto_shutdown |
Extract the auto shutdown value from the broadcast message. |
get_device_id |
Extract the device id from the broadcast message. |
get_device_key |
Extract the device id from the broadcast message. |
get_device_state |
Extract the device state from the broadcast message. |
get_device_type |
Extract the device type from the broadcast message. |
get_ip_type1 |
Extract the IP address from the type1 broadcast message (Heater, Plug). |
get_ip_type2 |
Extract the IP address from the broadcast message (Breeze, Runners). |
get_light_state |
Extract the light state from the broadcast message. |
get_mac_type1 |
Extract the MAC address from the broadcast message (Heater, Plug). |
get_mac_type2 |
Extract the MAC address from the broadcast message (Breeze, Runners). |
get_name |
Extract the device name from the broadcast message. |
get_power_consumption |
Extract the power consumption from the broadcast message. |
get_remaining |
Extract the time remains for the current execution. |
get_shutter_child_lock |
Extract the shutter child lock state from the broadcast message. |
get_shutter_direction |
Return the current direction of the shutter (UP/DOWN/STOP). |
get_shutter_position |
Return the current position of the shutter 0 <= pos <= 100. |
get_thermostat_fan_level |
Return the current thermostat fan level. |
get_thermostat_mode |
Return the current thermostat mode. |
get_thermostat_remote_id |
Return the current thermostat remote. |
get_thermostat_state |
Return the current thermostat state. |
get_thermostat_swing |
Return the current thermostat fan swing. |
get_thermostat_target_temp |
Return the current temp of the thermostat. |
get_thermostat_temp |
Return the current temp of the thermostat. |
is_switcher_originator |
Verify the broadcast message had originated from a switcher device. |
Source code in src/aioswitcher/bridge.py
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 |
|
get_auto_shutdown()
⚓︎
Extract the auto shutdown value from the broadcast message.
Source code in src/aioswitcher/bridge.py
get_device_id()
⚓︎
get_device_key()
⚓︎
get_device_state()
⚓︎
Extract the device state from the broadcast message.
Source code in src/aioswitcher/bridge.py
get_device_type()
⚓︎
Extract the device type from the broadcast message.
get_ip_type1()
⚓︎
Extract the IP address from the type1 broadcast message (Heater, Plug).
Source code in src/aioswitcher/bridge.py
get_ip_type2()
⚓︎
Extract the IP address from the broadcast message (Breeze, Runners).
Source code in src/aioswitcher/bridge.py
get_light_state(index)
⚓︎
Extract the light state from the broadcast message.
Source code in src/aioswitcher/bridge.py
get_mac_type1()
⚓︎
Extract the MAC address from the broadcast message (Heater, Plug).
Source code in src/aioswitcher/bridge.py
get_mac_type2()
⚓︎
Extract the MAC address from the broadcast message (Breeze, Runners).
Source code in src/aioswitcher/bridge.py
get_name()
⚓︎
get_power_consumption()
⚓︎
Extract the power consumption from the broadcast message.
get_remaining()
⚓︎
Extract the time remains for the current execution.
Source code in src/aioswitcher/bridge.py
get_shutter_child_lock(index)
⚓︎
Extract the shutter child lock state from the broadcast message.
Source code in src/aioswitcher/bridge.py
get_shutter_direction(index)
⚓︎
Return the current direction of the shutter (UP/DOWN/STOP).
Source code in src/aioswitcher/bridge.py
get_shutter_position(index)
⚓︎
Return the current position of the shutter 0 <= pos <= 100.
Source code in src/aioswitcher/bridge.py
get_thermostat_fan_level()
⚓︎
Return the current thermostat fan level.
Source code in src/aioswitcher/bridge.py
get_thermostat_mode()
⚓︎
Return the current thermostat mode.
Source code in src/aioswitcher/bridge.py
get_thermostat_remote_id()
⚓︎
get_thermostat_state()
⚓︎
Return the current thermostat state.
get_thermostat_swing()
⚓︎
Return the current thermostat fan swing.
Source code in src/aioswitcher/bridge.py
get_thermostat_target_temp()
⚓︎
get_thermostat_temp()
⚓︎
is_switcher_originator()
⚓︎
Verify the broadcast message had originated from a switcher device.
Source code in src/aioswitcher/bridge.py
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]
|
Methods:
Name | Description |
---|---|
start |
Create an asynchronous listener and start the bridge. |
stop |
Stop the asynchronous bridge. |
Source code in src/aioswitcher/bridge.py
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 |
|
is_running: bool
property
⚓︎
bool: Return true if bridge is running.
start()
async
⚓︎
Create an asynchronous listener and start the bridge.
Source code in src/aioswitcher/bridge.py
stop()
async
⚓︎
Stop the asynchronous bridge.
Source code in src/aioswitcher/bridge.py
UdpClientProtocol
⚓︎
Bases: DatagramProtocol
Implementation of the Asyncio UDP DatagramProtocol.
Methods:
Name | Description |
---|---|
connection_lost |
Call on connection lost. |
connection_made |
Call on connection established. |
datagram_received |
Call on datagram received. |
error_received |
Call on exception received. |
Source code in src/aioswitcher/bridge.py
Switcher integration device module.
Modules:
Name | Description |
---|---|
tools |
Switcher integration device module tools. |
DeviceCategory
⚓︎
Bases: Enum
Enum for relaying the device category.
Source code in src/aioswitcher/device/__init__.py
DeviceState
⚓︎
Bases: Enum
Enum class representing the device's state.
Source code in src/aioswitcher/device/__init__.py
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.
ShutterChildLock
⚓︎
Bases: Enum
Enum class representing the shutter device's child lock state.
Source code in src/aioswitcher/device/__init__.py
ShutterDirection
⚓︎
Bases: Enum
Enum class representing the shutter device's position.
Source code in src/aioswitcher/device/__init__.py
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
SwitcherDualShutterSingleLight
dataclass
⚓︎
Bases: SwitcherDualShutterSingleLightBase
, SwitcherBase
Implementation of the Switcher dual Shutter with single light device.
Source code in src/aioswitcher/device/__init__.py
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
SwitcherLight
dataclass
⚓︎
Bases: SwitcherLightBase
, SwitcherBase
Implementation of the Switcher Light device.
Source code in src/aioswitcher/device/__init__.py
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
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
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
SwitcherShutter
dataclass
⚓︎
Bases: SwitcherShutterBase
, SwitcherBase
Implementation of the Switcher Shutter device.
Source code in src/aioswitcher/device/__init__.py
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
SwitcherSingleShutterDualLight
dataclass
⚓︎
Bases: SwitcherSingleShutterDualLightBase
, SwitcherBase
Implementation of the Switcher Shutter with dual light device.
Source code in src/aioswitcher/device/__init__.py
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
SwitcherThermostat
dataclass
⚓︎
Bases: SwitcherThermostatBase
, SwitcherBase
Implementation of the Switcher Thermostat device.
Source code in src/aioswitcher/device/__init__.py
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
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
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
ThermostatFanLevel
⚓︎
Bases: Enum
Enum class representing the thermostat device's fan level.
Source code in src/aioswitcher/device/__init__.py
ThermostatMode
⚓︎
Bases: Enum
Enum class representing the thermostat device's position.
Source code in src/aioswitcher/device/__init__.py
ThermostatSwing
⚓︎
Bases: Enum
Enum class representing the thermostat device's swing state.
Source code in src/aioswitcher/device/__init__.py
Switcher integration device module tools.
Functions:
Name | Description |
---|---|
convert_token_to_packet |
Convert a token to token packet. |
current_timestamp_to_hexadecimal |
Generate hexadecimal representation of the current timestamp. |
get_light_api_packet_index |
Return the correct light api packet index. |
get_light_discovery_packet_index |
Return the correct light discovery packet index. |
get_shutter_api_packet_index |
Return the correct shutter api packet index. |
get_shutter_discovery_packet_index |
Return the correct shutter discovery packet index. |
minutes_to_hexadecimal_seconds |
Encode minutes to an hexadecimal packed as little endian unsigned int. |
seconds_to_iso_time |
Convert seconds to iso time. |
set_message_length |
Set the message length. |
sign_packet_with_crc_key |
Sign the packets with the designated crc key. |
string_to_hexadecimale_device_name |
Encode string device name to an appropriate hexadecimal value. |
timedelta_to_hexadecimal_seconds |
Encode timedelta as seconds to an hexadecimal packed as little endian unsigned. |
validate_token |
Make an asynchronous API call to validate a Token by username and token. |
watts_to_amps |
Convert power consumption to watts to electric current in amps. |
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
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
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
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
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
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
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
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
set_message_length(message)
⚓︎
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
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
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
|
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
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
Switcher integration schedule module.
Modules:
Name | Description |
---|---|
parser |
Switcher integration schedule parser module. |
tools |
Switcher integration schedule module tools. |
Days
⚓︎
Bases: Enum
Enum class representing the day entity.
Source code in src/aioswitcher/schedule/__init__.py
Switcher integration schedule parser module.
Modules:
Name | Description |
---|---|
tools |
Switcher integration schedule module tools. |
Functions:
Name | Description |
---|---|
get_schedules |
Use to create a list of schedule from a response message from the device. |
ScheduleParser
dataclass
⚓︎
Schedule parsing tool.
Methods:
Name | Description |
---|---|
get_days |
Retun a set of the scheduled Days. |
get_end_time |
Return the schedule end time in %H:%M format. |
get_id |
Return the id of the schedule. |
get_start_time |
Return the schedule start time in %H:%M format. |
get_state |
Return the current state of the device. |
is_enabled |
Return true if enbaled. |
is_recurring |
Return true if a recurring schedule. |
Source code in src/aioswitcher/schedule/parser.py
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
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
Switcher integration schedule module tools.
Functions:
Name | Description |
---|---|
bit_summary_to_days |
Decode a weekdays bit summary to a set of weekdays. |
calc_duration |
Use to calculate the delta between two time values formated as %H:%M. |
hexadecimale_timestamp_to_localtime |
Decode an hexadecimale timestamp to localtime with the format %H:%M. |
pretty_next_run |
Create a literal for displaying the next run time. |
time_to_hexadecimal_timestamp |
Convert hours and minutes to a timestamp with the current date and encode. |
weekdays_to_hexadecimal |
Sum the requested weekdays bit representation and return as hexadecimal value. |
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
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
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
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
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
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.