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

@@ -1,7 +1,23 @@
1
+ # execute this on every program start
2
+ [program:simo-start]
3
+ directory={{ project_dir }}/hub/
4
+ command={{ venv_path }}/python manage.py on_http_start
5
+ process_name=%(program_name)s
6
+ user=root
7
+ stdout_logfile=/var/log/simo/start.log
8
+ stdout_logfile_maxbytes=1MB
9
+ stdout_logfile_backups=3
10
+ redirect_stderr=true
11
+ autostart=true
12
+ autorestart=false
13
+ stopwaitsecs=15
14
+ killasgroup=true
15
+
16
+
1
17
  # using gunicorn for regular requests
2
18
  [program:simo-gunicorn]
3
19
  directory={{ project_dir }}/hub/
4
- command=/bin/sh -c "{{ venv_path }}/python manage.py on_http_start && {{ venv_path }}/gunicorn --workers 4 --timeout 120 --bind unix:/tmp/gunicorn.sock wsgi:application"
20
+ command={{ venv_path }}/gunicorn --workers 2 --timeout 120 --bind unix:/tmp/gunicorn.sock wsgi:application
5
21
  process_name=%(program_name)s
6
22
  user=root
7
23
  stdout_logfile=/var/log/simo/gunicorn.log
@@ -10,9 +26,8 @@ stdout_logfile_backups=3
10
26
  redirect_stderr=true
11
27
  autostart=true
12
28
  autorestart=true
13
- stopasgroup=true
29
+ stopwaitsecs=15
14
30
  killasgroup=true
15
- stopsignal=INT
16
31
 
17
32
 
18
33
  # using daphne for socket connections routed to /ws/ on nginx.conf
@@ -27,7 +42,7 @@ stdout_logfile_backups=3
27
42
  redirect_stderr=true
28
43
  autostart=true
29
44
  autorestart=true
30
- stopasgroup=true
45
+ stopwaitsecs=15
31
46
  killasgroup=true
32
47
 
33
48
 
@@ -43,9 +58,10 @@ stdout_logfile_backups=3
43
58
  redirect_stderr=true
44
59
  autostart=true
45
60
  autorestart=true
46
- stopasgroup=true
61
+ stopwaitsecs=15
47
62
  killasgroup=true
48
63
 
64
+
49
65
  [program:simo-celery-beat]
50
66
  directory={{ project_dir }}/hub/
51
67
  command={{ venv_path }}/celery -A celeryc.celery_app beat -l info --pidfile="/var/run/celerybeat.pid"
@@ -57,6 +73,9 @@ stdout_logfile_backups=3
57
73
  redirect_stderr=true
58
74
  autostart=true
59
75
  autorestart=true
76
+ stopwaitsecs=15
77
+ killasgroup=true
78
+
60
79
 
61
80
  [program:simo-celery-worker]
62
81
  directory={{ project_dir }}/hub/
@@ -69,3 +88,5 @@ stdout_logfile_backups=3
69
88
  redirect_stderr=true
70
89
  autostart=true
71
90
  autorestart=true
91
+ stopwaitsecs=15
92
+ killasgroup=false
simo/core/tasks.py CHANGED
@@ -270,18 +270,46 @@ def sync_with_remote():
270
270
  @celery_app.task
271
271
  def clear_history():
272
272
  for instance in Instance.objects.all():
273
+ print(f"Clear history of {instance}")
273
274
  old_times = timezone.now() - datetime.timedelta(
274
275
  days=instance.history_days
275
276
  )
276
277
  ComponentHistory.objects.filter(
277
278
  component__zone__instance=instance, date__lt=old_times
278
279
  ).delete()
280
+ i = 0
281
+ delete_ids = []
282
+ for obj in ComponentHistory.objects.filter(
283
+ component__zone__instance=instance
284
+ ).order_by('-date').values('id').iterator():
285
+ if i < 5000:
286
+ continue
287
+ delete_ids.append(obj['id'])
288
+ ComponentHistory.objects.filter(id__in=delete_ids)
279
289
  HistoryAggregate.objects.filter(
280
290
  component__zone__instance=instance, start__lt=old_times
281
291
  ).delete()
292
+ i = 0
293
+ delete_ids = []
294
+ for obj in HistoryAggregate.objects.filter(
295
+ component__zone__instance=instance
296
+ ).order_by('-start').values('id').iterator():
297
+ if i < 1000:
298
+ continue
299
+ delete_ids.append(obj['id'])
300
+ HistoryAggregate.objects.filter(id__in=delete_ids)
282
301
  Action.objects.filter(
283
302
  data__instance_id=instance.id, timestamp__lt=old_times
284
303
  )
304
+ i = 0
305
+ delete_ids = []
306
+ for obj in Action.objects.filter(
307
+ data__instance_id=instance.id
308
+ ).order_by('-timestamp').values('id').iterator():
309
+ if i < 5000:
310
+ continue
311
+ delete_ids.append(obj['id'])
312
+ Action.objects.filter(id__in=delete_ids)
285
313
 
286
314
 
287
315
  @celery_app.task
@@ -343,6 +371,7 @@ def update():
343
371
  @celery_app.task
344
372
  def drop_fingerprints_learn():
345
373
  Instance.objects.filter(
374
+ is_active=True,
346
375
  learn_fingerprints__isnull=False,
347
376
  learn_fingerprints_start__lt=timezone.now() - datetime.timedelta(minutes=5)
348
377
  ).update(
@@ -376,7 +405,7 @@ def restart_postgresql():
376
405
  def low_battery_notifications():
377
406
  from simo.users.models import User
378
407
  from simo.notifications.utils import notify_users
379
- for instance in Instance.objects.all():
408
+ for instance in Instance.objects.filter(is_active=True):
380
409
  timezone.activate(instance.timezone)
381
410
  if timezone.localtime().hour != 10:
382
411
  continue
Binary file
simo/users/api.py CHANGED
@@ -219,6 +219,7 @@ class UserDeviceReport(InstanceMixin, viewsets.GenericViewSet):
219
219
  ).exclude(id=user_device.id).update(is_primary=False)
220
220
  user_device.save()
221
221
 
222
+ speed_kmh = 0
222
223
  for iu in request.user.instance_roles.filter(is_active=True):
223
224
  if location:
224
225
  iu.at_home = haversine_distance(
@@ -226,7 +227,7 @@ class UserDeviceReport(InstanceMixin, viewsets.GenericViewSet):
226
227
  ) < dynamic_settings['users__at_home_radius']
227
228
  elif not relay:
228
229
  iu.at_home = True
229
- speed_kmh = 0
230
+
230
231
  if user_device.last_seen_location and iu.last_seen_location \
231
232
  and iu.last_seen > timezone.now() - datetime.timedelta(seconds=30):
232
233
  if user_device.last_seen_location == iu.last_seen_location:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simo
3
- Version: 2.5.6
3
+ Version: 2.5.8
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
@@ -59,7 +59,7 @@ simo/core/serializers.py,sha256=Pa2lhJ6VgNalbH4awbKdGJCYAPNsu5WQWfo6Tz6LbOQ,2078
59
59
  simo/core/signal_receivers.py,sha256=qCpzEUv5Bl9--K8fe08GVDmE6EBOj292YBia1TYDdSE,9267
60
60
  simo/core/socket_consumers.py,sha256=trRZvBGTJ7xIbfdmVvn7zoiWp_qssSkMZykDrI5YQyE,9783
61
61
  simo/core/storage.py,sha256=_5igjaoWZAiExGWFEJMElxUw55DzJG1jqFty33xe8BE,342
62
- simo/core/tasks.py,sha256=dLutVjQdAhZVFldQpWilQEYfPcTFqkAoyGao0MTuKJ0,14583
62
+ simo/core/tasks.py,sha256=6Srcsq1szv7pU74Qp-Y4GUoRjvNPJI81jKsSWxqVcb8,15671
63
63
  simo/core/todos.py,sha256=eYVXfLGiapkxKK57XuviSNe3WsUYyIWZ0hgQJk7ThKo,665
64
64
  simo/core/types.py,sha256=WJEq48mIbFi_5Alt4wxWMGXxNxUTXqfQU5koH7wqHHI,1108
65
65
  simo/core/views.py,sha256=3SRZr00fyLQf8ja3U-9eekKt-ld5TvU1WQqUWprXfQ4,2390
@@ -153,7 +153,7 @@ simo/core/management/_hub_template/hub/celeryc.py,sha256=3ksDXftIZKJ4Cq9WNKJERdZ
153
153
  simo/core/management/_hub_template/hub/manage.py,sha256=PNNlw3EVeIJDgkG0l-klqoxsKWfTYWG9jzRG0upmAaI,620
154
154
  simo/core/management/_hub_template/hub/nginx.conf,sha256=40hvXL42MeiqqkLURNcDQsRudv1dNFLJnvb2-Y3RCkk,2394
155
155
  simo/core/management/_hub_template/hub/settings.py,sha256=4QhvhbtLRxHvAntwqG_qeAAtpDUqKvN4jzw9u3vqff8,361
156
- simo/core/management/_hub_template/hub/supervisor.conf,sha256=6WemJ19T-mLiVGkQdfBxD3Y7UhU6exT0jizOwg2VQAk,2006
156
+ simo/core/management/_hub_template/hub/supervisor.conf,sha256=7oqtr3p8rUervmwdfMNdscpPPCTLCFgrn2W_ak7g0yk,2362
157
157
  simo/core/management/_hub_template/hub/urls.py,sha256=Ydm-1BkYAzWeEF-MKSDIFf-7aE4qNLPm48-SA51XgJQ,25
158
158
  simo/core/management/_hub_template/hub/wsgi.py,sha256=Lo-huLHnMDTxSmMBOodVFMWBls9poddrV2KRzXU0xGo,280
159
159
  simo/core/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -10433,7 +10433,7 @@ simo/notifications/migrations/__pycache__/0002_notification_instance.cpython-38.
10433
10433
  simo/notifications/migrations/__pycache__/__init__.cpython-38.pyc,sha256=YMBRHVon2nWDtIUbghckjnC12sIg_ykPWhV5aM0tto4,178
10434
10434
  simo/users/__init__.py,sha256=6a7uBpCWB_DR7p54rbHusc0xvi1qfT1ZCCQGb6TiBh8,52
10435
10435
  simo/users/admin.py,sha256=Xr7faGeupUKkpo1QLRm84OS63u-5Rf2ir_nVEaAPBZw,6839
10436
- simo/users/api.py,sha256=JIjSCg_VOkYRYoKJrc9svJ1NpTuQjONX_sGnZ-am1sQ,12825
10436
+ simo/users/api.py,sha256=8MpsNiN_Cl8301iEf8KHCmzmmId1mivtSJKEj93y7Uk,12822
10437
10437
  simo/users/apps.py,sha256=cq0A8-U1HALEwev0TicgFhr4CAu7Icz8rwq0HfOaL4E,207
10438
10438
  simo/users/auth_backends.py,sha256=bBSNXQJ88TRXaQxyh1aETfmOIfiDr08Jnj8rSY9sHDk,4074
10439
10439
  simo/users/auto_urls.py,sha256=lcJvteBsbHQMJieZpDz-63tDYejLApqsW3CUnDakd7k,272
@@ -10450,7 +10450,7 @@ simo/users/utils.py,sha256=1HGSZyHRqQvdJ4RtAiZDg1juvgG8aOlrGXR7CcvsyQc,1886
10450
10450
  simo/users/views.py,sha256=dOQVvmlHG7ihWKJLFUBcqKOA0UDctlMKR0pTc36JZqg,3487
10451
10451
  simo/users/__pycache__/__init__.cpython-38.pyc,sha256=VFoDJE_SKKaPqqYaaBYd1Ndb1hjakkTo_u0EG_XJ1GM,211
10452
10452
  simo/users/__pycache__/admin.cpython-38.pyc,sha256=tL8b3f181AjcN2dSsDUPkqjpZziEOtVzI535SbnbDzc,7793
10453
- simo/users/__pycache__/api.cpython-38.pyc,sha256=M49GlN1f-IMXKpokLJVxcfVmXYxPneXQ9z9v0RFysQk,10411
10453
+ simo/users/__pycache__/api.cpython-38.pyc,sha256=OF-wQagTY0z45X7pjO7YiYX1kz4jkYagTpLHq1BUyyY,10411
10454
10454
  simo/users/__pycache__/apps.cpython-38.pyc,sha256=dgbWL8CxzzISJQTmq_4IztPJ2UzykNVdqA2Ae1PmeGk,605
10455
10455
  simo/users/__pycache__/auth_backends.cpython-38.pyc,sha256=n5nx2QSXNj2idzRcGE6bAagMN-8qxoCs580H1EFZXls,3105
10456
10456
  simo/users/__pycache__/auto_urls.cpython-38.pyc,sha256=K-3sz2h-cEitoflSmZk1t0eUg5mQMMGLNZFREVwG7_o,430
@@ -10551,9 +10551,9 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
10551
10551
  simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10552
10552
  simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10553
10553
  simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10554
- simo-2.5.6.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10555
- simo-2.5.6.dist-info/METADATA,sha256=Q8JlXRCVfWvw15jO8jXZp65dGIWYlLNfz4u8gNIA5NI,1923
10556
- simo-2.5.6.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
10557
- simo-2.5.6.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10558
- simo-2.5.6.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10559
- simo-2.5.6.dist-info/RECORD,,
10554
+ simo-2.5.8.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10555
+ simo-2.5.8.dist-info/METADATA,sha256=MS1IN9xaTOEDIMAGVtan3qT0-ejhkz04LhraYddcASA,1923
10556
+ simo-2.5.8.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
10557
+ simo-2.5.8.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10558
+ simo-2.5.8.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10559
+ simo-2.5.8.dist-info/RECORD,,
File without changes