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
71 72 73 74 75 76 |
|
SwitcherApi
⚓︎
Bases: ABC
Switcher TCP based API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ip_address |
str
|
the ip address assigned to the device. |
required |
device_id |
str
|
the id of the desired device. |
required |
port |
int
|
the port of the device, default is 9957. |
SWITCHER_TCP_PORT_TYPE1
|
Source code in src/aioswitcher/api/__init__.py
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 |
|
__aenter__()
async
⚓︎
Enter SwitcherApi asynchronous context manager.
Returns:
Type | Description |
---|---|
SwitcherApi
|
This instance of |
Source code in src/aioswitcher/api/__init__.py
103 104 105 106 107 108 109 110 111 |
|
__aexit__(exc_type, exc_value, traceback)
async
⚓︎
Exit SwitcherApi asynchronous context manager.
Source code in src/aioswitcher/api/__init__.py
113 114 115 116 117 118 119 120 |
|
__init__(ip_address, device_id, port=SWITCHER_TCP_PORT_TYPE1)
⚓︎
Initialize the Switcher TCP connection API.
Source code in src/aioswitcher/api/__init__.py
89 90 91 92 93 94 95 96 |
|
connect()
async
⚓︎
Connect to asynchronous socket and get reader and writer object.
Source code in src/aioswitcher/api/__init__.py
122 123 124 125 126 127 128 129 130 131 132 |
|
connected()
property
⚓︎
Return true if api is connected.
Source code in src/aioswitcher/api/__init__.py
98 99 100 101 |
|
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]
|
the desired state of the device |
None
|
mode |
Union[ThermostatMode, None]
|
the desired mode of the device |
None
|
target_temp |
int
|
the target temperature |
0
|
fan_level |
Union[ThermostatFanLevel, None]
|
the desired fan level |
None
|
swing |
Union[ThermostatSwing, None]
|
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
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 |
|
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 |
|
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
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
|
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
308 309 310 311 312 313 314 315 316 317 318 319 320 |
|
disconnect()
async
⚓︎
Disconnect from asynchronous socket.
Source code in src/aioswitcher/api/__init__.py
134 135 136 137 138 139 140 141 142 |
|
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
211 212 213 214 215 216 217 218 |
|
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
299 300 301 302 303 304 305 306 |
|
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
203 204 205 206 207 208 209 |
|
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
286 287 288 289 290 291 292 293 294 295 296 297 |
|
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
274 275 276 277 278 279 280 281 282 283 284 |
|
set_position(position=0)
async
⚓︎
Use for setting the shutter position of the Runner and Runner Mini devices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
position |
int
|
the position to set the device to, default to 0. |
0
|
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
262 263 264 265 266 267 268 269 270 271 272 |
|
stop()
async
⚓︎
Use for stopping the shutter.
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
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 |
|
SwitcherType1Api
⚓︎
Bases: SwitcherApi
Switcher Type1 devices (Plug, V2, Touch, V4) TCP based API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ip_address |
str
|
the ip address assigned to the device. |
required |
device_id |
str
|
the id of the desired device. |
required |
Source code in src/aioswitcher/api/__init__.py
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 |
|
__init__(ip_address, device_id)
⚓︎
Initialize the Switcher TCP connection API.
Source code in src/aioswitcher/api/__init__.py
348 349 350 |
|
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
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 |
|
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
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 |
|
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
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
|
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
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
|
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
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
|
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
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 |
|
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
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
|
SwitcherType2Api
⚓︎
Bases: SwitcherApi
Switcher Type2 devices (Breeze, Runners) TCP based API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ip_address |
str
|
the ip address assigned to the device. |
required |
device_id |
str
|
the id of the desired device. |
required |
Source code in src/aioswitcher/api/__init__.py
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 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 |
|
__init__(ip_address, device_id)
⚓︎
Initialize the Switcher TCP connection API.
Source code in src/aioswitcher/api/__init__.py
552 553 554 |
|
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
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 |
|
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
731 732 733 734 735 736 737 738 739 740 741 |
|
get_shutter_state()
async
⚓︎
Use for sending the get state packet to the Runner device.
Returns:
Type | Description |
---|---|
SwitcherShutterStateResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 |
|
set_position(position=0)
async
⚓︎
Use for setting the shutter position of the Runner and Runner Mini devices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
position |
int
|
the position to set the device to, default to 0. |
0
|
Returns:
Type | Description |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
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 |
|
Switcher integration TCP socket API messages.
StateMessageParser
dataclass
⚓︎
Use for parsing api messages.
Source code in src/aioswitcher/api/messages.py
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 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 |
|
__post_init__(response)
⚓︎
Post initialization of the parser.
Source code in src/aioswitcher/api/messages.py
39 40 41 |
|
get_auto_shutdown()
⚓︎
Return the value of the auto shutdown configuration.
Source code in src/aioswitcher/api/messages.py
69 70 71 72 73 74 75 76 77 78 79 |
|
get_power_consumption()
⚓︎
Return the current power consumption of the device.
Source code in src/aioswitcher/api/messages.py
43 44 45 46 |
|
get_shutter_direction()
⚓︎
Return the current shutter direction.
Source code in src/aioswitcher/api/messages.py
138 139 140 141 142 |
|
get_shutter_position()
⚓︎
Return the current shutter position.
Source code in src/aioswitcher/api/messages.py
133 134 135 136 |
|
get_state()
⚓︎
Return the current device state.
Source code in src/aioswitcher/api/messages.py
81 82 83 84 85 |
|
get_thermostat_fan_level()
⚓︎
Return the current thermostat fan level.
Source code in src/aioswitcher/api/messages.py
110 111 112 113 114 115 116 117 |
|
get_thermostat_mode()
⚓︎
Return the current thermostat mode.
Source code in src/aioswitcher/api/messages.py
92 93 94 95 96 97 98 99 |
|
get_thermostat_remote_id()
⚓︎
Return the current thermostat remote.
Source code in src/aioswitcher/api/messages.py
128 129 130 131 |
|
get_thermostat_state()
⚓︎
Return the current thermostat state.
Source code in src/aioswitcher/api/messages.py
87 88 89 90 |
|
get_thermostat_swing()
⚓︎
Return the current thermostat fan swing.
Source code in src/aioswitcher/api/messages.py
119 120 121 122 123 124 125 126 |
|
get_thermostat_target_temp()
⚓︎
Return the current temperature of the thermostat.
Source code in src/aioswitcher/api/messages.py
105 106 107 108 |
|
get_thermostat_temp()
⚓︎
Return the current temp of the thermostat.
Source code in src/aioswitcher/api/messages.py
101 102 103 |
|
get_time_left()
⚓︎
Return the time left for the device current run.
Source code in src/aioswitcher/api/messages.py
48 49 50 51 52 53 54 55 56 57 58 |
|
get_time_on()
⚓︎
Return how long the device has been on.
Source code in src/aioswitcher/api/messages.py
60 61 62 63 64 65 66 67 |
|
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
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
successful()
property
⚓︎
Return true if the response is not empty.
Partially indicating the request was successful.
Source code in src/aioswitcher/api/messages.py
160 161 162 163 164 165 166 |
|
SwitcherGetSchedulesResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the switcher get schedule message.
Source code in src/aioswitcher/api/messages.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
215 216 217 |
|
found_schedules()
property
⚓︎
Return true if found schedules in the response.
Source code in src/aioswitcher/api/messages.py
219 220 221 222 |
|
SwitcherLoginResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representations of the switcher login response message.
Source code in src/aioswitcher/api/messages.py
169 170 171 172 173 174 175 176 177 178 179 180 181 |
|
__post_init__()
⚓︎
Post initialization of the response.
Source code in src/aioswitcher/api/messages.py
176 177 178 179 180 181 |
|
SwitcherShutterStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the Switcher shutter devices state response message.
Source code in src/aioswitcher/api/messages.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
259 260 261 262 263 264 |
|
SwitcherStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the switcher state response message.
Source code in src/aioswitcher/api/messages.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
196 197 198 199 200 201 202 203 204 205 |
|
SwitcherThermostatStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the Switcher thermostat device state response message.
Source code in src/aioswitcher/api/messages.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
238 239 240 241 242 243 244 245 246 247 248 |
|
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 |
|
__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 |
|
max_temperature()
property
⚓︎
Getter for Maximum supported temperature.
Source code in src/aioswitcher/api/remotes.py
178 179 180 181 |
|
min_temperature()
property
⚓︎
Getter for Minimum supported temperature.
Source code in src/aioswitcher/api/remotes.py
183 184 185 186 |
|
modes_features()
property
⚓︎
Getter for supported feature per mode.
Source code in src/aioswitcher/api/remotes.py
166 167 168 169 170 171 |
|
on_off_type()
property
⚓︎
Getter for which indicates if the AC if on/off (toggle) type.
Source code in src/aioswitcher/api/remotes.py
198 199 200 201 |
|
remote_id()
property
⚓︎
Getter for remote id.
Source code in src/aioswitcher/api/remotes.py
188 189 190 191 |
|
separated_swing_command()
property
⚓︎
Getter for which indicates if the AC has a separated swing command.
Source code in src/aioswitcher/api/remotes.py
193 194 195 196 |
|
supported_modes()
property
⚓︎
Getter for supported modes.
Source code in src/aioswitcher/api/remotes.py
173 174 175 176 |
|
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
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 |
|
get_auto_shutdown()
⚓︎
Extract the auto shutdown value from the broadcast message.
Source code in src/aioswitcher/bridge.py
327 328 329 330 331 332 333 334 335 336 337 |
|
get_device_id()
⚓︎
Extract the device id from the broadcast message.
Source code in src/aioswitcher/bridge.py
314 315 316 |
|
get_device_state()
⚓︎
Extract the device state from the broadcast message.
Source code in src/aioswitcher/bridge.py
318 319 320 321 322 323 324 325 |
|
get_device_type()
⚓︎
Extract the device type from the broadcast message.
Source code in src/aioswitcher/bridge.py
356 357 358 359 360 |
|
get_ip_type1()
⚓︎
Extract the IP address from the type1 broadcast message (Heater, Plug).
Source code in src/aioswitcher/bridge.py
281 282 283 284 285 |
|
get_ip_type2()
⚓︎
Extract the IP address from the broadcast message (Breeze, Runners).
Source code in src/aioswitcher/bridge.py
287 288 289 290 291 |
|
get_mac()
⚓︎
Extract the MAC address from the broadcast message.
Source code in src/aioswitcher/bridge.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
|
get_name()
⚓︎
Extract the device name from the broadcast message.
Source code in src/aioswitcher/bridge.py
310 311 312 |
|
get_power_consumption()
⚓︎
Extract the power consumption from the broadcast message.
Source code in src/aioswitcher/bridge.py
339 340 341 342 |
|
get_remaining()
⚓︎
Extract the time remains for the current execution.
Source code in src/aioswitcher/bridge.py
344 345 346 347 348 349 350 351 352 353 354 |
|
get_shutter_direction()
⚓︎
Return the current direction of the shutter (UP/DOWN/STOP).
Source code in src/aioswitcher/bridge.py
369 370 371 372 373 |
|
get_shutter_position()
⚓︎
Return the current position of the shutter 0 <= pos <= 100.
Source code in src/aioswitcher/bridge.py
364 365 366 367 |
|
get_thermostat_fan_level()
⚓︎
Return the current thermostat fan level.
Source code in src/aioswitcher/bridge.py
398 399 400 401 402 |
|
get_thermostat_mode()
⚓︎
Return the current thermostat mode.
Source code in src/aioswitcher/bridge.py
387 388 389 390 391 |
|
get_thermostat_remote_id()
⚓︎
Return the current thermostat remote.
Source code in src/aioswitcher/bridge.py
414 415 416 |
|
get_thermostat_state()
⚓︎
Return the current thermostat state.
Source code in src/aioswitcher/bridge.py
382 383 384 385 |
|
get_thermostat_swing()
⚓︎
Return the current thermostat fan swing.
Source code in src/aioswitcher/bridge.py
404 405 406 407 408 409 410 411 412 |
|
get_thermostat_target_temp()
⚓︎
Return the current temp of the thermostat.
Source code in src/aioswitcher/bridge.py
393 394 395 396 |
|
get_thermostat_temp()
⚓︎
Return the current temp of the thermostat.
Source code in src/aioswitcher/bridge.py
377 378 379 380 |
|
is_switcher_originator()
⚓︎
Verify the broadcast message had originated from a switcher device.
Source code in src/aioswitcher/bridge.py
273 274 275 276 277 278 279 |
|
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 |
[SWITCHER_UDP_PORT_TYPE1, SWITCHER_UDP_PORT_TYPE2]
|
Source code in src/aioswitcher/bridge.py
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 |
|
__aenter__()
async
⚓︎
Enter SwitcherBridge asynchronous context manager.
Source code in src/aioswitcher/bridge.py
184 185 186 187 |
|
__aexit__(exc_type, exc_value, traceback)
async
⚓︎
Exit the SwitcherBridge asynchronous context manager.
Source code in src/aioswitcher/bridge.py
189 190 191 192 193 194 195 196 |
|
__init__(on_device, broadcast_ports=[SWITCHER_UDP_PORT_TYPE1, SWITCHER_UDP_PORT_TYPE2])
⚓︎
Initialize the switcher bridge.
Source code in src/aioswitcher/bridge.py
173 174 175 176 177 178 179 180 181 182 |
|
is_running()
property
⚓︎
bool: Return true if bridge is running.
Source code in src/aioswitcher/bridge.py
228 229 230 231 |
|
start()
async
⚓︎
Create an asynchronous listener and start the bridge.
Source code in src/aioswitcher/bridge.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
|
stop()
async
⚓︎
Stop the asynchronous bridge.
Source code in src/aioswitcher/bridge.py
215 216 217 218 219 220 221 222 223 224 225 226 |
|
UdpClientProtocol
⚓︎
Bases: DatagramProtocol
Implementation of the Asyncio UDP DatagramProtocol.
Source code in src/aioswitcher/bridge.py
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 |
|
__init__(on_datagram)
⚓︎
Initialize the protocol.
Source code in src/aioswitcher/bridge.py
238 239 240 241 |
|
connection_lost(exc)
⚓︎
Call on connection lost.
Source code in src/aioswitcher/bridge.py
258 259 260 261 262 263 |
|
connection_made(transport)
⚓︎
Call on connection established.
Source code in src/aioswitcher/bridge.py
243 244 245 |
|
datagram_received(data, addr)
⚓︎
Call on datagram received.
Source code in src/aioswitcher/bridge.py
247 248 249 |
|
error_received(exc)
⚓︎
Call on exception received.
Source code in src/aioswitcher/bridge.py
251 252 253 254 255 256 |
|
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 |
|
DeviceState
⚓︎
Bases: Enum
Enum class representing the device's state.
Source code in src/aioswitcher/device/__init__.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
87 88 89 90 91 92 |
|
display()
property
⚓︎
Return the display name of the state.
Source code in src/aioswitcher/device/__init__.py
94 95 96 97 |
|
value()
property
⚓︎
Return the value of the state.
Source code in src/aioswitcher/device/__init__.py
99 100 101 102 |
|
DeviceType
⚓︎
Bases: Enum
Enum for relaying the type of the switcher devices.
Source code in src/aioswitcher/device/__init__.py
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 75 76 77 |
|
__new__(value, hex_rep, protocol_type, category)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
48 49 50 51 52 53 54 55 56 57 |
|
category()
property
⚓︎
Return the category of the device type.
Source code in src/aioswitcher/device/__init__.py
74 75 76 77 |
|
hex_rep()
property
⚓︎
Return the hexadecimal representation of the device type.
Source code in src/aioswitcher/device/__init__.py
64 65 66 67 |
|
protocol_type()
property
⚓︎
Return the protocol type of the device.
Source code in src/aioswitcher/device/__init__.py
69 70 71 72 |
|
value()
property
⚓︎
Return the value of the state.
Source code in src/aioswitcher/device/__init__.py
59 60 61 62 |
|
ShutterDirection
⚓︎
Bases: Enum
Enum class representing the shutter device's position.
Source code in src/aioswitcher/device/__init__.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
190 191 192 193 194 195 |
|
display()
property
⚓︎
Return the display name of the direction.
Source code in src/aioswitcher/device/__init__.py
197 198 199 200 |
|
value()
property
⚓︎
Return the value of the direction.
Source code in src/aioswitcher/device/__init__.py
202 203 204 205 |
|
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 |
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
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 |
|
__post_init__()
⚓︎
Post initialization, set last_data_update to the instantiation datetime.
Source code in src/aioswitcher/device/__init__.py
230 231 232 |
|
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
235 236 237 238 239 240 241 242 243 244 245 246 |
|
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
302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
__post_init__()
⚓︎
Post initialization validate device type category as POWER_PLUG.
Source code in src/aioswitcher/device/__init__.py
311 312 313 314 315 |
|
SwitcherShutter
dataclass
⚓︎
Bases: SwitcherShutterBase
, SwitcherBase
Implementation of the Switcher Shutter device.
Source code in src/aioswitcher/device/__init__.py
347 348 349 350 351 352 353 354 355 356 |
|
__post_init__()
⚓︎
Post initialization validate device type category as SHUTTER.
Source code in src/aioswitcher/device/__init__.py
352 353 354 355 356 |
|
SwitcherShutterBase
dataclass
⚓︎
Bases: ABC
Abstraction for all switcher devices controlling shutter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
position |
int
|
the current position of the shutter (integer percentage). |
required |
direction |
ShutterDirection
|
the current direction of the shutter. |
required |
Source code in src/aioswitcher/device/__init__.py
289 290 291 292 293 294 295 296 297 298 299 |
|
SwitcherThermostat
dataclass
⚓︎
Bases: SwitcherThermostatBase
, SwitcherBase
Implementation of the Switcher Thermostat device.
Source code in src/aioswitcher/device/__init__.py
334 335 336 337 338 339 340 341 342 343 344 |
|
__post_init__()
⚓︎
Post initialization validate device type category as THERMOSTAT.
Source code in src/aioswitcher/device/__init__.py
339 340 341 342 343 344 |
|
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
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
|
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
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
|
auto_off_set()
property
⚓︎
Fix for backward compatibility issues with home assistant.
Source code in src/aioswitcher/device/__init__.py
262 263 264 265 |
|
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
318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
|
__post_init__()
⚓︎
Post initialization validate device type category as WATER_HEATER.
Source code in src/aioswitcher/device/__init__.py
327 328 329 330 331 |
|
ThermostatFanLevel
⚓︎
Bases: Enum
Enum class representing the thermostat device's fan level.
Source code in src/aioswitcher/device/__init__.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
140 141 142 143 144 145 |
|
display()
property
⚓︎
Return the display name of the fan level.
Source code in src/aioswitcher/device/__init__.py
147 148 149 150 |
|
value()
property
⚓︎
Return the value of the fan level.
Source code in src/aioswitcher/device/__init__.py
152 153 154 155 |
|
ThermostatMode
⚓︎
Bases: Enum
Enum class representing the thermostat device's position.
Source code in src/aioswitcher/device/__init__.py
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 |
|
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
114 115 116 117 118 119 |
|
display()
property
⚓︎
Return the display name of the mode.
Source code in src/aioswitcher/device/__init__.py
121 122 123 124 |
|
value()
property
⚓︎
Return the value of the mode.
Source code in src/aioswitcher/device/__init__.py
126 127 128 129 |
|
ThermostatSwing
⚓︎
Bases: Enum
Enum class representing the thermostat device's swing state.
Source code in src/aioswitcher/device/__init__.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
164 165 166 167 168 169 |
|
display()
property
⚓︎
Return the display name of the swing.
Source code in src/aioswitcher/device/__init__.py
171 172 173 174 |
|
value()
property
⚓︎
Return the value of the swing.
Source code in src/aioswitcher/device/__init__.py
176 177 178 179 |
|
Switcher integration device module tools.
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
114 115 116 117 118 119 120 121 122 123 124 |
|
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
63 64 65 66 67 68 69 70 71 72 73 |
|
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
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
set_message_length(message)
⚓︎
Set the message length.
Source code in src/aioswitcher/device/tools.py
132 133 134 135 |
|
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
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
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
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
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
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
watts_to_amps(watts)
⚓︎
Convert power consumption to watts to electric current in amps.
Source code in src/aioswitcher/device/tools.py
127 128 129 |
|
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 |
|
__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 |
|
bit_rep()
property
⚓︎
Return the bit representation of the day.
Source code in src/aioswitcher/schedule/__init__.py
49 50 51 52 |
|
hex_rep()
property
⚓︎
Return the hexadecimal representation of the day.
Source code in src/aioswitcher/schedule/__init__.py
54 55 56 57 |
|
weekday()
property
⚓︎
Return the weekday of the day.
Source code in src/aioswitcher/schedule/__init__.py
59 60 61 62 |
|
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
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
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
72 73 74 75 76 77 78 |
|
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
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
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 |
|
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
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
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
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|