simo 2.6.2__py3-none-any.whl → 2.6.3__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/automation/forms.py CHANGED
@@ -112,14 +112,7 @@ class ScriptConfigForm(BaseComponentForm):
112
112
  self.cleaned_data['code'] = self._ai_resp['result']
113
113
  if 'notes' in self.cleaned_data:
114
114
  self.cleaned_data['notes'] = self._ai_resp['description']
115
- obj = super().save(commit)
116
- if commit:
117
- obj.controller.stop()
118
- if self.cleaned_data.get('keep_alive') \
119
- or self.cleaned_data.get('autostart'):
120
- time.sleep(2)
121
- obj.controller.start()
122
- return obj
115
+ return super().save(commit)
123
116
 
124
117
 
125
118
  class ConditionForm(forms.Form):
@@ -277,14 +270,4 @@ class PresenceLightingConfigForm(BaseComponentForm):
277
270
  ContentType.objects.get_for_model(Component).id,
278
271
  self.instance.id
279
272
  )
280
- )
281
-
282
- def save(self, commit=True):
283
- obj = super().save(commit)
284
- if commit:
285
- obj.controller.stop()
286
- if self.cleaned_data.get('keep_alive') \
287
- or self.cleaned_data.get('autostart'):
288
- time.sleep(2)
289
- obj.controller.start()
290
- return obj
273
+ )
@@ -0,0 +1,31 @@
1
+ import time
2
+ from django.db import transaction
3
+ from django.db.models.signals import post_save, post_delete
4
+ from django.dispatch import receiver
5
+ from simo.core.models import Component
6
+
7
+
8
+ @receiver(post_save, sender=Component)
9
+ def post_script_change(sender, instance, created, **kwargs):
10
+ from .controllers import Script
11
+ if not isinstance(instance.controller, Script):
12
+ return
13
+
14
+ if 'config' not in instance.get_dirty_fields():
15
+ return
16
+
17
+ def post_update():
18
+ instance.controller.stop()
19
+ if instance.config.get('keep_alive') or instance.config('autostart'):
20
+ time.sleep(2)
21
+ instance.controller.start()
22
+
23
+ transaction.on_commit(post_update)
24
+
25
+
26
+ @receiver(post_delete, sender=Component)
27
+ def gateway_post_delete(sender, instance, *args, **kwargs):
28
+ from .controllers import Script
29
+ if not isinstance(instance.controller, Script):
30
+ return
31
+ instance.stop()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simo
3
- Version: 2.6.2
3
+ Version: 2.6.3
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
@@ -14,17 +14,19 @@ simo/__pycache__/wsgi.cpython-38.pyc,sha256=TpRxO7VM_ql31hbKphVdanydC5RI1nHB4l0Q
14
14
  simo/automation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  simo/automation/app_widgets.py,sha256=gaqImMZjuMHm7nIb9a4D-Y3qipz_WhSPAHXcwGx4Uzs,199
16
16
  simo/automation/controllers.py,sha256=gIkEOqq7IJ3BoDF40mN2aTGE8_yVwhQrO0RZlJYiYfg,9451
17
- simo/automation/forms.py,sha256=tom_z2CRRsjro2aq3ypjybYWfzPa-uVIJxxS5fRP8n0,10650
17
+ simo/automation/forms.py,sha256=PxvKWKFm59-kItywVAdDxHGrxILxUoUk9QLr3RihVM0,10083
18
18
  simo/automation/gateways.py,sha256=1ByxQZPDARU006b30ua6unSbp25bcbyw1ETzQXWhrbU,9349
19
19
  simo/automation/helpers.py,sha256=iP-fxxB8HsFQy3k2CjFubu86aMqvWgmh-p24DiyOrek,4330
20
+ simo/automation/models.py,sha256=WuziHZ9rTcAnE5eYSDP8DOMu-PJQJROSaEqTBpCJK7o,923
20
21
  simo/automation/serializers.py,sha256=PjyFrjdPK1mBsgbNhyqMi9SWzcymqTa742ipy0LhAN4,1996
21
22
  simo/automation/state.py,sha256=aZZvNBae7unnux_zGHCIWCV2z47hVJc-DIL72Hqfkeo,600
22
23
  simo/automation/__pycache__/__init__.cpython-38.pyc,sha256=YmP0xAD-mxpQHgdTZeC64sXChA8TriMZD1jckNYi3xg,164
23
24
  simo/automation/__pycache__/app_widgets.cpython-38.pyc,sha256=7DfUA9V_1MiwrOe_ta-ts8dYY8xXb9UMg2_9A3XoRcs,523
24
25
  simo/automation/__pycache__/controllers.cpython-38.pyc,sha256=JUQ105NN-9Si1pyCkqn4P_4yQ9NG7OnQfSRBzBaeth4,7535
25
- simo/automation/__pycache__/forms.cpython-38.pyc,sha256=zdNJhSZp4PXaQQgvbwO_10CaolhW5WxQOCVfQkH2N04,8131
26
+ simo/automation/__pycache__/forms.cpython-38.pyc,sha256=F3jJAdRD3mEY2GGcCeI58UUnWIjTosfklfL2x5sJyA0,7720
26
27
  simo/automation/__pycache__/gateways.cpython-38.pyc,sha256=UhLcKI2kasoVnGCoe0M0-giBIVkWWuySMjKTgX2FdOs,7502
27
28
  simo/automation/__pycache__/helpers.cpython-38.pyc,sha256=4VSSarOFnUk_KExWwvDlx5dEhv8aHUCHMZDtGG--pUY,3627
29
+ simo/automation/__pycache__/models.cpython-38.pyc,sha256=H_jWZ0dvJV5afCb5h8rOZ6nAuG2kCCrQbavz7V4nBZc,1228
28
30
  simo/automation/__pycache__/serializers.cpython-38.pyc,sha256=gWgcuPE8aY-TmuRLXCuSR74mvtKerpZ04m0MfPfw0AI,3405
29
31
  simo/automation/__pycache__/state.cpython-38.pyc,sha256=TO2IM6h2hbGVlOUcoMwHkDUF4V-54d_KVhcebMgNtCk,784
30
32
  simo/automation/migrations/0001_initial.py,sha256=VB6WIK1RlUdtqlWYCEhtnVE24odp2dfUvOVcxUZPpQ4,990
@@ -10597,9 +10599,9 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
10597
10599
  simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10598
10600
  simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10599
10601
  simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10600
- simo-2.6.2.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10601
- simo-2.6.2.dist-info/METADATA,sha256=cAbQa5xBzOrd28hMtHVGC9zYeYZEyEQD9c0_zIoqrJI,1952
10602
- simo-2.6.2.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
10603
- simo-2.6.2.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10604
- simo-2.6.2.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10605
- simo-2.6.2.dist-info/RECORD,,
10602
+ simo-2.6.3.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10603
+ simo-2.6.3.dist-info/METADATA,sha256=1fD00X5OHyD52gEQb3u4suJ38ESebO55Ccb1caEO5gc,1952
10604
+ simo-2.6.3.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
10605
+ simo-2.6.3.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10606
+ simo-2.6.3.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10607
+ simo-2.6.3.dist-info/RECORD,,
File without changes