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

@@ -350,8 +350,11 @@ class AutomationsGatewayHandler(GatesHandler, BaseObjectCommandsGatewayHandler):
350
350
  print("START SCRIPT %s" % str(component))
351
351
  if component.id in self.running_scripts:
352
352
  if component.value in ('finished', 'error', 'stopped'):
353
- self.running_scripts[component.id].kill()
354
- self.running_scripts.pop(component.id)
353
+ try:
354
+ self.running_scripts[component.id].kill()
355
+ except:
356
+ pass
357
+ self.running_scripts.pop(component.id, None)
355
358
  elif component.id not in self.terminating_scripts \
356
359
  and self.running_scripts[component.id].is_alive():
357
360
  if component.value != 'running':
@@ -359,7 +362,10 @@ class AutomationsGatewayHandler(GatesHandler, BaseObjectCommandsGatewayHandler):
359
362
  component.save()
360
363
  return
361
364
  else:
362
- self.running_scripts[component.id].kill()
365
+ try:
366
+ self.running_scripts[component.id].kill()
367
+ except:
368
+ pass
363
369
 
364
370
  self.running_scripts[component.id] = ScriptRunHandler(
365
371
  component.id, multiprocessing.Event(),
simo/automation/models.py CHANGED
@@ -15,8 +15,9 @@ def post_script_change(sender, instance, created, **kwargs):
15
15
  return
16
16
 
17
17
  def post_update():
18
- instance.controller.stop()
19
- if instance.config.get('keep_alive') or instance.config.get('autostart'):
18
+ if instance.value == 'running':
19
+ instance.controller.stop()
20
+ if instance.config.get('autostart'):
20
21
  time.sleep(2)
21
22
  instance.controller.start()
22
23
 
simo/core/controllers.py CHANGED
@@ -509,6 +509,12 @@ class MultiSensor(ControllerBase):
509
509
  return vectors
510
510
 
511
511
 
512
+ def get_val(self, param):
513
+ for item in self.component.value:
514
+ if item[0] == param:
515
+ return item[1]
516
+
517
+
512
518
  class BinarySensor(ControllerBase):
513
519
  name = _("Binary sensor")
514
520
  base_type = 'binary-sensor'
simo/core/tasks.py CHANGED
@@ -476,8 +476,13 @@ def maybe_update_to_latest():
476
476
  if resp.status_code != 200:
477
477
  print("Bad response from server")
478
478
  return
479
- latest = list(resp.json()['releases'].keys())[-1]
480
- dynamic_settings['core__latest_version_available'] = latest
479
+
480
+ versions = list(resp.json()['releases'].keys())
481
+ def version_no(v):
482
+ major, minor, patch = v.split('.')
483
+ return int(major) * 1000000 + int(minor) * 1000 + int(patch)
484
+ versions.sort(reverse=True, key=version_no)
485
+ dynamic_settings['core__latest_version_available'] = versions[0]
481
486
 
482
487
  try:
483
488
  version = pkg_resources.get_distribution('simo').version
simo/users/models.py CHANGED
@@ -216,7 +216,6 @@ class User(AbstractBaseUser, SimoAdminMixin):
216
216
  REQUIRED_FIELDS = ['name']
217
217
 
218
218
 
219
-
220
219
  class Meta:
221
220
  verbose_name = _('user')
222
221
  verbose_name_plural = _('users')
@@ -225,8 +224,6 @@ class User(AbstractBaseUser, SimoAdminMixin):
225
224
  def __init__(self, *args, **kwargs):
226
225
  super().__init__(*args, **kwargs)
227
226
  self._is_active = None
228
- self._instances = None
229
- self._instance_roles = {}
230
227
 
231
228
  def __str__(self):
232
229
  return self.name
@@ -270,8 +267,6 @@ class User(AbstractBaseUser, SimoAdminMixin):
270
267
  return self.is_active and self.is_master
271
268
 
272
269
  def get_role(self, instance):
273
- if instance.id in self._instance_roles:
274
- return self._instance_roles[instance.id]
275
270
  cache_key = f'user-{self.id}_instance-{instance.id}_role'
276
271
  role = cache.get(cache_key)
277
272
  if role is None:
@@ -282,8 +277,7 @@ class User(AbstractBaseUser, SimoAdminMixin):
282
277
  ).first()
283
278
  if role:
284
279
  cache.set(cache_key, role, 20)
285
- self._instance_roles[instance.id] = role
286
- return self._instance_roles[instance.id]
280
+ return role
287
281
 
288
282
  @property
289
283
  def role_id(self):
@@ -329,8 +323,6 @@ class User(AbstractBaseUser, SimoAdminMixin):
329
323
  from simo.core.models import Instance
330
324
  if not self.is_active:
331
325
  return Instance.objects.none()
332
- if self._instances != None:
333
- return self._instances
334
326
 
335
327
  cache_key = f'user-{self.id}_instances'
336
328
  instances = cache.get(cache_key)
@@ -344,8 +336,8 @@ class User(AbstractBaseUser, SimoAdminMixin):
344
336
  )
345
337
  ], is_active=True)
346
338
  cache.set(cache_key, instances, 10)
347
- self._instances = instances
348
- return self._instances
339
+
340
+ return instances
349
341
 
350
342
  @property
351
343
  def component_permissions(self):
@@ -356,8 +348,6 @@ class User(AbstractBaseUser, SimoAdminMixin):
356
348
 
357
349
  @property
358
350
  def is_active(self):
359
- if self._is_active != None:
360
- return self._is_active
361
351
  cache_key = f'user-{self.id}_is_active'
362
352
  cached_value = cache.get(cache_key)
363
353
  if cached_value is None:
@@ -383,9 +373,7 @@ class User(AbstractBaseUser, SimoAdminMixin):
383
373
  self.instance_roles.filter(is_active=True).count()
384
374
  )
385
375
  cache.set(cache_key, cached_value, 20)
386
-
387
- self._is_active = cached_value
388
- return self._is_active
376
+ return cached_value
389
377
 
390
378
 
391
379
  @is_active.setter
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simo
3
- Version: 2.7.18
3
+ Version: 2.7.20
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
@@ -21,9 +21,9 @@ simo/automation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  simo/automation/app_widgets.py,sha256=gaqImMZjuMHm7nIb9a4D-Y3qipz_WhSPAHXcwGx4Uzs,199
22
22
  simo/automation/controllers.py,sha256=Ow8xG9hkdyMRZbrNPX5uZloYM9jZqa9mgCh4k6FeoJw,11492
23
23
  simo/automation/forms.py,sha256=UWnkxw8pILPK0smRPTo4SLgsZl78zOySx7JIc30Bgtk,10228
24
- simo/automation/gateways.py,sha256=iWHDACq98Xzwe1kQIa1d6uDRV9wEBmZLd8ouHlGkw5I,15694
24
+ simo/automation/gateways.py,sha256=MAzv-i8BemhqfNY2NTYYlyCGPfctyNh4_dXyIZYJRSE,15848
25
25
  simo/automation/helpers.py,sha256=iP-fxxB8HsFQy3k2CjFubu86aMqvWgmh-p24DiyOrek,4330
26
- simo/automation/models.py,sha256=l45FHgeKGsfpLtd1X1PVFpIjB5JI4BlvKkodpcxm6aE,927
26
+ simo/automation/models.py,sha256=zt-jkzyq5ddqGT864OkJzCsvov2vZ0nO4ez3hAeZkXg,934
27
27
  simo/automation/serializers.py,sha256=PjyFrjdPK1mBsgbNhyqMi9SWzcymqTa742ipy0LhAN4,1996
28
28
  simo/automation/state.py,sha256=aZZvNBae7unnux_zGHCIWCV2z47hVJc-DIL72Hqfkeo,600
29
29
  simo/automation/__pycache__/__init__.cpython-312.pyc,sha256=rIs1rkBbUhjXjbUffmq2-tb7XbAY0JkA83xXPoByTwU,170
@@ -34,11 +34,11 @@ simo/automation/__pycache__/controllers.cpython-312.pyc,sha256=w2yAFvk-Fh1MZha7J
34
34
  simo/automation/__pycache__/controllers.cpython-38.pyc,sha256=CL-0Tq9B4-E36fYfWT1XEBTq1dkq1W8003f6MrBnQU0,8391
35
35
  simo/automation/__pycache__/forms.cpython-312.pyc,sha256=63rU0rWZk-Rz5qoMZiXl743WPc9NVm5d8bSd8w52T4E,12347
36
36
  simo/automation/__pycache__/forms.cpython-38.pyc,sha256=cpA5hA2Iz3JsPC0Dq01ki1I7S9c5DKRcXveHApI1dJo,7772
37
- simo/automation/__pycache__/gateways.cpython-312.pyc,sha256=yOA6ec8FeZQLYdM4zdrx7cklKY9MJRFYm5xv7SkDag0,22129
37
+ simo/automation/__pycache__/gateways.cpython-312.pyc,sha256=j4bG9KqBcCB8JD59frTl9VtP8n04mUPF_bd0vInDZfs,22223
38
38
  simo/automation/__pycache__/gateways.cpython-38.pyc,sha256=nHujqChMCqqxHbZezP3MisavjKDhczqzFGurO10h-lc,11113
39
39
  simo/automation/__pycache__/helpers.cpython-312.pyc,sha256=aDFtzBE72szi4gzVxK_NiAEC__wCmdztw0UKu2lVU58,5853
40
40
  simo/automation/__pycache__/helpers.cpython-38.pyc,sha256=fNjSyn4Mfq7-JQx-bdsnj-rSxgu20dVJ9-5ZEMT6yiM,3627
41
- simo/automation/__pycache__/models.cpython-312.pyc,sha256=udvF6nfTRYISXJJyudJCEieTEdoZ3MthhtLfLu9zbx4,1815
41
+ simo/automation/__pycache__/models.cpython-312.pyc,sha256=yGnRFAG5Py3-OsPxEjACM0WNWt6Eo9wsHeUGL3uUF8M,1789
42
42
  simo/automation/__pycache__/models.cpython-38.pyc,sha256=VeQNAygVr0AXPlF5LEYk90Tq8zuCVPfsA2r1NBjrkxU,1230
43
43
  simo/automation/__pycache__/serializers.cpython-312.pyc,sha256=Y68epVxWVtIRtED--24LOf5PIDHXthpVweAYpqE4X6U,4314
44
44
  simo/automation/__pycache__/serializers.cpython-38.pyc,sha256=9Te21FW5-Tki1a-tq3gt0rme0afBA8o-7V249b4muFk,3405
@@ -97,7 +97,7 @@ simo/core/auto_urls.py,sha256=FqKhH0fF7cGO6P2YrjblwG4JA2UkVXj3lreJUOB2Jq4,1194
97
97
  simo/core/autocomplete_views.py,sha256=x3MKOZvXYS3xVQ-V1S7Liv_U5bxr-uc0gePa85wv5nA,4561
98
98
  simo/core/base_types.py,sha256=WypW8hTfzveuTQtruGjLYAGQZIuczxTlW-SdRk3iQug,666
99
99
  simo/core/context.py,sha256=LKw1I4iIRnlnzoTCuSLLqDX7crHdBnMo3hjqYvVmzFc,1557
100
- simo/core/controllers.py,sha256=gVwQHYkJ6GNTHaKTSjf4H2VVykQbvKh4_fSe_MdAVi4,37412
100
+ simo/core/controllers.py,sha256=nJZNjltis0DIlwb0Yn84MllXsPxo2CMhcAmtGPKnhBg,37550
101
101
  simo/core/dynamic_settings.py,sha256=bUs58XEZOCIEhg1TigR3LmYggli13KMryBZ9pC7ugAQ,1872
102
102
  simo/core/events.py,sha256=1_KIk5pJqdLPRQlCQ9xSyALst2Cn0b2lAEAJ3QjwIjE,4801
103
103
  simo/core/filters.py,sha256=6wbn8C2WvKTTjtfMwwLBp2Fib1V0-DMpS4iqJd6jJQo,2540
@@ -114,7 +114,7 @@ simo/core/serializers.py,sha256=jimqPhL2mq5_dJWtv6P1qErFMaNMizsAS2E_aYkAiQU,2320
114
114
  simo/core/signal_receivers.py,sha256=5qp607PdNlRHyw88YOXu7rSznHm3upEpWLxB0lmEa0s,6527
115
115
  simo/core/socket_consumers.py,sha256=Es_NmacQGZjsncBXDTEXR2yZbRs7mf2FKOBJjbZRGac,9607
116
116
  simo/core/storage.py,sha256=_5igjaoWZAiExGWFEJMElxUw55DzJG1jqFty33xe8BE,342
117
- simo/core/tasks.py,sha256=LMTkZQDGFus5L2Q8AGzYegjpnZKf9Klgo3V9BT5L2ng,16904
117
+ simo/core/tasks.py,sha256=-yBjOPILEnKRga-6MK-hBpEINQcY5mpwZwUWiDpqISs,17091
118
118
  simo/core/todos.py,sha256=eYVXfLGiapkxKK57XuviSNe3WsUYyIWZ0hgQJk7ThKo,665
119
119
  simo/core/types.py,sha256=WJEq48mIbFi_5Alt4wxWMGXxNxUTXqfQU5koH7wqHHI,1108
120
120
  simo/core/views.py,sha256=08H4Bm7KrHxB3p3ZKx1vrFR4d0DjCqMbqQosEsRWpkY,2841
@@ -141,7 +141,7 @@ simo/core/__pycache__/base_types.cpython-312.pyc,sha256=Lnq2NL9B5hfwJARJYC447Rdv
141
141
  simo/core/__pycache__/base_types.cpython-38.pyc,sha256=CX-qlF7CefRi_mCE954wYa9rUFR88mOl6g7fybDRu7g,803
142
142
  simo/core/__pycache__/context.cpython-312.pyc,sha256=8rsN2Er-Sx3rrVmO0Gk4cem3euGh0kTELXj667GGZ5E,2193
143
143
  simo/core/__pycache__/context.cpython-38.pyc,sha256=NlTHt2GvXxA21AhBkeyOLfRFUuXw7wmwqyNhhcDl2cw,1373
144
- simo/core/__pycache__/controllers.cpython-312.pyc,sha256=qB4nqIK85sHv6SksPmbOSlIdXXCxfJukk-oQnX_hvls,52648
144
+ simo/core/__pycache__/controllers.cpython-312.pyc,sha256=z7zxtaI-nD3F94qct1_j7PiIJZEs1gGdv_nRn3D8iRM,52921
145
145
  simo/core/__pycache__/controllers.cpython-38.pyc,sha256=LtrQQ8egOIOuQbAckeM-z8OfbzS4W8VQ3vBnryAm3iU,32086
146
146
  simo/core/__pycache__/dynamic_settings.cpython-312.pyc,sha256=WUZ6XF4kZb6zPf541PkKmiQaBIw-r5C6F3EUUZiTEnE,3331
147
147
  simo/core/__pycache__/dynamic_settings.cpython-38.pyc,sha256=wGpnscX1DxFpRl54MQURhjz2aD3NJohSzw9JCFnzh2Y,2384
@@ -10741,7 +10741,7 @@ simo/users/auto_urls.py,sha256=RSUW3ai5LbMTknS8M7M5aOnG_YlFOVQrnNVNH-fkwlg,357
10741
10741
  simo/users/dynamic_settings.py,sha256=sEIsi4yJw3kH46Jq_aOkSuK7QTfQACGUE-lkyBogCaM,570
10742
10742
  simo/users/managers.py,sha256=OHgEP85MBtdkdYxdstBd8RavTBT8F_2WyDxUJ9aCqqM,246
10743
10743
  simo/users/middleware.py,sha256=GMCrnWSc_2qCleyQIkfQGdL-pU-UTEcSg1wPvIKZ9uk,1210
10744
- simo/users/models.py,sha256=qTlhML4zRfL_Gcomblc09GU1xWDa4DOwbFaxCgd_rsE,20563
10744
+ simo/users/models.py,sha256=GFTMfs7dC6XXmvot7WLcjyH0WqowNU9zbLD9oE0_3Yg,20092
10745
10745
  simo/users/permissions.py,sha256=IwtYS8yQdupWbYKR9VimSRDV3qCJ2jXP57Lyjpb2EQM,242
10746
10746
  simo/users/serializers.py,sha256=zzw1KONTnaTNBaU0r4rNVxJ827KzD6Z5LuQt27ZsQ98,2516
10747
10747
  simo/users/sso_urls.py,sha256=gQOaPvGMYFD0NCVSwyoWO-mTEHe5j9sbzV_RK7kdvp0,251
@@ -10924,9 +10924,9 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
10924
10924
  simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10925
10925
  simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10926
10926
  simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10927
- simo-2.7.18.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10928
- simo-2.7.18.dist-info/METADATA,sha256=j6TvPFZp0bUFmMqq9nbWJnZCiqLB0MxSUCBOqoAK3j0,2009
10929
- simo-2.7.18.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
10930
- simo-2.7.18.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10931
- simo-2.7.18.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10932
- simo-2.7.18.dist-info/RECORD,,
10927
+ simo-2.7.20.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10928
+ simo-2.7.20.dist-info/METADATA,sha256=aVspt7f-xasumTf7jkxZRQi1qERai_kgs1wGTM6MKtI,2009
10929
+ simo-2.7.20.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
10930
+ simo-2.7.20.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10931
+ simo-2.7.20.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10932
+ simo-2.7.20.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.7.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5