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
76 77 78 79 80 81 |
|
SwitcherApi
⚓︎
Bases: ABC
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 |
port |
int
|
the port of the device, default is 9957. |
SWITCHER_TCP_PORT_TYPE1
|
Source code in src/aioswitcher/api/__init__.py
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 |
|
connected: bool
property
⚓︎
Return true if api is connected.
__aenter__()
async
⚓︎
Enter SwitcherApi asynchronous context manager.
Returns:
Type | Description |
---|---|
SwitcherApi
|
This instance of |
Source code in src/aioswitcher/api/__init__.py
123 124 125 126 127 128 129 130 131 |
|
__aexit__(exc_type, exc_value, traceback)
async
⚓︎
Exit SwitcherApi asynchronous context manager.
Source code in src/aioswitcher/api/__init__.py
133 134 135 136 137 138 139 140 |
|
__init__(device_type, ip_address, device_id, device_key, port=SWITCHER_TCP_PORT_TYPE1, token=None)
⚓︎
Initialize the Switcher TCP connection API.
Source code in src/aioswitcher/api/__init__.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
connect()
async
⚓︎
Connect to asynchronous socket and get reader and writer object.
Source code in src/aioswitcher/api/__init__.py
142 143 144 145 146 147 148 149 150 151 152 |
|
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
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 |
|
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
222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
|
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
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
|
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
337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
disconnect()
async
⚓︎
Disconnect from asynchronous socket.
Source code in src/aioswitcher/api/__init__.py
154 155 156 157 158 159 160 161 162 |
|
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
213 214 215 216 217 218 219 220 |
|
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 |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
367 368 369 370 371 372 373 374 375 376 377 |
|
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
328 329 330 331 332 333 334 335 |
|
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 |
---|---|
SwitcherBaseResponse
|
An instance of |
Source code in src/aioswitcher/api/__init__.py
291 292 293 294 295 296 297 298 299 300 301 |
|
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
204 205 206 207 208 209 210 211 |
|
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
315 316 317 318 319 320 321 322 323 324 325 326 |
|
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
303 304 305 306 307 308 309 310 311 312 313 |
|
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
379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
|
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
276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
|
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
264 265 266 267 268 269 270 271 272 273 274 |
|
SwitcherType1Api
⚓︎
Bases: SwitcherApi
Switcher Type1 devices (Plug, V2, Touch, V4) TCP based API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_type |
DeviceType
|
the type of the device. |
required |
ip_address |
str
|
the ip address assigned to the device. |
required |
device_id |
str
|
the id of the desired device. |
required |
device_key |
str
|
the login key of the device. |
required |
Source code in src/aioswitcher/api/__init__.py
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 |
|
__init__(device_type, ip_address, device_id, device_key)
⚓︎
Initialize the Switcher TCP connection API.
Source code in src/aioswitcher/api/__init__.py
406 407 408 409 410 411 412 |
|
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
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 |
|
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
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 |
|
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
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 |
|
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
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 |
|
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
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
|
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
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 |
|
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
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 |
|
SwitcherType2Api
⚓︎
Bases: SwitcherApi
Switcher Type2 devices (Breeze, Runners) TCP based API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_type |
DeviceType
|
the type of the device. |
required |
ip_address |
str
|
the ip address assigned to the device. |
required |
device_id |
str
|
the id of the desired device. |
required |
device_key |
str
|
the login key of the device. |
required |
Source code in src/aioswitcher/api/__init__.py
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 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 |
|
__init__(device_type, ip_address, device_id, device_key, token=None)
⚓︎
Initialize the Switcher TCP connection API.
Source code in src/aioswitcher/api/__init__.py
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 |
|
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
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 |
|
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
870 871 872 873 874 875 876 877 878 879 880 |
|
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
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 |
|
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
900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 |
|
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
962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 |
|
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
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 |
|
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
774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 |
|
Switcher integration TCP socket API messages.
StateMessageParser
dataclass
⚓︎
Use for parsing api messages.
Source code in src/aioswitcher/api/messages.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
__post_init__(response)
⚓︎
Post initialization of the parser.
Source code in src/aioswitcher/api/messages.py
45 46 47 |
|
get_auto_shutdown()
⚓︎
Return the value of the auto shutdown configuration.
Source code in src/aioswitcher/api/messages.py
75 76 77 78 79 80 81 82 83 84 85 |
|
get_light_state(index)
⚓︎
Return the current light state.
Source code in src/aioswitcher/api/messages.py
154 155 156 157 158 159 160 161 162 163 164 |
|
get_power_consumption()
⚓︎
Return the current power consumption of the device.
Source code in src/aioswitcher/api/messages.py
49 50 51 52 |
|
get_shutter_direction(index)
⚓︎
Return the current shutter direction.
Source code in src/aioswitcher/api/messages.py
146 147 148 149 150 151 152 |
|
get_shutter_position(index)
⚓︎
Return the current shutter position.
Source code in src/aioswitcher/api/messages.py
139 140 141 142 143 144 |
|
get_state()
⚓︎
Return the current device state.
Source code in src/aioswitcher/api/messages.py
87 88 89 90 91 |
|
get_thermostat_fan_level()
⚓︎
Return the current thermostat fan level.
Source code in src/aioswitcher/api/messages.py
116 117 118 119 120 121 122 123 |
|
get_thermostat_mode()
⚓︎
Return the current thermostat mode.
Source code in src/aioswitcher/api/messages.py
98 99 100 101 102 103 104 105 |
|
get_thermostat_remote_id()
⚓︎
Return the current thermostat remote.
Source code in src/aioswitcher/api/messages.py
134 135 136 137 |
|
get_thermostat_state()
⚓︎
Return the current thermostat state.
Source code in src/aioswitcher/api/messages.py
93 94 95 96 |
|
get_thermostat_swing()
⚓︎
Return the current thermostat fan swing.
Source code in src/aioswitcher/api/messages.py
125 126 127 128 129 130 131 132 |
|
get_thermostat_target_temp()
⚓︎
Return the current temperature of the thermostat.
Source code in src/aioswitcher/api/messages.py
111 112 113 114 |
|
get_thermostat_temp()
⚓︎
Return the current temp of the thermostat.
Source code in src/aioswitcher/api/messages.py
107 108 109 |
|
get_time_left()
⚓︎
Return the time left for the device current run.
Source code in src/aioswitcher/api/messages.py
54 55 56 57 58 59 60 61 62 63 64 |
|
get_time_on()
⚓︎
Return how long the device has been on.
Source code in src/aioswitcher/api/messages.py
66 67 68 69 70 71 72 73 |
|
SwitcherBaseResponse
dataclass
⚓︎
Representation of the switcher base response message.
Applicable for all messages that do no require post initialization. e.g. not applicable for SwitcherLoginResponse, SwitcherStateResponse, SwitcherGetScheduleResponse.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
unparsed_response |
bytes
|
the raw response from the device. |
required |
Source code in src/aioswitcher/api/messages.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
successful: bool
property
⚓︎
Return true if the response is not empty.
Partially indicating the request was successful.
SwitcherGetSchedulesResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the switcher get schedule message.
Source code in src/aioswitcher/api/messages.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
|
found_schedules: bool
property
⚓︎
Return true if found schedules in the response.
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
237 238 239 |
|
SwitcherLightStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the Switcher light devices state response message.
Source code in src/aioswitcher/api/messages.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
|
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
301 302 303 304 305 306 |
|
SwitcherLoginResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representations of the switcher login response message.
Source code in src/aioswitcher/api/messages.py
191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
__post_init__()
⚓︎
Post initialization of the response.
Source code in src/aioswitcher/api/messages.py
198 199 200 201 202 203 |
|
SwitcherShutterStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the Switcher shutter devices state response message.
Source code in src/aioswitcher/api/messages.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
|
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
283 284 285 286 287 288 289 |
|
SwitcherStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the switcher state response message.
Source code in src/aioswitcher/api/messages.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
218 219 220 221 222 223 224 225 226 227 |
|
SwitcherThermostatStateResponse
dataclass
⚓︎
Bases: SwitcherBaseResponse
Representation of the Switcher thermostat device state response message.
Source code in src/aioswitcher/api/messages.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
|
__post_init__()
⚓︎
Post initialization of the message.
Source code in src/aioswitcher/api/messages.py
260 261 262 263 264 265 266 267 268 269 270 |
|
Switcher integration API remote related classes and functions.
SwitcherBreezeCommand
⚓︎
Representations of the Switcher Breeze command message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command |
str
|
a string command ready to be parsed and sent |
required |
Source code in src/aioswitcher/api/remotes.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
__init__(command)
⚓︎
Initialize the Breeze command.
Source code in src/aioswitcher/api/remotes.py
81 82 83 84 |
|
SwitcherBreezeRemote
⚓︎
Class that represent a remote for a Breeze device/s.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ir_set |
Dict[str, Any]
|
a dictionary for all supported remotes |
required |
Source code in src/aioswitcher/api/remotes.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
|
max_temperature: int
property
⚓︎
Getter for Maximum supported temperature.
min_temperature: int
property
⚓︎
Getter for Minimum supported temperature.
modes_features: Dict[ThermostatMode, Dict[str, Any]]
property
⚓︎
Getter for supported feature per mode.
on_off_type: bool
property
⚓︎
Getter for which indicates if the AC if on/off (toggle) type.
remote_id: str
property
⚓︎
Getter for remote id.
separated_swing_command: bool
property
⚓︎
Getter for which indicates if the AC has a separated swing command.
supported_modes: List[ThermostatMode]
property
⚓︎
Getter for supported modes.
__init__(ir_set)
⚓︎
Initialize the remote by parsing the ir_set data.
Source code in src/aioswitcher/api/remotes.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
build_command(state, mode, target_temp, fan_level, swing, current_state=None)
⚓︎
Build command that controls the Breeze device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state |
DeviceState
|
the desired state of the device |
required |
mode |
ThermostatMode
|
the desired mode of the device |
required |
target_temp |
int
|
the target temperature |
required |
fan_level |
ThermostatFanLevel
|
the desired fan level |
required |
swing |
ThermostatSwing
|
the desired swing state |
required |
current_state |
Union[DeviceState, None]
|
optionally, for toggle device, pass previous state to avoid redundant requests |
None
|
Returns:
Type | Description |
---|---|
SwitcherBreezeCommand
|
An instance of |
Source code in src/aioswitcher/api/remotes.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
|
build_swing_command(swing)
⚓︎
Build a special command to control swing on special remotes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
swing |
ThermostatSwing
|
the desired swing state |
required |
Returns:
Type | Description |
---|---|
SwitcherBreezeCommand
|
An instance of |
Source code in src/aioswitcher/api/remotes.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
|
SwitcherBreezeRemoteManager
⚓︎
Class for managing Breeze remotes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
remotes_db_path |
str
|
optional path of supported remote json file |
BREEZE_REMOTE_DB_FPATH
|
Source code in src/aioswitcher/api/remotes.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
|
__init__(remotes_db_path=BREEZE_REMOTE_DB_FPATH)
⚓︎
Initialize the Remote manager.
Source code in src/aioswitcher/api/remotes.py
416 417 418 419 |
|
get_remote(remote_id)
⚓︎
Get Breeze remote by the remote id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
remote_id |
str
|
the id of the desired remote |
required |
Returns:
Type | Description |
---|---|
SwitcherBreezeRemote
|
an instance of |
Source code in src/aioswitcher/api/remotes.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
|
Switcher integration, UDP Bridge module.
DatagramParser
dataclass
⚓︎
Utility class for parsing a datagram into various device properties.
Source code in src/aioswitcher/bridge.py
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 |
|
get_auto_shutdown()
⚓︎
Extract the auto shutdown value from the broadcast message.
Source code in src/aioswitcher/bridge.py
409 410 411 412 413 414 415 416 417 418 419 |
|
get_device_id()
⚓︎
Extract the device id from the broadcast message.
Source code in src/aioswitcher/bridge.py
392 393 394 |
|
get_device_key()
⚓︎
Extract the device id from the broadcast message.
Source code in src/aioswitcher/bridge.py
396 397 398 |
|
get_device_state()
⚓︎
Extract the device state from the broadcast message.
Source code in src/aioswitcher/bridge.py
400 401 402 403 404 405 406 407 |
|
get_device_type()
⚓︎
Extract the device type from the broadcast message.
Source code in src/aioswitcher/bridge.py
438 439 440 441 442 |
|
get_ip_type1()
⚓︎
Extract the IP address from the type1 broadcast message (Heater, Plug).
Source code in src/aioswitcher/bridge.py
342 343 344 345 346 |
|
get_ip_type2()
⚓︎
Extract the IP address from the broadcast message (Breeze, Runners).
Source code in src/aioswitcher/bridge.py
348 349 350 351 352 |
|
get_light_state(index)
⚓︎
Extract the light state from the broadcast message.
Source code in src/aioswitcher/bridge.py
461 462 463 464 465 466 467 468 469 470 471 |
|
get_mac_type1()
⚓︎
Extract the MAC address from the broadcast message (Heater, Plug).
Source code in src/aioswitcher/bridge.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
|
get_mac_type2()
⚓︎
Extract the MAC address from the broadcast message (Breeze, Runners).
Source code in src/aioswitcher/bridge.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
|
get_name()
⚓︎
Extract the device name from the broadcast message.
Source code in src/aioswitcher/bridge.py
388 389 390 |
|
get_power_consumption()
⚓︎
Extract the power consumption from the broadcast message.
Source code in src/aioswitcher/bridge.py
421 422 423 424 |
|
get_remaining()
⚓︎
Extract the time remains for the current execution.
Source code in src/aioswitcher/bridge.py
426 427 428 429 430 431 432 433 434 435 436 |
|
get_shutter_direction(index)
⚓︎
Return the current direction of the shutter (UP/DOWN/STOP).
Source code in src/aioswitcher/bridge.py
453 454 455 456 457 458 459 |
|
get_shutter_position(index)
⚓︎
Return the current position of the shutter 0 <= pos <= 100.
Source code in src/aioswitcher/bridge.py
446 447 448 449 450 451 |
|
get_thermostat_fan_level()
⚓︎
Return the current thermostat fan level.
Source code in src/aioswitcher/bridge.py
496 497 498 499 500 |
|
get_thermostat_mode()
⚓︎
Return the current thermostat mode.
Source code in src/aioswitcher/bridge.py
485 486 487 488 489 |
|
get_thermostat_remote_id()
⚓︎
Return the current thermostat remote.
Source code in src/aioswitcher/bridge.py
512 513 514 |
|
get_thermostat_state()
⚓︎
Return the current thermostat state.
Source code in src/aioswitcher/bridge.py
480 481 482 483 |
|
get_thermostat_swing()
⚓︎
Return the current thermostat fan swing.
Source code in src/aioswitcher/bridge.py
502 503 504 505 506 507 508 509 510 |
|
get_thermostat_target_temp()
⚓︎
Return the current temp of the thermostat.
Source code in src/aioswitcher/bridge.py
491 492 493 494 |
|
get_thermostat_temp()
⚓︎
Return the current temp of the thermostat.
Source code in src/aioswitcher/bridge.py
475 476 477 478 |
|
is_switcher_originator()
⚓︎
Verify the broadcast message had originated from a switcher device.
Source code in src/aioswitcher/bridge.py
333 334 335 336 337 338 339 340 |
|
SwitcherBridge
⚓︎
Use for running a UDP client for bridging Switcher devices broadcast messages.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
on_device |
Callable[[SwitcherBase], Any]
|
a callable to which every new SwitcherBase device found will be send. |
required |
broadcast_ports |
List[int]
|
broadcast ports list, default for type 1 devices is 20002, default for type 2 devices is 20003. On newer type1 devices, the port is 10002. On newer type2 devices, the port is 10003. |
[SWITCHER_UDP_PORT_TYPE1, SWITCHER_UDP_PORT_TYPE1_NEW_VERSION, SWITCHER_UDP_PORT_TYPE2, SWITCHER_UDP_PORT_TYPE2_NEW_VERSION]
|
Source code in src/aioswitcher/bridge.py
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 |
|
is_running: bool
property
⚓︎
bool: Return true if bridge is running.
__aenter__()
async
⚓︎
Enter SwitcherBridge asynchronous context manager.
Source code in src/aioswitcher/bridge.py
244 245 246 247 |
|
__aexit__(exc_type, exc_value, traceback)
async
⚓︎
Exit the SwitcherBridge asynchronous context manager.
Source code in src/aioswitcher/bridge.py
249 250 251 252 253 254 255 256 |
|
__init__(on_device, broadcast_ports=[SWITCHER_UDP_PORT_TYPE1, SWITCHER_UDP_PORT_TYPE1_NEW_VERSION, SWITCHER_UDP_PORT_TYPE2, SWITCHER_UDP_PORT_TYPE2_NEW_VERSION])
⚓︎
Initialize the switcher bridge.
Source code in src/aioswitcher/bridge.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
start()
async
⚓︎
Create an asynchronous listener and start the bridge.
Source code in src/aioswitcher/bridge.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
|
stop()
async
⚓︎
Stop the asynchronous bridge.
Source code in src/aioswitcher/bridge.py
275 276 277 278 279 280 281 282 283 284 285 286 |
|
UdpClientProtocol
⚓︎
Bases: DatagramProtocol
Implementation of the Asyncio UDP DatagramProtocol.
Source code in src/aioswitcher/bridge.py
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 |
|
__init__(on_datagram)
⚓︎
Initialize the protocol.
Source code in src/aioswitcher/bridge.py
298 299 300 301 |
|
connection_lost(exc)
⚓︎
Call on connection lost.
Source code in src/aioswitcher/bridge.py
318 319 320 321 322 323 |
|
connection_made(transport)
⚓︎
Call on connection established.
Source code in src/aioswitcher/bridge.py
303 304 305 |
|
datagram_received(data, addr)
⚓︎
Call on datagram received.
Source code in src/aioswitcher/bridge.py
307 308 309 |
|
error_received(exc)
⚓︎
Call on exception received.
Source code in src/aioswitcher/bridge.py
311 312 313 314 315 316 |
|
Switcher integration device module.
DeviceCategory
⚓︎
Bases: Enum
Enum for relaying the device category.
Source code in src/aioswitcher/device/__init__.py
24 25 26 27 28 29 30 31 32 |
|
DeviceState
⚓︎
Bases: Enum
Enum class representing the device's state.
Source code in src/aioswitcher/device/__init__.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
display: str
property
⚓︎
Return the display name of the state.
value: str
property
⚓︎
Return the value of the state.
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
106 107 108 109 110 111 |
|
DeviceType
⚓︎
Bases: Enum
Enum for relaying the type of the switcher devices.
Source code in src/aioswitcher/device/__init__.py
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 |
|
category: DeviceCategory
property
⚓︎
Return the category of the device type.
hex_rep: str
property
⚓︎
Return the hexadecimal representation of the device type.
protocol_type: int
property
⚓︎
Return the protocol type of the device.
token_needed: bool
property
⚓︎
Return true if token in needed for the device.
value: str
property
⚓︎
Return the value of the state.
__new__(value, hex_rep, protocol_type, category, token_needed)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
ShutterDirection
⚓︎
Bases: Enum
Enum class representing the shutter device's position.
Source code in src/aioswitcher/device/__init__.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
display: str
property
⚓︎
Return the display name of the direction.
value: str
property
⚓︎
Return the value of the direction.
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
209 210 211 212 213 214 |
|
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
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 |
|
__post_init__()
⚓︎
Post initialization, set last_data_update to the instantiation datetime.
Source code in src/aioswitcher/device/__init__.py
252 253 254 |
|
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
257 258 259 260 261 262 263 264 265 266 267 268 |
|
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
339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
__post_init__()
⚓︎
Post initialization validate device type category as POWER_PLUG.
Source code in src/aioswitcher/device/__init__.py
348 349 350 351 352 |
|
SwitcherShutter
dataclass
⚓︎
Bases: SwitcherShutterBase
, SwitcherBase
Implementation of the Switcher Shutter device.
Source code in src/aioswitcher/device/__init__.py
384 385 386 387 388 389 390 391 392 393 |
|
__post_init__()
⚓︎
Post initialization validate device type category as SHUTTER.
Source code in src/aioswitcher/device/__init__.py
389 390 391 392 393 |
|
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
311 312 313 314 315 316 317 318 319 320 321 |
|
SwitcherSingleShutterDualLight
dataclass
⚓︎
Bases: SwitcherSingleShutterDualLightBase
, SwitcherBase
Implementation of the Switcher Shutter with dual light device.
Source code in src/aioswitcher/device/__init__.py
396 397 398 399 400 401 402 403 404 405 406 407 408 |
|
__post_init__()
⚓︎
Post initialization.
Validate device type category as SINGLE_SHUTTER_DUAL_LIGHT.
Source code in src/aioswitcher/device/__init__.py
401 402 403 404 405 406 407 408 |
|
SwitcherSingleShutterDualLightBase
dataclass
⚓︎
Bases: ABC
Abstraction for all switcher devices controlling shutter with dual light.
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 |
lights |
List[DeviceState]
|
the current array of lights state. |
required |
Source code in src/aioswitcher/device/__init__.py
324 325 326 327 328 329 330 331 332 333 334 335 336 |
|
SwitcherThermostat
dataclass
⚓︎
Bases: SwitcherThermostatBase
, SwitcherBase
Implementation of the Switcher Thermostat device.
Source code in src/aioswitcher/device/__init__.py
371 372 373 374 375 376 377 378 379 380 381 |
|
__post_init__()
⚓︎
Post initialization validate device type category as THERMOSTAT.
Source code in src/aioswitcher/device/__init__.py
376 377 378 379 380 381 |
|
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
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
|
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
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
|
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
355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
|
__post_init__()
⚓︎
Post initialization validate device type category as WATER_HEATER.
Source code in src/aioswitcher/device/__init__.py
364 365 366 367 368 |
|
ThermostatFanLevel
⚓︎
Bases: Enum
Enum class representing the thermostat device's fan level.
Source code in src/aioswitcher/device/__init__.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
display: str
property
⚓︎
Return the display name of the fan level.
value: str
property
⚓︎
Return the value of the fan level.
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
159 160 161 162 163 164 |
|
ThermostatMode
⚓︎
Bases: Enum
Enum class representing the thermostat device's position.
Source code in src/aioswitcher/device/__init__.py
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 |
|
display: str
property
⚓︎
Return the display name of the mode.
value: str
property
⚓︎
Return the value of the mode.
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
133 134 135 136 137 138 |
|
ThermostatSwing
⚓︎
Bases: Enum
Enum class representing the thermostat device's swing state.
Source code in src/aioswitcher/device/__init__.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
display: str
property
⚓︎
Return the display name of the swing.
value: str
property
⚓︎
Return the value of the swing.
__new__(value, display)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/device/__init__.py
183 184 185 186 187 188 |
|
Switcher integration device module tools.
convert_str_to_devicetype(device_type)
⚓︎
Convert string name to DeviceType.
Source code in src/aioswitcher/device/tools.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
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
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
current_timestamp_to_hexadecimal()
⚓︎
Generate hexadecimal representation of the current timestamp.
Return
Hexadecimal representation of the current unix time retrieved by time.time
.
Source code in src/aioswitcher/device/tools.py
125 126 127 128 129 130 131 132 133 134 135 |
|
get_light_api_packet_index(device_type, circuit_number)
⚓︎
Return the correct light api packet index.
Used in sending the light on/off status with the packet (based of device type and circuit number).
Source code in src/aioswitcher/device/tools.py
281 282 283 284 285 286 287 288 289 |
|
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
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
|
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
270 271 272 273 274 275 276 277 278 |
|
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
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
|
minutes_to_hexadecimal_seconds(minutes)
⚓︎
Encode minutes to an hexadecimal packed as little endian unsigned int.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
minutes |
int
|
minutes to encode. |
required |
Return
Hexadecimal representation of the minutes argument.
Source code in src/aioswitcher/device/tools.py
74 75 76 77 78 79 80 81 82 83 84 |
|
seconds_to_iso_time(all_seconds)
⚓︎
Convert seconds to iso time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
all_seconds |
int
|
the total number of seconds to convert. |
required |
Return
A string representing the converted iso time in %H:%M:%S format. e.g. "02:24:37".
Source code in src/aioswitcher/device/tools.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
set_message_length(message)
⚓︎
Set the message length.
Source code in src/aioswitcher/device/tools.py
143 144 145 146 |
|
sign_packet_with_crc_key(hex_packet)
⚓︎
Sign the packets with the designated crc key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hex_packet |
str
|
packet to sign. |
required |
Return
The calculated and signed packet.
Source code in src/aioswitcher/device/tools.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
string_to_hexadecimale_device_name(name)
⚓︎
Encode string device name to an appropriate hexadecimal value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
the desired name for encoding. |
required |
Return
Hexadecimal representation of the name argument.
Source code in src/aioswitcher/device/tools.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
timedelta_to_hexadecimal_seconds(full_time)
⚓︎
Encode timedelta as seconds to an hexadecimal packed as little endian unsigned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
full_time |
datetime.timedelta
|
timedelta time between 1 and 24 hours, seconds are ignored. |
required |
Return
Hexadecimal representation of the seconds built fom the full_time argument.
Source code in src/aioswitcher/device/tools.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
validate_token(username, token)
async
⚓︎
Make an asynchronous API call to validate a Token by username and token.
Source code in src/aioswitcher/device/tools.py
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 |
|
watts_to_amps(watts)
⚓︎
Convert power consumption to watts to electric current in amps.
Source code in src/aioswitcher/device/tools.py
138 139 140 |
|
Switcher integration schedule module.
Days
⚓︎
Bases: Enum
Enum class representing the day entity.
Source code in src/aioswitcher/schedule/__init__.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
bit_rep: int
property
⚓︎
Return the bit representation of the day.
hex_rep: int
property
⚓︎
Return the hexadecimal representation of the day.
weekday: int
property
⚓︎
Return the weekday of the day.
__new__(value, hex_rep, bit_rep, weekday)
⚓︎
Override the default enum constructor and include extra properties.
Source code in src/aioswitcher/schedule/__init__.py
40 41 42 43 44 45 46 47 |
|
ScheduleState
⚓︎
Bases: Enum
Enum representing the status of the schedule.
Source code in src/aioswitcher/schedule/__init__.py
20 21 22 23 24 25 |
|
Switcher integration schedule parser module.
ScheduleParser
dataclass
⚓︎
Schedule parsing tool.
Source code in src/aioswitcher/schedule/parser.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
get_days()
⚓︎
Retun a set of the scheduled Days.
Source code in src/aioswitcher/schedule/parser.py
82 83 84 85 86 87 88 |
|
get_end_time()
⚓︎
Return the schedule end time in %H:%M format.
Source code in src/aioswitcher/schedule/parser.py
101 102 103 |
|
get_id()
⚓︎
Return the id of the schedule.
Source code in src/aioswitcher/schedule/parser.py
70 71 72 |
|
get_start_time()
⚓︎
Return the schedule start time in %H:%M format.
Source code in src/aioswitcher/schedule/parser.py
97 98 99 |
|
get_state()
⚓︎
Return the current state of the device.
Not sure if this needs to be included in the schedule object.
Source code in src/aioswitcher/schedule/parser.py
90 91 92 93 94 95 |
|
is_enabled()
⚓︎
Return true if enbaled.
Source code in src/aioswitcher/schedule/parser.py
74 75 76 |
|
is_recurring()
⚓︎
Return true if a recurring schedule.
Source code in src/aioswitcher/schedule/parser.py
78 79 80 |
|
SwitcherSchedule
dataclass
⚓︎
representation of the Switcher schedule slot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id |
str
|
the id of the schedule |
required |
recurring |
bool
|
is a recurring schedule |
required |
days |
Set[Days]
|
a set of schedule days, or empty set for non recurring schedules |
required |
start_time |
str
|
the start time of the schedule |
required |
end_time |
str
|
the end time of the schedule |
required |
Source code in src/aioswitcher/schedule/parser.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
__eq__(obj)
⚓︎
For usage with set, implementation of the eq magic method.
Source code in src/aioswitcher/schedule/parser.py
56 57 58 59 60 |
|
__hash__()
⚓︎
For usage with set, implementation of the hash magic method.
Source code in src/aioswitcher/schedule/parser.py
52 53 54 |
|
__post_init__()
⚓︎
Post initialization, set duration and display.
Source code in src/aioswitcher/schedule/parser.py
47 48 49 50 |
|
get_schedules(message)
⚓︎
Use to create a list of schedule from a response message from the device.
Source code in src/aioswitcher/schedule/parser.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
Switcher integration schedule module tools.
bit_summary_to_days(sum_weekdays_bit)
⚓︎
Decode a weekdays bit summary to a set of weekdays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sum_weekdays_bit |
int
|
the sum of all weekdays |
required |
Return
Set of Weekday members decoded from the summary value.
Todo
Should an existing remainder in the sum value throw an error? E.g. 3 will result in a set of MONDAY and the remainder will be 1.
Source code in src/aioswitcher/schedule/tools.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
calc_duration(start_time, end_time)
⚓︎
Use to calculate the delta between two time values formated as %H:%M.
Source code in src/aioswitcher/schedule/tools.py
77 78 79 80 81 82 83 |
|
hexadecimale_timestamp_to_localtime(hex_timestamp)
⚓︎
Decode an hexadecimale timestamp to localtime with the format %H:%M.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hex_timestamp |
bytes
|
the hexadecimale timestamp. |
required |
Return
Localtime string with %H:%M format. e.g. "20:30".
Source code in src/aioswitcher/schedule/tools.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
pretty_next_run(start_time, days=set())
⚓︎
Create a literal for displaying the next run time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_time |
str
|
the start of the schedule in "%H:%M" format, e.g. "17:00". |
required |
days |
Set[Days]
|
for recurring schedules, a list of days when none, will be today. |
set()
|
Returns:
Type | Description |
---|---|
str
|
A pretty string describing the next due run. |
str
|
e.g. "Due next Sunday at 17:00". |
Source code in src/aioswitcher/schedule/tools.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
time_to_hexadecimal_timestamp(time_value)
⚓︎
Convert hours and minutes to a timestamp with the current date and encode.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time_value |
str
|
time to convert. e.g. "21:00". |
required |
Return
Hexadecimal representation of the timestamp.
Source code in src/aioswitcher/schedule/tools.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
weekdays_to_hexadecimal(days)
⚓︎
Sum the requested weekdays bit representation and return as hexadecimal value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
days |
Union[Days, Set[Days]]
|
the requested Weekday members. |
required |
Return
Hexadecimale representation of the sum of all requested days.
Source code in src/aioswitcher/schedule/tools.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|