simo 2.5.33__py3-none-any.whl → 2.5.34__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.

simo/core/forms.py CHANGED
@@ -403,7 +403,8 @@ class NumericSensorForm(BaseComponentForm):
403
403
 
404
404
  def __init__(self, *args, **kwargs):
405
405
  super().__init__(*args, **kwargs)
406
- self.fields['value_units'].initial = self.controller.default_value_units
406
+ if 'value_units' in self.fields:
407
+ self.fields['value_units'].initial = self.controller.default_value_units
407
408
 
408
409
 
409
410
 
Binary file
simo/fleet/forms.py CHANGED
@@ -1267,23 +1267,38 @@ class BlindsConfigForm(ColonelComponentForm):
1267
1267
 
1268
1268
 
1269
1269
  class GateConfigForm(ColonelComponentForm):
1270
- control_pin = Select2ModelChoiceField(
1271
- label="Control Relay Port",
1270
+ open_pin = Select2ModelChoiceField(
1271
+ label="Open Relay Port",
1272
1272
  queryset=ColonelPin.objects.filter(output=True),
1273
1273
  url='autocomplete-colonel-pins',
1274
1274
  forward=[
1275
1275
  forward.Self(),
1276
1276
  forward.Field('colonel'),
1277
1277
  forward.Const({'output': True}, 'filters')
1278
- ]
1278
+ ], help_text="If your gate is controlled by single input, "
1279
+ "using this port is enough."
1279
1280
  )
1280
1281
  open_action = forms.ChoiceField(
1281
- choices=(('HIGH', "HIGH"), ('LOW', "LOW")), initial='HIGH'
1282
+ choices=(('HIGH', "HIGH"), ('LOW', "LOW")),
1283
+ )
1284
+ close_pin = Select2ModelChoiceField(
1285
+ label="Close Relay Port",
1286
+ queryset=ColonelPin.objects.filter(output=True),
1287
+ url='autocomplete-colonel-pins',
1288
+ forward=[
1289
+ forward.Self(),
1290
+ forward.Field('colonel'),
1291
+ forward.Const({'output': True}, 'filters')
1292
+ ], required=False
1293
+ )
1294
+ close_action = forms.ChoiceField(
1295
+ choices=(('HIGH', "HIGH"), ('LOW', "LOW")),
1282
1296
  )
1283
1297
  control_method = forms.ChoiceField(
1284
1298
  choices=(('pulse', "Pulse"), ('hold', "Hold")), initial="pulse",
1285
- help_text="What your gate motor expects to receive as control command?"
1299
+ help_text="What your gate motors expect to receive as control command?"
1286
1300
  )
1301
+
1287
1302
  sensor_pin = Select2ModelChoiceField(
1288
1303
  label='Gate open/closed sensor port',
1289
1304
  queryset=ColonelPin.objects.filter(input=True),
@@ -1292,7 +1307,7 @@ class GateConfigForm(ColonelComponentForm):
1292
1307
  forward.Self(),
1293
1308
  forward.Field('colonel'),
1294
1309
  forward.Const({'input': True}, 'filters')
1295
- ]
1310
+ ], required=False,
1296
1311
  )
1297
1312
  closed_value = forms.ChoiceField(
1298
1313
  label='Gate closed value',
@@ -1300,6 +1315,8 @@ class GateConfigForm(ColonelComponentForm):
1300
1315
  help_text="What is the input sensor value, "
1301
1316
  "when your gate is in closed position?"
1302
1317
  )
1318
+
1319
+
1303
1320
  open_duration = forms.FloatField(
1304
1321
  initial=30, min_value=1, max_value=600,
1305
1322
  help_text="How much time in seconds does it take for your gate "
@@ -1315,15 +1332,24 @@ class GateConfigForm(ColonelComponentForm):
1315
1332
  def clean(self):
1316
1333
  super().clean()
1317
1334
 
1318
- if self.cleaned_data.get('control_pin') \
1319
- and self.cleaned_data.get('sensor_pin') \
1320
- and self.cleaned_data['control_pin'] == self.cleaned_data['sensor_pin']:
1321
- self.add_error(
1322
- 'sensor_pin', "Can't be the same as control port!"
1323
- )
1335
+ check_pins = ('open_pin', 'close_pin', 'sensor_pin')
1336
+ for pin in check_pins:
1337
+ if not self.cleaned_data.get(pin):
1338
+ continue
1339
+ for p in check_pins:
1340
+ if pin == pin:
1341
+ continue
1342
+ if not self.cleaned_data.get(p):
1343
+ continue
1344
+ if self.cleaned_data[pin] == self.cleaned_data[p]:
1345
+ self.add_error(
1346
+ pin, f"Can't be the same {p}!"
1347
+ )
1324
1348
 
1325
- if self.cleaned_data.get('control_pin'):
1326
- self._clean_pin('control_pin')
1349
+ if self.cleaned_data.get('open_pin'):
1350
+ self._clean_pin('open_pin')
1351
+ if self.cleaned_data.get('close_pin'):
1352
+ self._clean_pin('close_pin')
1327
1353
  if self.cleaned_data.get('sensor_pin'):
1328
1354
  self._clean_pin('sensor_pin')
1329
1355
 
@@ -1353,10 +1379,13 @@ class GateConfigForm(ColonelComponentForm):
1353
1379
  return self.cleaned_data
1354
1380
 
1355
1381
  def save(self, commit=True):
1356
- if 'control_pin' in self.cleaned_data:
1357
- self.instance.config['control_pin_no'] = \
1358
- self.cleaned_data['control_pin'].no
1359
- if 'sensor_pin' in self.cleaned_data:
1382
+ if self.cleaned_data.get('open_pin'):
1383
+ self.instance.config['open_pin_no'] = \
1384
+ self.cleaned_data['open_pin'].no
1385
+ if self.cleaned_data.get('close_pin'):
1386
+ self.instance.config['close_pin_no'] = \
1387
+ self.cleaned_data['close_pin'].no
1388
+ if self.cleaned_data.get('sensor_pin'):
1360
1389
  self.instance.config['sensor_pin_no'] = \
1361
1390
  self.cleaned_data['sensor_pin'].no
1362
1391
  obj = super().save(commit=commit)
@@ -0,0 +1,30 @@
1
+ # Generated by Django 4.2.10 on 2024-11-20 10:28
2
+
3
+ from django.db import migrations
4
+
5
+
6
+ def forwards_func(apps, schema_editor):
7
+ Component = apps.get_model("core", "Component")
8
+
9
+ for gate in Component.objects.filter(
10
+ controller_uid='simo.fleet.controllers.Gate'
11
+ ):
12
+ gate.config['open_pin_no'] = gate.config.get('control_pin_no')
13
+ gate.config['open_pin'] = gate.config.get('control_pin')
14
+ gate.save()
15
+
16
+
17
+ def reverse_func(apps, schema_editor):
18
+ pass
19
+
20
+
21
+
22
+ class Migration(migrations.Migration):
23
+
24
+ dependencies = [
25
+ ('fleet', '0041_alter_colonel_instance_and_more'),
26
+ ]
27
+
28
+ operations = [
29
+ migrations.RunPython(forwards_func, reverse_func, elidable=True),
30
+ ]
Binary file
simo/users/api.py CHANGED
@@ -196,17 +196,21 @@ class UserDeviceReport(InstanceMixin, viewsets.GenericViewSet):
196
196
  if request.META.get('HTTP_HOST', '').endswith('.simo.io'):
197
197
  relay = request.META.get('HTTP_HOST')
198
198
 
199
- speed_kmh = request.data.get('speed', 0) * 3.6
199
+ try:
200
+ speed_kmh = request.data.get('speed', 0) * 3.6
201
+ except:
202
+ speed_kmh = 0
200
203
 
201
204
  if relay:
202
205
  location = request.data.get('location')
206
+ if 'null' in location:
207
+ location = None
203
208
  else:
204
209
  location = self.instance.location
205
- location_smoothed = location
206
210
 
207
211
  user_device.last_seen = timezone.now()
208
212
 
209
- if request.data.get('app_open', False):
213
+ if request.data.get('app_open', False) == True:
210
214
  user_device.is_primary = True
211
215
  UserDevice.objects.filter(
212
216
  users=request.user
@@ -214,7 +218,7 @@ class UserDeviceReport(InstanceMixin, viewsets.GenericViewSet):
214
218
  user_device.save()
215
219
 
216
220
  phone_on_charge = False
217
- if request.data.get('is_charging'):
221
+ if request.data.get('is_charging') == True:
218
222
  phone_on_charge = True
219
223
 
220
224
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simo
3
- Version: 2.5.33
3
+ Version: 2.5.34
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
@@ -47,7 +47,7 @@ simo/core/dynamic_settings.py,sha256=bUs58XEZOCIEhg1TigR3LmYggli13KMryBZ9pC7ugAQ
47
47
  simo/core/events.py,sha256=1_KIk5pJqdLPRQlCQ9xSyALst2Cn0b2lAEAJ3QjwIjE,4801
48
48
  simo/core/filters.py,sha256=ghtOZcrwNAkIyF5_G9Sn73NkiI71mXv0NhwCk4IyMIM,411
49
49
  simo/core/form_fields.py,sha256=wowWocYgxkKBr0WYzpKn4UvH4ScnImus56Tg2G8OPBc,2274
50
- simo/core/forms.py,sha256=O40apPH7a4qX4WdCc10A1aoAaGWOpKqmjB8d-OhEKCo,21523
50
+ simo/core/forms.py,sha256=cLsiyTIAlVni_ir0VplPs6hCdx8SHDkdNW4I9C-lhyw,21568
51
51
  simo/core/gateways.py,sha256=m0eS3XjVe34Dge6xtoCq16kFWCKJcdQrT0JW0REqoq8,3715
52
52
  simo/core/loggers.py,sha256=EBdq23gTQScVfQVH-xeP90-wII2DQFDjoROAW6ggUP4,1645
53
53
  simo/core/managers.py,sha256=n-b3I4uXzfHKTeB1VMjSaMsDUxp8FegFJwnbV1IsWQ4,3019
@@ -10228,7 +10228,7 @@ simo/fleet/auto_urls.py,sha256=UX66eR2ykMqFgfIllW-RTdjup5-FieCWl_BVm3CcXKg,702
10228
10228
  simo/fleet/base_types.py,sha256=wL9RVkHr0gA7HI1wZq0pruGEIgvQqpfnCL4cC3ywsvw,102
10229
10229
  simo/fleet/ble.py,sha256=eHA_9ABjbmH1vUVCv9hiPXQL2GZZSEVwfO0xyI1S0nI,1081
10230
10230
  simo/fleet/controllers.py,sha256=fjri1GtCnflkkDpNqhTwy6i9CK6RDEB0Q_BtADzcG8E,29156
10231
- simo/fleet/forms.py,sha256=bFW9OYxZsnYXEvGUZMZQ1Lef5kf3mW9eH6HYxmJK22A,63048
10231
+ simo/fleet/forms.py,sha256=Z2iTfV_3Ui2QS2mQX7vPtLqiHvHprwkVSeyJ45c0aeU,64047
10232
10232
  simo/fleet/gateways.py,sha256=lKEJW0MgaOEiNnijH50DNSVChvaUT3TA3UurcI57P8k,5677
10233
10233
  simo/fleet/managers.py,sha256=ZNeHFSkF5kzsl9E1DCBevOW6kXJlD6kw0LU4B-JMOG8,828
10234
10234
  simo/fleet/models.py,sha256=zPplx_v64nfKBmb-nCb74aCVtEeY3m3SjEy-VhbnydU,17511
@@ -10245,7 +10245,7 @@ simo/fleet/__pycache__/auto_urls.cpython-38.pyc,sha256=Tc6a6BCXHjijP8U2jE2ghlJwn
10245
10245
  simo/fleet/__pycache__/base_types.cpython-38.pyc,sha256=deyPwjpT6xZiFxBGFnj5b7R-lbdOTh2krgpJhrcGVhc,274
10246
10246
  simo/fleet/__pycache__/ble.cpython-38.pyc,sha256=Nrof9w7cm4OlpFWHeVnmvvanh2_oF9oQ3TknJiV93-0,1267
10247
10247
  simo/fleet/__pycache__/controllers.cpython-38.pyc,sha256=jtFHr_uyjCCeuidL-o-hGaf21u0fnxK_O6hTRdY6lpc,24906
10248
- simo/fleet/__pycache__/forms.cpython-38.pyc,sha256=P7ajkIjrJTAWqPP2ma7L24jyAXpacHShWDdHva88a6o,42628
10248
+ simo/fleet/__pycache__/forms.cpython-38.pyc,sha256=asyDqRo5kRIaFhWqDRXqBPxKGl43O6O00dXOemUN6p0,43057
10249
10249
  simo/fleet/__pycache__/gateways.cpython-38.pyc,sha256=0RKVn0ndreVKhsrukqeLPSdMnRrsQ_W7yeVeBkRLfIk,5058
10250
10250
  simo/fleet/__pycache__/managers.cpython-38.pyc,sha256=Vmm23zoQnS3-uS5_WJt2n3wtjhLiEhLWaYxXJCU6Gts,1339
10251
10251
  simo/fleet/__pycache__/models.cpython-38.pyc,sha256=WUahZgETWlem5rVXlJ_vINFRM7OZWp5xpWXGMoeBXsM,14131
@@ -10296,6 +10296,7 @@ simo/fleet/migrations/0038_alter_colonel_type.py,sha256=3NCAJc5M5BilQynd3lIvub3V
10296
10296
  simo/fleet/migrations/0039_auto_20241016_1047.py,sha256=c75iDlPH9NPQohkNBt58NPl31tNmctk5rww8wWQJmxA,801
10297
10297
  simo/fleet/migrations/0040_alter_colonel_pwm_frequency.py,sha256=AiiYeLXEmBAFj1O3WdJB0xQy1KqfiErYR8yPpL8W7e4,498
10298
10298
  simo/fleet/migrations/0041_alter_colonel_instance_and_more.py,sha256=r3PzZERt4kM0ul_TFl-i7qS7n0ht0G8jS83nucMxZfQ,1181
10299
+ simo/fleet/migrations/0042_auto_20241120_1028.py,sha256=nXyOXyTqhYfR2IDpIX0E3oIhKI7ShI7TGZ0Uf1CzR1U,715
10299
10300
  simo/fleet/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10300
10301
  simo/fleet/migrations/__pycache__/0001_initial.cpython-38.pyc,sha256=9kc1UyMEYkRNVnZ7iwZbiW1t3qWXROvWrI2G1BdzIaA,1250
10301
10302
  simo/fleet/migrations/__pycache__/0002_auto_20220422_0743.cpython-38.pyc,sha256=8oxhGb7rL8QYKlBLU3pOYcd8aHeQWDB9I8awkK04mXg,841
@@ -10338,6 +10339,7 @@ simo/fleet/migrations/__pycache__/0038_alter_colonel_type.cpython-38.pyc,sha256=
10338
10339
  simo/fleet/migrations/__pycache__/0039_auto_20241016_1047.cpython-38.pyc,sha256=6QU9LBUexU9GFSwPoBgLznO6xZU0N-HbWITah-W1xWo,1088
10339
10340
  simo/fleet/migrations/__pycache__/0040_alter_colonel_pwm_frequency.cpython-38.pyc,sha256=o_trHQUyQfYzWO_iWmZpvzc-uVJlBjK-GfyKhPOVSjc,736
10340
10341
  simo/fleet/migrations/__pycache__/0041_alter_colonel_instance_and_more.cpython-38.pyc,sha256=76yu9gz3pcAq5IYbNeZIoOSgdi0HVqTvc3EdXLGriQI,1178
10342
+ simo/fleet/migrations/__pycache__/0042_auto_20241120_1028.cpython-38.pyc,sha256=yK2HRc7MYMc4i9ev7FaguBdnXUnUmpFn8E8JOP_yluA,1030
10341
10343
  simo/fleet/migrations/__pycache__/__init__.cpython-38.pyc,sha256=5k1KW0jeSDzw6RnVPRq4CaO13Lg7M0F-pxA_gqqZ6Mg,170
10342
10344
  simo/fleet/templates/fleet/controllers_info/Button.md,sha256=GIuxqG617174NEtpPeCGVocxO4YMe7-CacgVSu_L5-E,739
10343
10345
  simo/fleet/templates/fleet/controllers_info/ENS160AirQualitySensor.md,sha256=3LSTY9YPFuVPIbVsYCAifcotrXJcOXl2k774_vo6nAE,770
@@ -10447,7 +10449,7 @@ simo/notifications/migrations/__pycache__/0003_alter_notification_instance.cpyth
10447
10449
  simo/notifications/migrations/__pycache__/__init__.cpython-38.pyc,sha256=YMBRHVon2nWDtIUbghckjnC12sIg_ykPWhV5aM0tto4,178
10448
10450
  simo/users/__init__.py,sha256=6a7uBpCWB_DR7p54rbHusc0xvi1qfT1ZCCQGb6TiBh8,52
10449
10451
  simo/users/admin.py,sha256=nmFNHWckp73YZN5MV6ez6ommlj4MSI1Sr8BnQdSKW5g,7187
10450
- simo/users/api.py,sha256=hU70VoYQtTH5xZ2b6swH8_b8G6bdsl8yztk-FHxbZlA,12342
10452
+ simo/users/api.py,sha256=O3PYSk8BSX2hsi22cHSgqKQXViL9b3-xgBU2oJDfQGA,12443
10451
10453
  simo/users/apps.py,sha256=cq0A8-U1HALEwev0TicgFhr4CAu7Icz8rwq0HfOaL4E,207
10452
10454
  simo/users/auth_backends.py,sha256=KIw2AdjCUKfm_7Lql6aC4qdE6JznP0ECIMA5MVMLeiM,4251
10453
10455
  simo/users/auto_urls.py,sha256=lcJvteBsbHQMJieZpDz-63tDYejLApqsW3CUnDakd7k,272
@@ -10464,7 +10466,7 @@ simo/users/utils.py,sha256=-Lu7C_sz8JJauLaIwgEa6umArqzNL7JJTY-ZcuF4irA,2004
10464
10466
  simo/users/views.py,sha256=dOQVvmlHG7ihWKJLFUBcqKOA0UDctlMKR0pTc36JZqg,3487
10465
10467
  simo/users/__pycache__/__init__.cpython-38.pyc,sha256=VFoDJE_SKKaPqqYaaBYd1Ndb1hjakkTo_u0EG_XJ1GM,211
10466
10468
  simo/users/__pycache__/admin.cpython-38.pyc,sha256=Jcwn0jqueQkmgXPb327-3iUtrSycGzM537JB_-sryOM,8213
10467
- simo/users/__pycache__/api.cpython-38.pyc,sha256=N6s2wXZiOKXCVekI7U3HbMymoOMsZGlKNHdfjJgLn_8,9947
10469
+ simo/users/__pycache__/api.cpython-38.pyc,sha256=bwjxYhY4MBPbKLj-wJkTFZxHSqUE0fIC4Pw4lrHw9g4,9980
10468
10470
  simo/users/__pycache__/apps.cpython-38.pyc,sha256=dgbWL8CxzzISJQTmq_4IztPJ2UzykNVdqA2Ae1PmeGk,605
10469
10471
  simo/users/__pycache__/auth_backends.cpython-38.pyc,sha256=jYS2hlbTZh_ZtPeWcN50pc0IpyfCSO7_MvIbuVwEp8M,3144
10470
10472
  simo/users/__pycache__/auto_urls.cpython-38.pyc,sha256=K-3sz2h-cEitoflSmZk1t0eUg5mQMMGLNZFREVwG7_o,430
@@ -10575,9 +10577,9 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
10575
10577
  simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10576
10578
  simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10577
10579
  simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10578
- simo-2.5.33.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10579
- simo-2.5.33.dist-info/METADATA,sha256=IorucYL9ZZ7DjoUiKgucRTDPyUlHNQZNu5VY4THxPQw,1953
10580
- simo-2.5.33.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
10581
- simo-2.5.33.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10582
- simo-2.5.33.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10583
- simo-2.5.33.dist-info/RECORD,,
10580
+ simo-2.5.34.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10581
+ simo-2.5.34.dist-info/METADATA,sha256=It5zSxA-pwB_V8rKlMy-sHyM3fLZgFds8V4Seg4XChc,1953
10582
+ simo-2.5.34.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
10583
+ simo-2.5.34.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10584
+ simo-2.5.34.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10585
+ simo-2.5.34.dist-info/RECORD,,
File without changes