simo 2.8.5__py3-none-any.whl → 2.8.7__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
Binary file
simo/asgi.py CHANGED
@@ -1,4 +1,4 @@
1
- import importlib
1
+ import importlib, datetime, sys
2
2
  from django.core.asgi import get_asgi_application
3
3
  from channels.auth import AuthMiddlewareStack
4
4
  from channels.routing import ProtocolTypeRouter, URLRouter
@@ -21,6 +21,26 @@ for name, app in apps.app_configs.items():
21
21
  if isinstance(item, list) and var_name == 'urlpatterns':
22
22
  urlpatterns.extend(item)
23
23
 
24
+
25
+ class TimestampedStream:
26
+ """Adds timestamps to all the prints"""
27
+
28
+ def __init__(self, stream):
29
+ self.stream = stream
30
+
31
+ def write(self, data):
32
+ if data != '\n':
33
+ timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
34
+ self.stream.write(f'[{timestamp}] {data}')
35
+ else:
36
+ self.stream.write(data)
37
+
38
+ def flush(self):
39
+ self.stream.flush()
40
+
41
+
42
+ sys.stdout = TimestampedStream(sys.stdout)
43
+
24
44
  application = ProtocolTypeRouter({
25
45
  "http": get_asgi_application(),
26
46
  'websocket': AuthMiddlewareStack(
simo/core/controllers.py CHANGED
@@ -289,12 +289,23 @@ class ControllerBase(ABC):
289
289
  actor = self._get_actor(value)
290
290
  if not actor:
291
291
  actor = get_current_user()
292
- if actor:
293
- introduce_user(actor)
294
292
 
295
293
  self.component.refresh_from_db()
296
294
  if value != self.component.value:
297
295
  self.component.value_previous = self.component.value
296
+ from .models import ComponentHistory
297
+ ComponentHistory.objects.create(
298
+ component=self.component, type='value', value=value,
299
+ user=actor
300
+ )
301
+ from actstream import action
302
+ action.send(
303
+ actor, target=self, verb="value change",
304
+ instance_id=self.component.zone.instance.id,
305
+ action_type='comp_value', value=value
306
+ )
307
+ actor.last_action = timezone.now()
308
+ actor.save()
298
309
  self.component.value = value
299
310
 
300
311
  self.component.change_init_by = None
@@ -303,6 +314,8 @@ class ControllerBase(ABC):
303
314
  self.component.change_init_fingerprint = None
304
315
  self.component.save()
305
316
 
317
+
318
+
306
319
  def _receive_from_device(
307
320
  self, value, is_alive=True, battery_level=None, error_msg=None
308
321
  ):
@@ -314,9 +327,6 @@ class ControllerBase(ABC):
314
327
  init_by_device = True
315
328
  actor = get_device_user()
316
329
 
317
- # Introducing user to this thread for changes that might happen to other components
318
- # in relation to the change of this component
319
- introduce_user(actor)
320
330
  self.component.alive = is_alive
321
331
  if error_msg != None:
322
332
  self.component.error_msg = error_msg if error_msg.strip() else None
simo/core/models.py CHANGED
@@ -510,18 +510,7 @@ def is_in_alarm(self):
510
510
 
511
511
  if self.pk:
512
512
  actor = get_current_user()
513
- action_performed = False
514
- if 'value' in dirty_fields:
515
- ComponentHistory.objects.create(
516
- component=self, type='value', value=self.value,
517
- user=actor
518
- )
519
- action.send(
520
- actor, target=self, verb="value change",
521
- instance_id=self.zone.instance.id,
522
- action_type='comp_value', value=self.value
523
- )
524
- action_performed = True
513
+
525
514
  if 'arm_status' in dirty_fields:
526
515
  ComponentHistory.objects.create(
527
516
  component=self, type='security',
@@ -533,7 +522,6 @@ def is_in_alarm(self):
533
522
  action_type='security', value=self.value
534
523
  )
535
524
  action_performed = True
536
- if action_performed:
537
525
  actor.last_action = timezone.now()
538
526
  actor.save()
539
527
 
simo/settings.py CHANGED
@@ -295,21 +295,3 @@ ACTSTREAM_SETTINGS = {
295
295
  DATETIME_FORMAT = 'Y-m-d H:i:s'
296
296
 
297
297
 
298
- class TimestampedStream:
299
- """Adds timestamps to all the prints"""
300
-
301
- def __init__(self, stream):
302
- self.stream = stream
303
-
304
- def write(self, data):
305
- if data != '\n':
306
- timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
307
- self.stream.write(f'[{timestamp}] {data}')
308
- else:
309
- self.stream.write(data)
310
-
311
- def flush(self):
312
- self.stream.flush()
313
-
314
-
315
- sys.stdout = TimestampedStream(sys.stdout)
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: simo
3
- Version: 2.8.5
4
- Summary: Smart Home on Steroids!
3
+ Version: 2.8.7
4
+ Summary: Smart Home Supremacy
5
5
  Author-email: Simanas Venčkauskas <simanas@simo.io>
6
6
  Project-URL: Homepage, https://simo.io
7
7
  Project-URL: Issues, https://github.com/pypa/sampleproject/issues
@@ -1,18 +1,18 @@
1
1
  simo/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2
- simo/asgi.py,sha256=L8CUVZLM32IMzWDZ4IShdDN-m69t7oxAUeHods4-xNM,822
2
+ simo/asgi.py,sha256=-CIyRRKCfZqMS7SIh69Me07JWE-CjcNzls_lEvchaqc,1301
3
3
  simo/celeryc.py,sha256=eab7_e9rw0c__DCeoUFUh_tjAGVlulxVrk75BaJf57Q,1512
4
4
  simo/conf.py,sha256=H2BhXAV8MEDVXF8AbkaLSfR4ULd-9_bS4bnhE5sE5fg,112
5
- simo/settings.py,sha256=C04iruyTTGqrcYuZjW_EN7V8MNPWNnsde4dZiQ3tr4Y,7523
5
+ simo/settings.py,sha256=EloltW6viNx4v6bMOorAvtjxsZ4nWI_5FiWZzQ6NCLE,7062
6
6
  simo/urls.py,sha256=d8g-wN0Xr2PVIV8RZl_h_PMN9KGZNIE9to2hQj1p1TU,2497
7
7
  simo/__pycache__/__init__.cpython-312.pyc,sha256=a12_Zr7kC5DXzcFxA5eMu-TiSU5xbdF5cdKq-gwc3x0,159
8
8
  simo/__pycache__/__init__.cpython-38.pyc,sha256=j81de0BqHMr6bs0C7cuYrXl7HwtK_vv8hDEtAdSwDJc,153
9
- simo/__pycache__/asgi.cpython-312.pyc,sha256=3TFbweG4IzHv2br0bONji5wjd26pUvs1r_7fGXVBUVg,1263
9
+ simo/__pycache__/asgi.cpython-312.pyc,sha256=V3Whr1WOgmiagL6BzfKuQqwlSZHUbmi6gqsTga8N9oI,2458
10
10
  simo/__pycache__/asgi.cpython-38.pyc,sha256=5W_YSKOIrRd6NQQuJDuA3Yuj688GzirXVVOyLe8wJIQ,845
11
11
  simo/__pycache__/celeryc.cpython-312.pyc,sha256=MQlG6VeEdCpXPpiiAwZavriWKwHbhwTMrfAwdhnb2kw,2375
12
12
  simo/__pycache__/celeryc.cpython-38.pyc,sha256=eSRoaKwfYlxVaxAiwqpQ2ndEcx7W-VpZtbxRFSV8UYg,1653
13
13
  simo/__pycache__/conf.cpython-312.pyc,sha256=q63YJWqaaaQLz3qXW8clENjvH1zUfY_k34_m56n5gRY,320
14
14
  simo/__pycache__/conf.cpython-38.pyc,sha256=MYP2yk3ULxiYwZsZR6tCLjKnU-z03A3avzQzIn66y3k,273
15
- simo/__pycache__/settings.cpython-312.pyc,sha256=lrMjm4OihDlNrull26G_TaWUEJkFbo4Po5ir5efSRU4,7886
15
+ simo/__pycache__/settings.cpython-312.pyc,sha256=rwwP1a_wo7d0MqznWZ8HOibSJvfy4JI2-BPKBjV0qKI,6738
16
16
  simo/__pycache__/settings.cpython-38.pyc,sha256=4w3ds3D9S78zbsovXsXC05PYBAafDrtsOhX14FT0YyE,6149
17
17
  simo/__pycache__/urls.cpython-312.pyc,sha256=mIg_YD7zgjmIzfWzpGpikMqanGKP2O-iuA1ixqQngnc,3689
18
18
  simo/__pycache__/urls.cpython-38.pyc,sha256=u0x6EqT8S1YfDOSPgbI8Kf-RDlveY9OV-EDXMYKAQ7w,2125
@@ -98,7 +98,7 @@ simo/core/auto_urls.py,sha256=FqKhH0fF7cGO6P2YrjblwG4JA2UkVXj3lreJUOB2Jq4,1194
98
98
  simo/core/autocomplete_views.py,sha256=x3MKOZvXYS3xVQ-V1S7Liv_U5bxr-uc0gePa85wv5nA,4561
99
99
  simo/core/base_types.py,sha256=WypW8hTfzveuTQtruGjLYAGQZIuczxTlW-SdRk3iQug,666
100
100
  simo/core/context.py,sha256=LKw1I4iIRnlnzoTCuSLLqDX7crHdBnMo3hjqYvVmzFc,1557
101
- simo/core/controllers.py,sha256=4u67VNwU4Zts64aVddqhoPt9ZRbpTmAHPCdu-pFfIX0,37407
101
+ simo/core/controllers.py,sha256=Dsg3047IW_jxAS3AWnwTK7blLPAnr_w16R7HAI1d3gk,37709
102
102
  simo/core/dynamic_settings.py,sha256=bUs58XEZOCIEhg1TigR3LmYggli13KMryBZ9pC7ugAQ,1872
103
103
  simo/core/events.py,sha256=1_KIk5pJqdLPRQlCQ9xSyALst2Cn0b2lAEAJ3QjwIjE,4801
104
104
  simo/core/filters.py,sha256=6wbn8C2WvKTTjtfMwwLBp2Fib1V0-DMpS4iqJd6jJQo,2540
@@ -108,7 +108,7 @@ simo/core/gateways.py,sha256=Y2BME6zSyeUq_e-hzEUF6gErCUCP6nFxedkLZKiLVOo,4141
108
108
  simo/core/loggers.py,sha256=EBdq23gTQScVfQVH-xeP90-wII2DQFDjoROAW6ggUP4,1645
109
109
  simo/core/managers.py,sha256=Ampwe5K7gfE6IJULNCV35V8ysmMOdS_wz7mRzfaLZUw,3014
110
110
  simo/core/middleware.py,sha256=zX6N4P_KR7gG8N2-NcR7jKtuCEhCGRh51g4EktAhP7w,3272
111
- simo/core/models.py,sha256=Nw-XT0v0y5pBYlKKhzoI68HiEMMTp7fqZQZgKmeOW7Q,23752
111
+ simo/core/models.py,sha256=brZPs8clR49VKm_Uo1wgPgCbjkS0fTLvzz3rROBeob4,23211
112
112
  simo/core/permissions.py,sha256=Ef4NO7QwwDd3Z-v61R0BeCBXxTOJz9qBvzRTIB5tHwI,2943
113
113
  simo/core/routing.py,sha256=X1_IHxyA-_Q7hw1udDoviVP4_FSBDl8GYETTC2zWTbY,499
114
114
  simo/core/serializers.py,sha256=adqe8oYP5f7hGFXcxa-Zmce2KOwy3hZOaWE3MaAFtpM,23157
@@ -10933,9 +10933,9 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
10933
10933
  simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10934
10934
  simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10935
10935
  simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10936
- simo-2.8.5.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10937
- simo-2.8.5.dist-info/METADATA,sha256=J6rygMMxiXfeOMVZEhetZjpGJKHF_m2obJCRJ5D7y00,2008
10938
- simo-2.8.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
10939
- simo-2.8.5.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10940
- simo-2.8.5.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10941
- simo-2.8.5.dist-info/RECORD,,
10936
+ simo-2.8.7.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10937
+ simo-2.8.7.dist-info/METADATA,sha256=dVPIZL5FPgcXAwX71CPy_Kz3UPkuye75HRntaWsnm04,2005
10938
+ simo-2.8.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
10939
+ simo-2.8.7.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10940
+ simo-2.8.7.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10941
+ simo-2.8.7.dist-info/RECORD,,
File without changes