simo 2.0.13__py3-none-any.whl → 2.0.14__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of simo might be problematic. Click here for more details.

Binary file
simo/fleet/forms.py CHANGED
@@ -196,18 +196,10 @@ class ColonelBinarySensorConfigForm(ColonelComponentForm):
196
196
  ]
197
197
  )
198
198
  )
199
- pull = forms.ChoiceField(
200
- choices=(
201
- ('HIGH', "HIGH"), ('LOW', "LOW"), ("FLOATING", "leave floating"),
202
- ),
203
- help_text="If you are not sure what is this all about, "
204
- "you are most definitely want to pull this HIGH or LOW "
205
- "but not leave it floating!"
206
- )
207
199
  inverse = forms.TypedChoiceField(
208
- choices=((1, "Yes"), (0, "No")), coerce=int,
209
- help_text="Hint: Set pull HIGH and inverse to Yes, to get ON signal when "
210
- "you deliver GND to the pin and OFF when you cut it out."
200
+ choices=((1, "Yes"), (0, "No")), coerce=int, initial=1,
201
+ help_text="Hint: Set inverse to Yes, to get ON signal when "
202
+ "you deliver GND to the input and OFF when you cut it out."
211
203
  )
212
204
  debounce = forms.IntegerField(
213
205
  min_value=0, max_value=1000 * 60 * 60, required=False, initial=0,
@@ -215,7 +207,6 @@ class ColonelBinarySensorConfigForm(ColonelComponentForm):
215
207
  "between ON/OFF states when engaged. <br>"
216
208
  "Set debounce value in milliseconds, to remediate this. "
217
209
  "100ms offers a good starting point!"
218
-
219
210
  )
220
211
 
221
212
  def clean(self):
@@ -508,17 +499,12 @@ class ColonelSwitchConfigForm(ColonelComponentForm):
508
499
  ]
509
500
  )
510
501
  )
511
- engaged_action = forms.ChoiceField(
512
- choices=(('HIGH', "HIGH"), ('LOW', "LOW")),
513
- )
514
502
  auto_off = forms.FloatField(
515
503
  required=False, min_value=0.01, max_value=1000000000,
516
504
  help_text="If provided, switch will be turned off after "
517
505
  "given amount of seconds after every turn on event."
518
506
  )
519
- inverse = forms.BooleanField(
520
- label=_("Inverse switch value"), required=False
521
- )
507
+ inverse = forms.BooleanField(required=False)
522
508
  slaves = forms.ModelMultipleChoiceField(
523
509
  required=False,
524
510
  queryset=Component.objects.filter(
@@ -681,14 +667,30 @@ class ColonelRGBLightConfigForm(ColonelComponentForm):
681
667
  num_leds = forms.IntegerField(
682
668
  label=_("Number of leds"), min_value=1, max_value=2000
683
669
  )
684
- timing = forms.TypedChoiceField(
685
- initial=1, coerce=int, choices=((1, "800kHz (most common)"), (0, "400kHz"),)
670
+ strip_type = forms.ChoiceField(
671
+ label="LED strip type",
672
+ choices=(
673
+ ("WS2811", "WS2811"),
674
+ ('WS2812', "WS2812"),
675
+ ('WS2812B', "WS2812B"),
676
+ ('WS2813', "WS2813"),
677
+ ('WS2815', "WS2815"),
678
+ ('SK6812', "SK6812"),
679
+ ('generic', "Generic"),
680
+ )
686
681
  )
687
- order = forms.ChoiceField(
688
- initial='RGB', choices=(
682
+ has_white = forms.BooleanField(initial=False, required=False)
683
+ color_order = forms.ChoiceField(
684
+ required=False, choices=(
685
+ (None, 'Default'),
689
686
  ("RGB", "RGB"), ("RBG", "RBG"), ("GRB", "GRB"),
690
687
  ("RGBW", "RGBW"), ("RBGW", "RBGW"), ("GRBW", "GRBW"),
691
- )
688
+ ),
689
+ )
690
+ custom_timing = forms.CharField(
691
+ required=False,
692
+ help_text="Custom addressable led strip timing (T0H, T0L, T1H, T1L). <br>"
693
+ "For example SK6812 is: (300, 900, 600, 600)"
692
694
  )
693
695
  controls = FormsetField(
694
696
  formset_factory(
@@ -698,12 +700,26 @@ class ColonelRGBLightConfigForm(ColonelComponentForm):
698
700
 
699
701
  def save(self, commit=True):
700
702
  self.instance.config['output_pin_no'] = self.cleaned_data['output_pin'].no
701
- if len(self.cleaned_data['order']) > 3:
702
- self.instance.config['has_white'] = True
703
- else:
704
- self.instance.config['has_white'] = False
705
703
  return super().save(commit)
706
704
 
705
+ def clean_custom_timing(self):
706
+ custom_timing = self.cleaned_data.get('custom_timing')
707
+ if not custom_timing:
708
+ return custom_timing
709
+ custom_timing = custom_timing.strip().\
710
+ strip('(').strip('[').rstrip(')').rstrip(']').split(',')
711
+ if len(custom_timing.split(',')) != 4:
712
+ raise forms.ValidationError("Tuple of 4 integers please.")
713
+ for t in custom_timing.split(','):
714
+ try:
715
+ t = int(t)
716
+ except:
717
+ raise forms.ValidationError(f"Integers only please.")
718
+ if t <= 0:
719
+ raise forms.ValidationError(f"Intervals must be greater than 0.")
720
+ if t > 100000:
721
+ raise forms.ValidationError(f"{t} seems way to much!")
722
+ return f"({custom_timing})"
707
723
 
708
724
  def clean(self):
709
725
  super().clean()
@@ -712,6 +728,20 @@ class ColonelRGBLightConfigForm(ColonelComponentForm):
712
728
  if not self.cleaned_data.get('output_pin'):
713
729
  return self.cleaned_data
714
730
 
731
+ if self.cleaned_data.get('color_order'):
732
+ if self.cleaned_data['has_white']:
733
+ if len(self.cleaned_data['color_order']) != 4:
734
+ self.add_error(
735
+ "color_order",
736
+ _("4 colors expected for stripes with dedicated White led.")
737
+ )
738
+ else:
739
+ if len(self.cleaned_data['color_order']) != 3:
740
+ self.add_error(
741
+ "color_order",
742
+ _("3 colors expected for stripes without dedicated White led.")
743
+ )
744
+
715
745
  self._clean_pin('output_pin')
716
746
 
717
747
  if not self.cleaned_data.get('controls'):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simo
3
- Version: 2.0.13
3
+ Version: 2.0.14
4
4
  Summary: Smart Home on Steroids!
5
5
  Author-email: Simanas Venčkauskas <simanas@simo.io>
6
6
  Project-URL: Homepage, https://simo.io
@@ -10169,7 +10169,7 @@ simo/fleet/auto_urls.py,sha256=X04oKJWA48wFW5iXg3PPROY2KDdHn_a99orQSE28QC4,518
10169
10169
  simo/fleet/base_types.py,sha256=wL9RVkHr0gA7HI1wZq0pruGEIgvQqpfnCL4cC3ywsvw,102
10170
10170
  simo/fleet/ble.py,sha256=eHA_9ABjbmH1vUVCv9hiPXQL2GZZSEVwfO0xyI1S0nI,1081
10171
10171
  simo/fleet/controllers.py,sha256=rTxRFf-LKWAZxzixrsLZHHm51BmMx9a1PLdgf6inlNM,20533
10172
- simo/fleet/forms.py,sha256=rLymJ2ovNgmwdKYJtxTfjuIm5Q4p3GLkIb7-Yo2DmS4,36375
10172
+ simo/fleet/forms.py,sha256=Ree_e3V0rBkVk1bVPr4aV8bsdo0pfCS8i5UV2OBtMJQ,37684
10173
10173
  simo/fleet/gateways.py,sha256=KV5i5fxXIrlK-k6zyEkk83x11GJt-ELQ0npb4Ac83cM,3693
10174
10174
  simo/fleet/managers.py,sha256=XOpDOA9L-f_550TNSyXnJbun2EmtGz1TenVTMlUSb8E,807
10175
10175
  simo/fleet/models.py,sha256=J-rnn7Ew-7s3646NNRVY947Sbz21mUD_nBHtuHAKXds,14160
@@ -10185,7 +10185,7 @@ simo/fleet/__pycache__/auto_urls.cpython-38.pyc,sha256=SqyTuaz_kEBvx-bL46SclsZEE
10185
10185
  simo/fleet/__pycache__/base_types.cpython-38.pyc,sha256=deyPwjpT6xZiFxBGFnj5b7R-lbdOTh2krgpJhrcGVhc,274
10186
10186
  simo/fleet/__pycache__/ble.cpython-38.pyc,sha256=Nrof9w7cm4OlpFWHeVnmvvanh2_oF9oQ3TknJiV93-0,1267
10187
10187
  simo/fleet/__pycache__/controllers.cpython-38.pyc,sha256=l9bz18Qp33C12TJOKPSn9vIXnlBKnBusODNk7Fg64qA,18103
10188
- simo/fleet/__pycache__/forms.cpython-38.pyc,sha256=-Sbb1kBxb246hV8A2ESlR4LVEISJNedVFiOK1IzRt6c,25954
10188
+ simo/fleet/__pycache__/forms.cpython-38.pyc,sha256=IvK-njOrKBAlvzSGsvPrKnsHwB1gcRrmWL8Nlkg_fF0,27050
10189
10189
  simo/fleet/__pycache__/gateways.cpython-38.pyc,sha256=YAcgTOqJbtjGI03lvEcU6keFfrwAHkObVmErYzfRvjk,3569
10190
10190
  simo/fleet/__pycache__/managers.cpython-38.pyc,sha256=8uz-xpUiqbGDgXIZ_XRZtFb-Tju6NGxflGg-Ee4Yo6k,1310
10191
10191
  simo/fleet/__pycache__/models.cpython-38.pyc,sha256=S9pPqRjIxASXahoIOkkjQX7cBwjkdu4d2nXMju0-Cf8,12283
@@ -10444,8 +10444,8 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
10444
10444
  simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10445
10445
  simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10446
10446
  simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10447
- simo-2.0.13.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10448
- simo-2.0.13.dist-info/METADATA,sha256=rwjjG5hKGMgEGunNKlhYByM46Kepk1OFgrYTcoQ5bcg,1700
10449
- simo-2.0.13.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
10450
- simo-2.0.13.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10451
- simo-2.0.13.dist-info/RECORD,,
10447
+ simo-2.0.14.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10448
+ simo-2.0.14.dist-info/METADATA,sha256=OG2N3Ch_c8-PXckNAykpPaxULK-HirD-InkoYjVk1ac,1700
10449
+ simo-2.0.14.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
10450
+ simo-2.0.14.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10451
+ simo-2.0.14.dist-info/RECORD,,
File without changes