1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
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
|
%global _empty_manifest_terminate_build 0
Name: python-motionblinds
Version: 0.6.17
Release: 1
Summary: Python library for interfacing with Motion Blinds
License: MIT
URL: https://github.com/starkillerOG/motion-blinds
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/78/1a/abd4896ecbdce29c3d42db0ec54eecb7b3ed936fa251df35c1ebf072b778/motionblinds-0.6.17.tar.gz
BuildArch: noarch
Requires: python3-pycryptodomex
%description
# motion-blinds
Python library for interfacing with Motion Blinds
This library allows you to control Motion Blinds from Coulisse B.V.
This library is primarly writen to be used with HomeAssistant but can also be used stand alone.
[](https://github.com/sponsors/starkillerOG)
For products see https://motion-blinds.com or https://coulisse.com/products/motion.
Shops that sell these blinds:
- [Hornbach](https://www.hornbach.nl/)
- [Smart Blinds](https://www.smartblinds.nl/)
## Other brands of blinds
This python library is primarly written for the Motion Blinds, but some other manufacturers use the same API and therefore this library also works with those brands.
The following brands have been reported to also work with this python library:
- [Motion Blinds](https://motionblinds.com/)
- [Smart Blinds](https://www.smartblinds.nl/)
- [Dooya](http://www.dooya.com/)
- [Brel Home](https://www.brel-home.nl/)
- [Bloc Blinds](https://www.blocblinds.com/)
- [AMP Motorization](https://www.ampmotorization.com/)
- [Bliss Automation - Alta Window Fashions](https://www.altawindowfashions.com/product/automation/bliss-automation/)
- [3 Day Blinds](https://www.3dayblinds.com/)
- [Diaz](https://www.diaz.be/en/)
- [Gaviota](https://www.gaviotagroup.com/en/)
- [Havana Shade](https://havanashade.com/)
- [Hurrican Shutters Wholesale](https://www.hurricaneshutterswholesale.com/)
- [Inspired Shades](https://www.inspired-shades.com/)
- [iSmartWindow](https://www.ismartwindow.co.nz/)
- [Martec](https://www.martec.co.nz/)
- [Raven Rock MFG](https://www.ravenrockmfg.com/)
- [ScreenAway](https://www.screenaway.com.au/)
- [Smart Home](https://www.smart-home.hu)
- [Uprise Smart Shades](http://uprisesmartshades.com)
## Installation
Use pip:
```$ pip install motionblinds```
or
```$ pip install --use-wheel motionblinds```
## Retrieving Key
The Motion Blinds API uses a 16 character key that can be retrieved from the official "Motion Blinds" app for [Ios](https://apps.apple.com/us/app/motion-blinds/id1437234324) or [Android](https://play.google.com/store/apps/details?id=com.coulisse.motion).
Open the app, click the 3 dots in the top right corner, go to "settings", go to "Motion APP About", Please quickly tap this "Motion APP About" page 5 times, a popup will apear that gives you the key.


Please note that "-" characters need to be included in the key when providing it to this library.
The key needs to be simular to "12ab345c-d67e-8f"
## Usage
For creation of a device you could use the following lines of codes (using a correct IP of the gateway and Key retrieved from the App)
```
from motionblinds import MotionGateway
m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
```
This library is not polling. Thus you need to populate the connected blinds using the GetDeviceList method and update device information using the Update method.
Note that multicast pushes from the gateway can be processed to retrieve instant status updates (see Multicast pushes section)
```
m.GetDeviceList()
m.Update()
```
Note that GetDeviceList needs to be run before using Update since the device_type, mac and token are retrieved using the GetDeviceList method.
Once the connected blinds are discoverd using the GetDeviceList method, they can be listed by the device_list property:
```
m.device_list
```
This will return a dict with as key the mac_adress of the blind and as value a MotionBlind device that can be used to retreive information of that blind and control that blind.
Some example code that will print the information of the gateway and all conected blinds:
```
>>> from motionblinds import MotionGateway
>>> m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
>>> m.GetDeviceList()
{'abcdefghujkl0001': <MotionBlind mac: abcdefghujkl0001, type: None, status: None, position: None %, angle: None, limit: None, battery: None, RSSI: None dBm>}
>>> m.Update()
>>> print(m)
<MotionGateway ip: 192.168.1.100, mac: abcdefghujkl, protocol: 0.9, N_devices: 1, status: Working, RSSI: -71 dBm>
>>> for blind in m.device_list.values():
>>> blind.Update()
>>> print(blind)
<MotionBlind mac: abcdefghujkl0001, type: RollerBlind, status: Stopped, position: 0 %, angle: 0, limit: Limits, battery: 1195, RSSI: -82 dBm>
```
To open a blind the following example code can be used:
```
>>> from motionblinds import MotionGateway
>>> m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
>>> m.GetDeviceList()
>>> m.Update()
>>> blind_1 = list(m.device_list.values())[0]
>>> blind_1.Update()
>>> blind_1.Open()
```
Instead of blind_1.Open() you can also use blind_1.Close(), blind_1.Stop(), blind_1.Set_position(50) or blind_1.Set_angle(90)
## Multicast pushes
This library allows to listen for multicast pushes from the gateway (in a parallel thread or using asyncio) and process these pushes to get instant updates of the gateway and connected blinds status.
To use this parallel pushes processing a MotionMulticast/AsyncMotionMulticast class object needs to be initilized.
The MotionMulticast.Start_listen()/AsyncMotionMulticast.Start_listen() and MotionMulticast.Stop_listen()/AsyncMotionMulticast.Stop_listen() can then be used to start and stop the parallel thread that is listening for incoming pushes.
The MotionMulticast/AsyncMotionMulticast class object can be supplied to the MotionGateway class to let it update that gateway and its connected blinds.
Externall callbacks can be registered for both gateway devices and blind devices (see tables below)
If UDP multicast messages are not coming through, try using the IP adress of the host running the code as the interface instead of "any".
### Parallel thread
An example code to listen for pushes for 30 seconds and print out gateway or blind information when a push comes in (when a blind finishes moving) using a parallel thread:
```
import time
from motionblinds import MotionMulticast, MotionGateway
def callback_func_gateway():
print(m)
def callback_func_blind():
for blind in m.device_list.values():
print(blind)
motion_multicast = MotionMulticast(interface = "any")
motion_multicast.Start_listen()
m = MotionGateway(ip="192.168.1.100", key="12ab345c-d67e-8f", multicast = motion_multicast)
m.GetDeviceList()
m.Update()
m.Register_callback("1", callback_func_gateway)
for blind in m.device_list.values():
blind.Register_callback("1", callback_func_blind)
time.sleep(30)
motion_multicast.Stop_listen()
```
### Asyncio
An example code to listen for pushes for 30 seconds and print out gateway or blind information when a push comes in (when a blind finishes moving) using asyncio:
```
import asyncio
from motionblinds import AsyncMotionMulticast, MotionGateway
async def asyncio_demo(loop):
def callback_func_gateway():
print(m)
def callback_func_blind():
for blind in m.device_list.values():
print(blind)
motion_multicast = AsyncMotionMulticast(interface = "any")
await motion_multicast.Start_listen()
m = MotionGateway(ip="192.168.1.100", key="12ab345c-d67e-8f", multicast = motion_multicast)
await loop.run_in_executor(None, m.GetDeviceList)
await loop.run_in_executor(None, m.Update)
m.Register_callback("1", callback_func_gateway)
for blind in m.device_list.values():
blind.Register_callback("1", callback_func_blind)
await asyncio.sleep(30)
motion_multicast.Stop_listen()
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio_demo(loop))
```
## Discovery
Motion Gateways can be discovered on your network using the MotionDiscovery class.
The following example will try to discover gateways for 10 seconds and then print a dict containg the gateways and their connected blinds that were discovered.
```
>>> from motionblinds import MotionDiscovery
>>> d = MotionDiscovery()
>>> motion_gateways = d.discover()
>>> print(motion_gateways)
{'192.168.1.100': {
'msgType': 'GetDeviceListAck',
'mac': 'abcdefghujkl',
'deviceType': '02000002',
'ProtocolVersion': '0.9',
'token': '12345A678B9CDEFG',
'data': [
{'mac': 'abcdefghujkl', 'deviceType': '02000002'},
{'mac': 'abcdefghujkl0001', 'deviceType': '10000000'},
{'mac': 'abcdefghujkl0002', 'deviceType': '10000000'}
]
}}
```
## Gateway device
A gateway device (that was asigned to variable 'm') has the following methods and properties:
| method | arguments | argument type | explanation |
| ------------------------------- | ------------ | ---------------- | ---------------------------------------------------------------------------------- |
| "m.GetDeviceList()" | - | - | Get the device list from the Motion Gateway and update the properties listed below |
| "m.Update()" | - | - | Get the status of the Motion Gateway and update the properties listed below |
| "m.Check_gateway_multicast()" | - | - | Check if multicast messages can be received with the configured multicast listener |
| "m.Register_callback("1", func) | id, callback | string, function | Register a external callback function for updates of the gateway |
| "m.Remove_callback("1") | id | string | Remove a external callback using its id |
| "m.Clear_callbacks() | - | - | Remove all external registered callbacks for updates of the gateway |
| property | value type | explanation |
| ---------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------- |
| "m.available" | boolean | Return if the gateway is available |
| "m.status" | string | Return gateway status: from GatewayStatus enum |
| "m.N_devices" | int | Return the number of connected child devices |
| "m.RSSI" | int | Return the Wi-Fi connection strength of the gateway in dBm |
| "m.token" | string | Return the Token |
| "m.access_token" | string | Return the AccessToken |
| "m.mac" | string | Return the mac address of the gateway |
| "m.device_type" | string | Return the device type of the gateway |
| "m.protocol" | string | Return the protocol version of the gateway |
| "m.firmware" | string | Return the firmware version of the gateway |
| "m.device_list" | dict | Return a dict containing all blinds connected to the gateway, The keys in the dict are the mac adresses of the blinds. |
## Blind device
A blind device (that was asigned to variable 'blind_1') has the following methods and properties, arguments between () are optional:
| method | arguments | argument type | explanation |
| ------------------------------------- | --------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| "blind_1.Update_from_cache()" | - | - | Get the status of the blind from the cache of the Motion Gateway, No 433MHz radio communication with the blind takes place |
| "blind_1.Update_trigger()" | - | - | Get the status of the blind from the cache of the Motion Gateway and request a 433MHz radio communication with the blind for a new status (not awaited) |
| "blind_1.Update()" | - | - | Get the status of the blind from the blind through the Motion Gateway (WiFi) using 433MHz radio communication between the gateway and the blind |
| "blind_1.Stop()" | - | - | Stop the motion of the blind |
| "blind_1.Open()" | - | - | Open the blind/move the blind up |
| "blind_1.Close()" | - | - | Close the blind/move the blind down |
| "blind_1.Set_position(50)" | postion, (angle), (restore_angle) | int (0-100), int (0-180), boolean | Set the position of the blind, optionaly set angle or restore current angle |
| "blind_1.Set_angle(90)" | angle | int (0-180) | Set the angle/rotation of the blind |
| "blind_1.Jog_up()" | - | - | Open the blind/move the blind one step up |
| "blind_1.Jog_down()" | - | - | Close the blind/move the blind one step down |
| "blind_1.Register_callback("1", func) | id, callback | string, function | Register a external callback function for updates of the blind |
| "blind_1.Remove_callback("1") | id | string | Remove a external callback using its id |
| "blind_1.Clear_callbacks() | - | - | Remove all external registered callbacks for updates of the blind |
| property | value type | explanation |
| ------------------------- | ---------- | ----------------------------------------------------------------------------------- |
| "blind_1.device_type" | string | Return the device type which is a 8 character number |
| "blind_1.blind_type" | string | Return the type of the blind from BlindType enum |
| "blind_1.type" | enum | Return the type of the blind as a BlindType enum |
| "blind_1.mac" | string | Return the mac address of the blind |
| "blind_1.available" | boolean | Return if the blind is available |
| "blind_1.status" | string | Return the current status of the blind from BlindStatus enum |
| "blind_1.limit_status" | string | Return the current status of the limit detection of the blind from LimitStatus enum |
| "blind_1.position" | int | Return the current position of the blind in % (0-100) |
| "blind_1.angle" | int | Return the current angle of the blind 0-180 |
| "blind_1.battery_voltage" | double | Return the current battery voltage of the blind in V |
| "blind_1.battery_level" | double | Return the current battery level of the blind in % |
| "blind_1.is_charging" | boolean | Return if the blind is currently charging its battery |
| "blind_1.RSSI" | int | Return the radio connection strength of the blind to the gateway in dBm |
| "blind_1.wireless_mode" | enum | Return the wireless mode of the blind as a WirelessMode enum |
| "blind_1.wireless_name" | string | Return the wireless mode of the blind from WirelessMode enum |
| "blind_1.voltage_mode" | enum | Return the voltage mode of the blind as a VoltageMode enum |
| "blind_1.voltage_name" | string | Return the voltage mode of the blind from VoltageMode enum |
## Top Down Bottom Up (TDBU) device
A TDBU blind device has two motors designated by "T" = Top and "B" = Bottom to control the two parts of the blind.
Both parts can be controlled together using "C" = Combined as the motor.
The TDBU device (that was asigned to variable 'blind_1') has the following methods and properties:
| method | arguments | argument type | explanation |
| --------------------------------------------------- | ---------------------- | ----------------------------------------- | --------------------------------------------------------------------------------------- |
| "blind_1.Update()" | - | - | Get the status of the blind from the Motion Gateway |
| "blind_1.Stop(motor = 'B')" | motor | 'B', 'T' or 'C' | Stop the motion of Bottom or Top motor of the blind |
| "blind_1.Open(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind up |
| "blind_1.Close(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind down |
| "blind_1.Set_position(50, motor = 'B', width = 20)" | position, motor, width | int (0-100), 'B', 'T' or 'C', int (0-100) | Set the position of the Bottom or Top motor of the blind, optionaly specify width |
| "blind_1.Set_scaled_position(50, motor = 'B')" | position, motor | int (0-100), 'B', 'T' or 'C' | Set the position of the motor of the blind within the alowed space in which it can move |
| "blind_1.Set_angle(90, motor = 'B')" | angle, motor | int (0-180), 'B', 'T' or 'C' | Set the angle/rotation of the Bottom or Top motor of the blind |
| "blind_1.Jog_up(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind one step up |
| "blind_1.Jog_down(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind one step down |
| "blind_1.Register_callback("1", func) | id, callback | string, function | Register a external callback function for updates of the blind |
| "blind_1.Remove_callback("1") | id | string | Remove a external callback using its id |
| "blind_1.Clear_callbacks() | - | - | Remove all external registered callbacks for updates of the blind |
| property | value type | explanation |
| ------------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| "blind_1.device_type" | string | Return the device type which is a 8 character number |
| "blind_1.blind_type" | string | Return the type of the blind from BlindType enum |
| "blind_1.type" | enum | Return the type of the blind as a BlindType enum |
| "blind_1.mac" | string | Return the mac address of the blind |
| "blind_1.available" | boolean | Return if the blind is available |
| "blind_1.status" | {"T": string, "B": string} | Return the current status of the blind from BlindStatus enum |
| "blind_1.limit_status" | {"T": string, "B": string} | Return the current status of the limit detection of the blind from LimitStatus enum |
| "blind_1.position" | {"T": int, "B": int, "C": double} | Return the current position of the blind in % (0-100) |
| "blind_1.scaled_position" | {"T": double, "B": double, "C": double} | Return the current position of the blind, scaled to the alowed space in which it can move, in % (0-100) |
| "blind_1.width" | int | Return the area that is covered by the blind in % (0-100) |
| "blind_1.angle" | {"T": int, "B": int} | Return the current angle of the blind 0-180 |
| "blind_1.battery_voltage" | {"T": double, "B": double} | Return the current battery voltage of the blind in V |
| "blind_1.battery_level" | {"T": double, "B": double} | Return the current battery level of the blind in % |
| "blind_1.is_charging" | boolean | Return if the blind is currently charging its battery |
| "blind_1.RSSI" | int | Return the radio connection strength of the blind to the gateway in dBm |
| "blind_1.wireless_mode" | enum | Return the wireless mode of the blind as a WirelessMode enum |
| "blind_1.wireless_name" | string | Return the wireless mode of the blind from WirelessMode enum |
| "blind_1.voltage_mode" | enum | Return the voltage mode of the blind as a VoltageMode enum |
| "blind_1.voltage_name" | string | Return the voltage mode of the blind from VoltageMode enum |
%package -n python3-motionblinds
Summary: Python library for interfacing with Motion Blinds
Provides: python-motionblinds
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-motionblinds
# motion-blinds
Python library for interfacing with Motion Blinds
This library allows you to control Motion Blinds from Coulisse B.V.
This library is primarly writen to be used with HomeAssistant but can also be used stand alone.
[](https://github.com/sponsors/starkillerOG)
For products see https://motion-blinds.com or https://coulisse.com/products/motion.
Shops that sell these blinds:
- [Hornbach](https://www.hornbach.nl/)
- [Smart Blinds](https://www.smartblinds.nl/)
## Other brands of blinds
This python library is primarly written for the Motion Blinds, but some other manufacturers use the same API and therefore this library also works with those brands.
The following brands have been reported to also work with this python library:
- [Motion Blinds](https://motionblinds.com/)
- [Smart Blinds](https://www.smartblinds.nl/)
- [Dooya](http://www.dooya.com/)
- [Brel Home](https://www.brel-home.nl/)
- [Bloc Blinds](https://www.blocblinds.com/)
- [AMP Motorization](https://www.ampmotorization.com/)
- [Bliss Automation - Alta Window Fashions](https://www.altawindowfashions.com/product/automation/bliss-automation/)
- [3 Day Blinds](https://www.3dayblinds.com/)
- [Diaz](https://www.diaz.be/en/)
- [Gaviota](https://www.gaviotagroup.com/en/)
- [Havana Shade](https://havanashade.com/)
- [Hurrican Shutters Wholesale](https://www.hurricaneshutterswholesale.com/)
- [Inspired Shades](https://www.inspired-shades.com/)
- [iSmartWindow](https://www.ismartwindow.co.nz/)
- [Martec](https://www.martec.co.nz/)
- [Raven Rock MFG](https://www.ravenrockmfg.com/)
- [ScreenAway](https://www.screenaway.com.au/)
- [Smart Home](https://www.smart-home.hu)
- [Uprise Smart Shades](http://uprisesmartshades.com)
## Installation
Use pip:
```$ pip install motionblinds```
or
```$ pip install --use-wheel motionblinds```
## Retrieving Key
The Motion Blinds API uses a 16 character key that can be retrieved from the official "Motion Blinds" app for [Ios](https://apps.apple.com/us/app/motion-blinds/id1437234324) or [Android](https://play.google.com/store/apps/details?id=com.coulisse.motion).
Open the app, click the 3 dots in the top right corner, go to "settings", go to "Motion APP About", Please quickly tap this "Motion APP About" page 5 times, a popup will apear that gives you the key.


Please note that "-" characters need to be included in the key when providing it to this library.
The key needs to be simular to "12ab345c-d67e-8f"
## Usage
For creation of a device you could use the following lines of codes (using a correct IP of the gateway and Key retrieved from the App)
```
from motionblinds import MotionGateway
m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
```
This library is not polling. Thus you need to populate the connected blinds using the GetDeviceList method and update device information using the Update method.
Note that multicast pushes from the gateway can be processed to retrieve instant status updates (see Multicast pushes section)
```
m.GetDeviceList()
m.Update()
```
Note that GetDeviceList needs to be run before using Update since the device_type, mac and token are retrieved using the GetDeviceList method.
Once the connected blinds are discoverd using the GetDeviceList method, they can be listed by the device_list property:
```
m.device_list
```
This will return a dict with as key the mac_adress of the blind and as value a MotionBlind device that can be used to retreive information of that blind and control that blind.
Some example code that will print the information of the gateway and all conected blinds:
```
>>> from motionblinds import MotionGateway
>>> m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
>>> m.GetDeviceList()
{'abcdefghujkl0001': <MotionBlind mac: abcdefghujkl0001, type: None, status: None, position: None %, angle: None, limit: None, battery: None, RSSI: None dBm>}
>>> m.Update()
>>> print(m)
<MotionGateway ip: 192.168.1.100, mac: abcdefghujkl, protocol: 0.9, N_devices: 1, status: Working, RSSI: -71 dBm>
>>> for blind in m.device_list.values():
>>> blind.Update()
>>> print(blind)
<MotionBlind mac: abcdefghujkl0001, type: RollerBlind, status: Stopped, position: 0 %, angle: 0, limit: Limits, battery: 1195, RSSI: -82 dBm>
```
To open a blind the following example code can be used:
```
>>> from motionblinds import MotionGateway
>>> m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
>>> m.GetDeviceList()
>>> m.Update()
>>> blind_1 = list(m.device_list.values())[0]
>>> blind_1.Update()
>>> blind_1.Open()
```
Instead of blind_1.Open() you can also use blind_1.Close(), blind_1.Stop(), blind_1.Set_position(50) or blind_1.Set_angle(90)
## Multicast pushes
This library allows to listen for multicast pushes from the gateway (in a parallel thread or using asyncio) and process these pushes to get instant updates of the gateway and connected blinds status.
To use this parallel pushes processing a MotionMulticast/AsyncMotionMulticast class object needs to be initilized.
The MotionMulticast.Start_listen()/AsyncMotionMulticast.Start_listen() and MotionMulticast.Stop_listen()/AsyncMotionMulticast.Stop_listen() can then be used to start and stop the parallel thread that is listening for incoming pushes.
The MotionMulticast/AsyncMotionMulticast class object can be supplied to the MotionGateway class to let it update that gateway and its connected blinds.
Externall callbacks can be registered for both gateway devices and blind devices (see tables below)
If UDP multicast messages are not coming through, try using the IP adress of the host running the code as the interface instead of "any".
### Parallel thread
An example code to listen for pushes for 30 seconds and print out gateway or blind information when a push comes in (when a blind finishes moving) using a parallel thread:
```
import time
from motionblinds import MotionMulticast, MotionGateway
def callback_func_gateway():
print(m)
def callback_func_blind():
for blind in m.device_list.values():
print(blind)
motion_multicast = MotionMulticast(interface = "any")
motion_multicast.Start_listen()
m = MotionGateway(ip="192.168.1.100", key="12ab345c-d67e-8f", multicast = motion_multicast)
m.GetDeviceList()
m.Update()
m.Register_callback("1", callback_func_gateway)
for blind in m.device_list.values():
blind.Register_callback("1", callback_func_blind)
time.sleep(30)
motion_multicast.Stop_listen()
```
### Asyncio
An example code to listen for pushes for 30 seconds and print out gateway or blind information when a push comes in (when a blind finishes moving) using asyncio:
```
import asyncio
from motionblinds import AsyncMotionMulticast, MotionGateway
async def asyncio_demo(loop):
def callback_func_gateway():
print(m)
def callback_func_blind():
for blind in m.device_list.values():
print(blind)
motion_multicast = AsyncMotionMulticast(interface = "any")
await motion_multicast.Start_listen()
m = MotionGateway(ip="192.168.1.100", key="12ab345c-d67e-8f", multicast = motion_multicast)
await loop.run_in_executor(None, m.GetDeviceList)
await loop.run_in_executor(None, m.Update)
m.Register_callback("1", callback_func_gateway)
for blind in m.device_list.values():
blind.Register_callback("1", callback_func_blind)
await asyncio.sleep(30)
motion_multicast.Stop_listen()
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio_demo(loop))
```
## Discovery
Motion Gateways can be discovered on your network using the MotionDiscovery class.
The following example will try to discover gateways for 10 seconds and then print a dict containg the gateways and their connected blinds that were discovered.
```
>>> from motionblinds import MotionDiscovery
>>> d = MotionDiscovery()
>>> motion_gateways = d.discover()
>>> print(motion_gateways)
{'192.168.1.100': {
'msgType': 'GetDeviceListAck',
'mac': 'abcdefghujkl',
'deviceType': '02000002',
'ProtocolVersion': '0.9',
'token': '12345A678B9CDEFG',
'data': [
{'mac': 'abcdefghujkl', 'deviceType': '02000002'},
{'mac': 'abcdefghujkl0001', 'deviceType': '10000000'},
{'mac': 'abcdefghujkl0002', 'deviceType': '10000000'}
]
}}
```
## Gateway device
A gateway device (that was asigned to variable 'm') has the following methods and properties:
| method | arguments | argument type | explanation |
| ------------------------------- | ------------ | ---------------- | ---------------------------------------------------------------------------------- |
| "m.GetDeviceList()" | - | - | Get the device list from the Motion Gateway and update the properties listed below |
| "m.Update()" | - | - | Get the status of the Motion Gateway and update the properties listed below |
| "m.Check_gateway_multicast()" | - | - | Check if multicast messages can be received with the configured multicast listener |
| "m.Register_callback("1", func) | id, callback | string, function | Register a external callback function for updates of the gateway |
| "m.Remove_callback("1") | id | string | Remove a external callback using its id |
| "m.Clear_callbacks() | - | - | Remove all external registered callbacks for updates of the gateway |
| property | value type | explanation |
| ---------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------- |
| "m.available" | boolean | Return if the gateway is available |
| "m.status" | string | Return gateway status: from GatewayStatus enum |
| "m.N_devices" | int | Return the number of connected child devices |
| "m.RSSI" | int | Return the Wi-Fi connection strength of the gateway in dBm |
| "m.token" | string | Return the Token |
| "m.access_token" | string | Return the AccessToken |
| "m.mac" | string | Return the mac address of the gateway |
| "m.device_type" | string | Return the device type of the gateway |
| "m.protocol" | string | Return the protocol version of the gateway |
| "m.firmware" | string | Return the firmware version of the gateway |
| "m.device_list" | dict | Return a dict containing all blinds connected to the gateway, The keys in the dict are the mac adresses of the blinds. |
## Blind device
A blind device (that was asigned to variable 'blind_1') has the following methods and properties, arguments between () are optional:
| method | arguments | argument type | explanation |
| ------------------------------------- | --------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| "blind_1.Update_from_cache()" | - | - | Get the status of the blind from the cache of the Motion Gateway, No 433MHz radio communication with the blind takes place |
| "blind_1.Update_trigger()" | - | - | Get the status of the blind from the cache of the Motion Gateway and request a 433MHz radio communication with the blind for a new status (not awaited) |
| "blind_1.Update()" | - | - | Get the status of the blind from the blind through the Motion Gateway (WiFi) using 433MHz radio communication between the gateway and the blind |
| "blind_1.Stop()" | - | - | Stop the motion of the blind |
| "blind_1.Open()" | - | - | Open the blind/move the blind up |
| "blind_1.Close()" | - | - | Close the blind/move the blind down |
| "blind_1.Set_position(50)" | postion, (angle), (restore_angle) | int (0-100), int (0-180), boolean | Set the position of the blind, optionaly set angle or restore current angle |
| "blind_1.Set_angle(90)" | angle | int (0-180) | Set the angle/rotation of the blind |
| "blind_1.Jog_up()" | - | - | Open the blind/move the blind one step up |
| "blind_1.Jog_down()" | - | - | Close the blind/move the blind one step down |
| "blind_1.Register_callback("1", func) | id, callback | string, function | Register a external callback function for updates of the blind |
| "blind_1.Remove_callback("1") | id | string | Remove a external callback using its id |
| "blind_1.Clear_callbacks() | - | - | Remove all external registered callbacks for updates of the blind |
| property | value type | explanation |
| ------------------------- | ---------- | ----------------------------------------------------------------------------------- |
| "blind_1.device_type" | string | Return the device type which is a 8 character number |
| "blind_1.blind_type" | string | Return the type of the blind from BlindType enum |
| "blind_1.type" | enum | Return the type of the blind as a BlindType enum |
| "blind_1.mac" | string | Return the mac address of the blind |
| "blind_1.available" | boolean | Return if the blind is available |
| "blind_1.status" | string | Return the current status of the blind from BlindStatus enum |
| "blind_1.limit_status" | string | Return the current status of the limit detection of the blind from LimitStatus enum |
| "blind_1.position" | int | Return the current position of the blind in % (0-100) |
| "blind_1.angle" | int | Return the current angle of the blind 0-180 |
| "blind_1.battery_voltage" | double | Return the current battery voltage of the blind in V |
| "blind_1.battery_level" | double | Return the current battery level of the blind in % |
| "blind_1.is_charging" | boolean | Return if the blind is currently charging its battery |
| "blind_1.RSSI" | int | Return the radio connection strength of the blind to the gateway in dBm |
| "blind_1.wireless_mode" | enum | Return the wireless mode of the blind as a WirelessMode enum |
| "blind_1.wireless_name" | string | Return the wireless mode of the blind from WirelessMode enum |
| "blind_1.voltage_mode" | enum | Return the voltage mode of the blind as a VoltageMode enum |
| "blind_1.voltage_name" | string | Return the voltage mode of the blind from VoltageMode enum |
## Top Down Bottom Up (TDBU) device
A TDBU blind device has two motors designated by "T" = Top and "B" = Bottom to control the two parts of the blind.
Both parts can be controlled together using "C" = Combined as the motor.
The TDBU device (that was asigned to variable 'blind_1') has the following methods and properties:
| method | arguments | argument type | explanation |
| --------------------------------------------------- | ---------------------- | ----------------------------------------- | --------------------------------------------------------------------------------------- |
| "blind_1.Update()" | - | - | Get the status of the blind from the Motion Gateway |
| "blind_1.Stop(motor = 'B')" | motor | 'B', 'T' or 'C' | Stop the motion of Bottom or Top motor of the blind |
| "blind_1.Open(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind up |
| "blind_1.Close(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind down |
| "blind_1.Set_position(50, motor = 'B', width = 20)" | position, motor, width | int (0-100), 'B', 'T' or 'C', int (0-100) | Set the position of the Bottom or Top motor of the blind, optionaly specify width |
| "blind_1.Set_scaled_position(50, motor = 'B')" | position, motor | int (0-100), 'B', 'T' or 'C' | Set the position of the motor of the blind within the alowed space in which it can move |
| "blind_1.Set_angle(90, motor = 'B')" | angle, motor | int (0-180), 'B', 'T' or 'C' | Set the angle/rotation of the Bottom or Top motor of the blind |
| "blind_1.Jog_up(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind one step up |
| "blind_1.Jog_down(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind one step down |
| "blind_1.Register_callback("1", func) | id, callback | string, function | Register a external callback function for updates of the blind |
| "blind_1.Remove_callback("1") | id | string | Remove a external callback using its id |
| "blind_1.Clear_callbacks() | - | - | Remove all external registered callbacks for updates of the blind |
| property | value type | explanation |
| ------------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| "blind_1.device_type" | string | Return the device type which is a 8 character number |
| "blind_1.blind_type" | string | Return the type of the blind from BlindType enum |
| "blind_1.type" | enum | Return the type of the blind as a BlindType enum |
| "blind_1.mac" | string | Return the mac address of the blind |
| "blind_1.available" | boolean | Return if the blind is available |
| "blind_1.status" | {"T": string, "B": string} | Return the current status of the blind from BlindStatus enum |
| "blind_1.limit_status" | {"T": string, "B": string} | Return the current status of the limit detection of the blind from LimitStatus enum |
| "blind_1.position" | {"T": int, "B": int, "C": double} | Return the current position of the blind in % (0-100) |
| "blind_1.scaled_position" | {"T": double, "B": double, "C": double} | Return the current position of the blind, scaled to the alowed space in which it can move, in % (0-100) |
| "blind_1.width" | int | Return the area that is covered by the blind in % (0-100) |
| "blind_1.angle" | {"T": int, "B": int} | Return the current angle of the blind 0-180 |
| "blind_1.battery_voltage" | {"T": double, "B": double} | Return the current battery voltage of the blind in V |
| "blind_1.battery_level" | {"T": double, "B": double} | Return the current battery level of the blind in % |
| "blind_1.is_charging" | boolean | Return if the blind is currently charging its battery |
| "blind_1.RSSI" | int | Return the radio connection strength of the blind to the gateway in dBm |
| "blind_1.wireless_mode" | enum | Return the wireless mode of the blind as a WirelessMode enum |
| "blind_1.wireless_name" | string | Return the wireless mode of the blind from WirelessMode enum |
| "blind_1.voltage_mode" | enum | Return the voltage mode of the blind as a VoltageMode enum |
| "blind_1.voltage_name" | string | Return the voltage mode of the blind from VoltageMode enum |
%package help
Summary: Development documents and examples for motionblinds
Provides: python3-motionblinds-doc
%description help
# motion-blinds
Python library for interfacing with Motion Blinds
This library allows you to control Motion Blinds from Coulisse B.V.
This library is primarly writen to be used with HomeAssistant but can also be used stand alone.
[](https://github.com/sponsors/starkillerOG)
For products see https://motion-blinds.com or https://coulisse.com/products/motion.
Shops that sell these blinds:
- [Hornbach](https://www.hornbach.nl/)
- [Smart Blinds](https://www.smartblinds.nl/)
## Other brands of blinds
This python library is primarly written for the Motion Blinds, but some other manufacturers use the same API and therefore this library also works with those brands.
The following brands have been reported to also work with this python library:
- [Motion Blinds](https://motionblinds.com/)
- [Smart Blinds](https://www.smartblinds.nl/)
- [Dooya](http://www.dooya.com/)
- [Brel Home](https://www.brel-home.nl/)
- [Bloc Blinds](https://www.blocblinds.com/)
- [AMP Motorization](https://www.ampmotorization.com/)
- [Bliss Automation - Alta Window Fashions](https://www.altawindowfashions.com/product/automation/bliss-automation/)
- [3 Day Blinds](https://www.3dayblinds.com/)
- [Diaz](https://www.diaz.be/en/)
- [Gaviota](https://www.gaviotagroup.com/en/)
- [Havana Shade](https://havanashade.com/)
- [Hurrican Shutters Wholesale](https://www.hurricaneshutterswholesale.com/)
- [Inspired Shades](https://www.inspired-shades.com/)
- [iSmartWindow](https://www.ismartwindow.co.nz/)
- [Martec](https://www.martec.co.nz/)
- [Raven Rock MFG](https://www.ravenrockmfg.com/)
- [ScreenAway](https://www.screenaway.com.au/)
- [Smart Home](https://www.smart-home.hu)
- [Uprise Smart Shades](http://uprisesmartshades.com)
## Installation
Use pip:
```$ pip install motionblinds```
or
```$ pip install --use-wheel motionblinds```
## Retrieving Key
The Motion Blinds API uses a 16 character key that can be retrieved from the official "Motion Blinds" app for [Ios](https://apps.apple.com/us/app/motion-blinds/id1437234324) or [Android](https://play.google.com/store/apps/details?id=com.coulisse.motion).
Open the app, click the 3 dots in the top right corner, go to "settings", go to "Motion APP About", Please quickly tap this "Motion APP About" page 5 times, a popup will apear that gives you the key.


Please note that "-" characters need to be included in the key when providing it to this library.
The key needs to be simular to "12ab345c-d67e-8f"
## Usage
For creation of a device you could use the following lines of codes (using a correct IP of the gateway and Key retrieved from the App)
```
from motionblinds import MotionGateway
m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
```
This library is not polling. Thus you need to populate the connected blinds using the GetDeviceList method and update device information using the Update method.
Note that multicast pushes from the gateway can be processed to retrieve instant status updates (see Multicast pushes section)
```
m.GetDeviceList()
m.Update()
```
Note that GetDeviceList needs to be run before using Update since the device_type, mac and token are retrieved using the GetDeviceList method.
Once the connected blinds are discoverd using the GetDeviceList method, they can be listed by the device_list property:
```
m.device_list
```
This will return a dict with as key the mac_adress of the blind and as value a MotionBlind device that can be used to retreive information of that blind and control that blind.
Some example code that will print the information of the gateway and all conected blinds:
```
>>> from motionblinds import MotionGateway
>>> m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
>>> m.GetDeviceList()
{'abcdefghujkl0001': <MotionBlind mac: abcdefghujkl0001, type: None, status: None, position: None %, angle: None, limit: None, battery: None, RSSI: None dBm>}
>>> m.Update()
>>> print(m)
<MotionGateway ip: 192.168.1.100, mac: abcdefghujkl, protocol: 0.9, N_devices: 1, status: Working, RSSI: -71 dBm>
>>> for blind in m.device_list.values():
>>> blind.Update()
>>> print(blind)
<MotionBlind mac: abcdefghujkl0001, type: RollerBlind, status: Stopped, position: 0 %, angle: 0, limit: Limits, battery: 1195, RSSI: -82 dBm>
```
To open a blind the following example code can be used:
```
>>> from motionblinds import MotionGateway
>>> m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
>>> m.GetDeviceList()
>>> m.Update()
>>> blind_1 = list(m.device_list.values())[0]
>>> blind_1.Update()
>>> blind_1.Open()
```
Instead of blind_1.Open() you can also use blind_1.Close(), blind_1.Stop(), blind_1.Set_position(50) or blind_1.Set_angle(90)
## Multicast pushes
This library allows to listen for multicast pushes from the gateway (in a parallel thread or using asyncio) and process these pushes to get instant updates of the gateway and connected blinds status.
To use this parallel pushes processing a MotionMulticast/AsyncMotionMulticast class object needs to be initilized.
The MotionMulticast.Start_listen()/AsyncMotionMulticast.Start_listen() and MotionMulticast.Stop_listen()/AsyncMotionMulticast.Stop_listen() can then be used to start and stop the parallel thread that is listening for incoming pushes.
The MotionMulticast/AsyncMotionMulticast class object can be supplied to the MotionGateway class to let it update that gateway and its connected blinds.
Externall callbacks can be registered for both gateway devices and blind devices (see tables below)
If UDP multicast messages are not coming through, try using the IP adress of the host running the code as the interface instead of "any".
### Parallel thread
An example code to listen for pushes for 30 seconds and print out gateway or blind information when a push comes in (when a blind finishes moving) using a parallel thread:
```
import time
from motionblinds import MotionMulticast, MotionGateway
def callback_func_gateway():
print(m)
def callback_func_blind():
for blind in m.device_list.values():
print(blind)
motion_multicast = MotionMulticast(interface = "any")
motion_multicast.Start_listen()
m = MotionGateway(ip="192.168.1.100", key="12ab345c-d67e-8f", multicast = motion_multicast)
m.GetDeviceList()
m.Update()
m.Register_callback("1", callback_func_gateway)
for blind in m.device_list.values():
blind.Register_callback("1", callback_func_blind)
time.sleep(30)
motion_multicast.Stop_listen()
```
### Asyncio
An example code to listen for pushes for 30 seconds and print out gateway or blind information when a push comes in (when a blind finishes moving) using asyncio:
```
import asyncio
from motionblinds import AsyncMotionMulticast, MotionGateway
async def asyncio_demo(loop):
def callback_func_gateway():
print(m)
def callback_func_blind():
for blind in m.device_list.values():
print(blind)
motion_multicast = AsyncMotionMulticast(interface = "any")
await motion_multicast.Start_listen()
m = MotionGateway(ip="192.168.1.100", key="12ab345c-d67e-8f", multicast = motion_multicast)
await loop.run_in_executor(None, m.GetDeviceList)
await loop.run_in_executor(None, m.Update)
m.Register_callback("1", callback_func_gateway)
for blind in m.device_list.values():
blind.Register_callback("1", callback_func_blind)
await asyncio.sleep(30)
motion_multicast.Stop_listen()
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio_demo(loop))
```
## Discovery
Motion Gateways can be discovered on your network using the MotionDiscovery class.
The following example will try to discover gateways for 10 seconds and then print a dict containg the gateways and their connected blinds that were discovered.
```
>>> from motionblinds import MotionDiscovery
>>> d = MotionDiscovery()
>>> motion_gateways = d.discover()
>>> print(motion_gateways)
{'192.168.1.100': {
'msgType': 'GetDeviceListAck',
'mac': 'abcdefghujkl',
'deviceType': '02000002',
'ProtocolVersion': '0.9',
'token': '12345A678B9CDEFG',
'data': [
{'mac': 'abcdefghujkl', 'deviceType': '02000002'},
{'mac': 'abcdefghujkl0001', 'deviceType': '10000000'},
{'mac': 'abcdefghujkl0002', 'deviceType': '10000000'}
]
}}
```
## Gateway device
A gateway device (that was asigned to variable 'm') has the following methods and properties:
| method | arguments | argument type | explanation |
| ------------------------------- | ------------ | ---------------- | ---------------------------------------------------------------------------------- |
| "m.GetDeviceList()" | - | - | Get the device list from the Motion Gateway and update the properties listed below |
| "m.Update()" | - | - | Get the status of the Motion Gateway and update the properties listed below |
| "m.Check_gateway_multicast()" | - | - | Check if multicast messages can be received with the configured multicast listener |
| "m.Register_callback("1", func) | id, callback | string, function | Register a external callback function for updates of the gateway |
| "m.Remove_callback("1") | id | string | Remove a external callback using its id |
| "m.Clear_callbacks() | - | - | Remove all external registered callbacks for updates of the gateway |
| property | value type | explanation |
| ---------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------- |
| "m.available" | boolean | Return if the gateway is available |
| "m.status" | string | Return gateway status: from GatewayStatus enum |
| "m.N_devices" | int | Return the number of connected child devices |
| "m.RSSI" | int | Return the Wi-Fi connection strength of the gateway in dBm |
| "m.token" | string | Return the Token |
| "m.access_token" | string | Return the AccessToken |
| "m.mac" | string | Return the mac address of the gateway |
| "m.device_type" | string | Return the device type of the gateway |
| "m.protocol" | string | Return the protocol version of the gateway |
| "m.firmware" | string | Return the firmware version of the gateway |
| "m.device_list" | dict | Return a dict containing all blinds connected to the gateway, The keys in the dict are the mac adresses of the blinds. |
## Blind device
A blind device (that was asigned to variable 'blind_1') has the following methods and properties, arguments between () are optional:
| method | arguments | argument type | explanation |
| ------------------------------------- | --------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| "blind_1.Update_from_cache()" | - | - | Get the status of the blind from the cache of the Motion Gateway, No 433MHz radio communication with the blind takes place |
| "blind_1.Update_trigger()" | - | - | Get the status of the blind from the cache of the Motion Gateway and request a 433MHz radio communication with the blind for a new status (not awaited) |
| "blind_1.Update()" | - | - | Get the status of the blind from the blind through the Motion Gateway (WiFi) using 433MHz radio communication between the gateway and the blind |
| "blind_1.Stop()" | - | - | Stop the motion of the blind |
| "blind_1.Open()" | - | - | Open the blind/move the blind up |
| "blind_1.Close()" | - | - | Close the blind/move the blind down |
| "blind_1.Set_position(50)" | postion, (angle), (restore_angle) | int (0-100), int (0-180), boolean | Set the position of the blind, optionaly set angle or restore current angle |
| "blind_1.Set_angle(90)" | angle | int (0-180) | Set the angle/rotation of the blind |
| "blind_1.Jog_up()" | - | - | Open the blind/move the blind one step up |
| "blind_1.Jog_down()" | - | - | Close the blind/move the blind one step down |
| "blind_1.Register_callback("1", func) | id, callback | string, function | Register a external callback function for updates of the blind |
| "blind_1.Remove_callback("1") | id | string | Remove a external callback using its id |
| "blind_1.Clear_callbacks() | - | - | Remove all external registered callbacks for updates of the blind |
| property | value type | explanation |
| ------------------------- | ---------- | ----------------------------------------------------------------------------------- |
| "blind_1.device_type" | string | Return the device type which is a 8 character number |
| "blind_1.blind_type" | string | Return the type of the blind from BlindType enum |
| "blind_1.type" | enum | Return the type of the blind as a BlindType enum |
| "blind_1.mac" | string | Return the mac address of the blind |
| "blind_1.available" | boolean | Return if the blind is available |
| "blind_1.status" | string | Return the current status of the blind from BlindStatus enum |
| "blind_1.limit_status" | string | Return the current status of the limit detection of the blind from LimitStatus enum |
| "blind_1.position" | int | Return the current position of the blind in % (0-100) |
| "blind_1.angle" | int | Return the current angle of the blind 0-180 |
| "blind_1.battery_voltage" | double | Return the current battery voltage of the blind in V |
| "blind_1.battery_level" | double | Return the current battery level of the blind in % |
| "blind_1.is_charging" | boolean | Return if the blind is currently charging its battery |
| "blind_1.RSSI" | int | Return the radio connection strength of the blind to the gateway in dBm |
| "blind_1.wireless_mode" | enum | Return the wireless mode of the blind as a WirelessMode enum |
| "blind_1.wireless_name" | string | Return the wireless mode of the blind from WirelessMode enum |
| "blind_1.voltage_mode" | enum | Return the voltage mode of the blind as a VoltageMode enum |
| "blind_1.voltage_name" | string | Return the voltage mode of the blind from VoltageMode enum |
## Top Down Bottom Up (TDBU) device
A TDBU blind device has two motors designated by "T" = Top and "B" = Bottom to control the two parts of the blind.
Both parts can be controlled together using "C" = Combined as the motor.
The TDBU device (that was asigned to variable 'blind_1') has the following methods and properties:
| method | arguments | argument type | explanation |
| --------------------------------------------------- | ---------------------- | ----------------------------------------- | --------------------------------------------------------------------------------------- |
| "blind_1.Update()" | - | - | Get the status of the blind from the Motion Gateway |
| "blind_1.Stop(motor = 'B')" | motor | 'B', 'T' or 'C' | Stop the motion of Bottom or Top motor of the blind |
| "blind_1.Open(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind up |
| "blind_1.Close(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind down |
| "blind_1.Set_position(50, motor = 'B', width = 20)" | position, motor, width | int (0-100), 'B', 'T' or 'C', int (0-100) | Set the position of the Bottom or Top motor of the blind, optionaly specify width |
| "blind_1.Set_scaled_position(50, motor = 'B')" | position, motor | int (0-100), 'B', 'T' or 'C' | Set the position of the motor of the blind within the alowed space in which it can move |
| "blind_1.Set_angle(90, motor = 'B')" | angle, motor | int (0-180), 'B', 'T' or 'C' | Set the angle/rotation of the Bottom or Top motor of the blind |
| "blind_1.Jog_up(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind one step up |
| "blind_1.Jog_down(motor = 'B')" | motor | 'B', 'T' or 'C' | Move the Bottom or Top motor of the blind one step down |
| "blind_1.Register_callback("1", func) | id, callback | string, function | Register a external callback function for updates of the blind |
| "blind_1.Remove_callback("1") | id | string | Remove a external callback using its id |
| "blind_1.Clear_callbacks() | - | - | Remove all external registered callbacks for updates of the blind |
| property | value type | explanation |
| ------------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| "blind_1.device_type" | string | Return the device type which is a 8 character number |
| "blind_1.blind_type" | string | Return the type of the blind from BlindType enum |
| "blind_1.type" | enum | Return the type of the blind as a BlindType enum |
| "blind_1.mac" | string | Return the mac address of the blind |
| "blind_1.available" | boolean | Return if the blind is available |
| "blind_1.status" | {"T": string, "B": string} | Return the current status of the blind from BlindStatus enum |
| "blind_1.limit_status" | {"T": string, "B": string} | Return the current status of the limit detection of the blind from LimitStatus enum |
| "blind_1.position" | {"T": int, "B": int, "C": double} | Return the current position of the blind in % (0-100) |
| "blind_1.scaled_position" | {"T": double, "B": double, "C": double} | Return the current position of the blind, scaled to the alowed space in which it can move, in % (0-100) |
| "blind_1.width" | int | Return the area that is covered by the blind in % (0-100) |
| "blind_1.angle" | {"T": int, "B": int} | Return the current angle of the blind 0-180 |
| "blind_1.battery_voltage" | {"T": double, "B": double} | Return the current battery voltage of the blind in V |
| "blind_1.battery_level" | {"T": double, "B": double} | Return the current battery level of the blind in % |
| "blind_1.is_charging" | boolean | Return if the blind is currently charging its battery |
| "blind_1.RSSI" | int | Return the radio connection strength of the blind to the gateway in dBm |
| "blind_1.wireless_mode" | enum | Return the wireless mode of the blind as a WirelessMode enum |
| "blind_1.wireless_name" | string | Return the wireless mode of the blind from WirelessMode enum |
| "blind_1.voltage_mode" | enum | Return the voltage mode of the blind as a VoltageMode enum |
| "blind_1.voltage_name" | string | Return the voltage mode of the blind from VoltageMode enum |
%prep
%autosetup -n motionblinds-0.6.17
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-motionblinds -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.6.17-1
- Package Spec generated
|