simo 2.5.29__py3-none-any.whl → 2.5.30__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/generic/__pycache__/gateways.cpython-38.pyc +0 -0
- simo/generic/gateways.py +65 -53
- simo/users/__pycache__/admin.cpython-38.pyc +0 -0
- simo/users/admin.py +1 -1
- simo/users/migrations/0039_auto_20241117_1039.py +3 -1
- simo/users/migrations/__pycache__/0039_auto_20241117_1039.cpython-38.pyc +0 -0
- {simo-2.5.29.dist-info → simo-2.5.30.dist-info}/METADATA +1 -1
- {simo-2.5.29.dist-info → simo-2.5.30.dist-info}/RECORD +12 -12
- {simo-2.5.29.dist-info → simo-2.5.30.dist-info}/LICENSE.md +0 -0
- {simo-2.5.29.dist-info → simo-2.5.30.dist-info}/WHEEL +0 -0
- {simo-2.5.29.dist-info → simo-2.5.30.dist-info}/entry_points.txt +0 -0
- {simo-2.5.29.dist-info → simo-2.5.30.dist-info}/top_level.txt +0 -0
|
Binary file
|
simo/generic/gateways.py
CHANGED
|
@@ -130,6 +130,8 @@ class GenericGatewayHandler(BaseObjectCommandsGatewayHandler):
|
|
|
130
130
|
('watch_timers', 1)
|
|
131
131
|
)
|
|
132
132
|
|
|
133
|
+
terminating_scripts = set()
|
|
134
|
+
|
|
133
135
|
def watch_thermostats(self):
|
|
134
136
|
from .controllers import Thermostat
|
|
135
137
|
drop_current_instance()
|
|
@@ -152,31 +154,25 @@ class GenericGatewayHandler(BaseObjectCommandsGatewayHandler):
|
|
|
152
154
|
alarm_clock.tick()
|
|
153
155
|
|
|
154
156
|
def watch_scripts(self):
|
|
155
|
-
# observe running scripts and drop the ones that are no longer alive
|
|
156
157
|
drop_current_instance()
|
|
157
|
-
|
|
158
|
-
|
|
158
|
+
# observe running scripts and drop the ones that are no longer alive
|
|
159
|
+
dead_scripts = False
|
|
160
|
+
for id, process in list(self.running_scripts.items()):
|
|
161
|
+
comp = Component.objects.filter(id=id).first()
|
|
159
162
|
if process.is_alive():
|
|
160
|
-
if not
|
|
163
|
+
if not comp and id not in self.terminating_scripts:
|
|
161
164
|
# script is deleted, or instance deactivated
|
|
162
|
-
process.
|
|
165
|
+
process.kill()
|
|
163
166
|
continue
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
for id in dead_processes:
|
|
175
|
-
self.running_scripts.pop(id)
|
|
176
|
-
|
|
177
|
-
if dead_processes:
|
|
178
|
-
# give 10s of air before we restart the scripts what were
|
|
179
|
-
# detected to be dead.
|
|
167
|
+
else:
|
|
168
|
+
if id not in self.terminating_scripts:
|
|
169
|
+
dead_scripts = True
|
|
170
|
+
logger = get_component_logger(comp)
|
|
171
|
+
logger.log(logging.INFO, "-------DEAD!-------")
|
|
172
|
+
self.stop_script(comp, 'error')
|
|
173
|
+
|
|
174
|
+
if dead_scripts:
|
|
175
|
+
# give 10s air before we wake these dead scripts up!
|
|
180
176
|
return
|
|
181
177
|
|
|
182
178
|
from simo.generic.controllers import Script
|
|
@@ -291,52 +287,68 @@ class GenericGatewayHandler(BaseObjectCommandsGatewayHandler):
|
|
|
291
287
|
def start_script(self, component):
|
|
292
288
|
print("START SCRIPT %s" % str(component))
|
|
293
289
|
if component.id in self.running_scripts:
|
|
294
|
-
if
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
290
|
+
if component.id not in self.terminating_scripts:
|
|
291
|
+
if component.value != 'running':
|
|
292
|
+
component.value = 'running'
|
|
293
|
+
component.save()
|
|
294
|
+
return
|
|
295
|
+
else:
|
|
296
|
+
good_to_go = False
|
|
297
|
+
for i in range(12): # wait for 3s
|
|
298
|
+
time.sleep(0.2)
|
|
299
|
+
component.refresh_from_db()
|
|
300
|
+
if component.id not in self.running_scripts:
|
|
301
|
+
good_to_go = True
|
|
302
|
+
break
|
|
303
|
+
if not good_to_go:
|
|
304
|
+
return self.stop_script(component, 'error')
|
|
305
|
+
|
|
298
306
|
self.running_scripts[component.id] = ScriptRunHandler(
|
|
299
307
|
component.id, daemon=True
|
|
300
308
|
)
|
|
301
309
|
self.running_scripts[component.id].start()
|
|
302
310
|
|
|
303
311
|
def stop_script(self, component, stop_status='stopped'):
|
|
312
|
+
self.terminating_scripts.add(component.id)
|
|
304
313
|
if component.id not in self.running_scripts:
|
|
305
314
|
if component.value == 'running':
|
|
306
315
|
component.value = stop_status
|
|
307
316
|
component.save(update_fields=['value'])
|
|
308
317
|
return
|
|
309
|
-
if self.running_scripts[component.id].is_alive():
|
|
310
|
-
tz = pytz.timezone(component.zone.instance.timezone)
|
|
311
|
-
timezone.activate(tz)
|
|
312
|
-
logger = get_component_logger(component)
|
|
313
|
-
if stop_status == 'error':
|
|
314
|
-
logger.log(logging.INFO, "-------GATEWAY STOP-------")
|
|
315
|
-
else:
|
|
316
|
-
logger.log(logging.INFO, "-------STOP-------")
|
|
317
|
-
self.running_scripts[component.id].terminate()
|
|
318
318
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
319
|
+
tz = pytz.timezone(component.zone.instance.timezone)
|
|
320
|
+
timezone.activate(tz)
|
|
321
|
+
logger = get_component_logger(component)
|
|
322
|
+
if stop_status == 'error':
|
|
323
|
+
logger.log(logging.INFO, "-------GATEWAY STOP-------")
|
|
324
|
+
else:
|
|
325
|
+
logger.log(logging.INFO, "-------STOP-------")
|
|
326
|
+
self.running_scripts[component.id].terminate()
|
|
327
|
+
|
|
328
|
+
def kill():
|
|
329
|
+
start = time.time()
|
|
330
|
+
terminated = False
|
|
331
|
+
while start > time.time() - 2:
|
|
332
|
+
if not self.running_scripts[component.id].is_alive():
|
|
333
|
+
terminated = True
|
|
334
|
+
break
|
|
335
|
+
time.sleep(0.1)
|
|
336
|
+
if not terminated:
|
|
337
|
+
if stop_status == 'error':
|
|
338
|
+
logger.log(logging.INFO, "-------GATEWAY KILL-------")
|
|
339
|
+
else:
|
|
340
|
+
logger.log(logging.INFO, "-------KILL!-------")
|
|
341
|
+
self.running_scripts[component.id].kill()
|
|
333
342
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
343
|
+
component.value = stop_status
|
|
344
|
+
component.save(update_fields=['value'])
|
|
345
|
+
self.terminating_scripts.remove(component.id)
|
|
346
|
+
# making sure it's fully killed along with it's child processes
|
|
347
|
+
self.running_scripts[component.id].kill()
|
|
348
|
+
self.running_scripts.pop(component.id, None)
|
|
349
|
+
logger.handlers = []
|
|
338
350
|
|
|
339
|
-
|
|
351
|
+
threading.Thread(target=kill, daemon=True).start()
|
|
340
352
|
|
|
341
353
|
def control_alarm_group(self, alarm_group, value):
|
|
342
354
|
from simo.generic.controllers import AlarmGroup
|
|
Binary file
|
simo/users/admin.py
CHANGED
|
@@ -134,7 +134,7 @@ class UserDeviceLog(admin.ModelAdmin):
|
|
|
134
134
|
'speed_kmh', 'phone_on_charge'
|
|
135
135
|
)
|
|
136
136
|
list_display = (
|
|
137
|
-
'datetime', 'app_open', 'location', 'relay', 'speed_kmh',
|
|
137
|
+
'datetime', 'at_home', 'app_open', 'location', 'relay', 'speed_kmh',
|
|
138
138
|
'phone_on_charge', 'users'
|
|
139
139
|
)
|
|
140
140
|
fields = readonly_fields
|
|
@@ -7,7 +7,9 @@ def forwards_func(apps, schema_editor):
|
|
|
7
7
|
from simo.generic.scripting.helpers import haversine_distance
|
|
8
8
|
UserDeviceReportLog = apps.get_model("users", "UserDeviceReportLog")
|
|
9
9
|
|
|
10
|
-
logs = UserDeviceReportLog.objects.
|
|
10
|
+
logs = UserDeviceReportLog.objects.filter(
|
|
11
|
+
instance__isnull=False
|
|
12
|
+
).select_related('instance')
|
|
11
13
|
|
|
12
14
|
print("Calculate at_home on UserDeviceReportLog's!")
|
|
13
15
|
|
|
Binary file
|
|
@@ -10344,7 +10344,7 @@ simo/generic/app_widgets.py,sha256=TPRLj4hri2hBuY6mrdwBiv-01z2hDxZmsup-GDD9LrM,9
|
|
|
10344
10344
|
simo/generic/base_types.py,sha256=u3SlfpNYaCwkVBwomWgso4ODzL71ay9MhiAW-bxgnDU,341
|
|
10345
10345
|
simo/generic/controllers.py,sha256=i-xKQ5PrNKwCuO0dFaHHUaD5rF9lDnq18ziVSNBENao,50134
|
|
10346
10346
|
simo/generic/forms.py,sha256=tCbIZtbruBHjZRzulGXJQOjmxaGJ2uoKqjT1scScdDQ,29004
|
|
10347
|
-
simo/generic/gateways.py,sha256=
|
|
10347
|
+
simo/generic/gateways.py,sha256=0gDjWSCAt6MABR6k8xV7N1zXutDLCileGtAm6pSl4Q4,16165
|
|
10348
10348
|
simo/generic/models.py,sha256=Adq7ipWK-renxJlNW-SZnAq2oGEOwKx8EdUWaKnfcVQ,7597
|
|
10349
10349
|
simo/generic/routing.py,sha256=elQVZmgnPiieEuti4sJ7zITk1hlRxpgbotcutJJgC60,228
|
|
10350
10350
|
simo/generic/socket_consumers.py,sha256=K2OjphIhKJH48BvfFfoCOyCQZ1NmXb_phs6y1IP-qaQ,1757
|
|
@@ -10353,7 +10353,7 @@ simo/generic/__pycache__/app_widgets.cpython-38.pyc,sha256=YZ5db6-FPynBi6ooPW5cr
|
|
|
10353
10353
|
simo/generic/__pycache__/base_types.cpython-38.pyc,sha256=aV5NdIuvXR-ItKpI__MwcyPZHD6Z882TFdgYkPCkr1I,493
|
|
10354
10354
|
simo/generic/__pycache__/controllers.cpython-38.pyc,sha256=-Y3fV0gbkye9WgWpdNY7qG9VvMWpFUT7Spl1eukztgQ,33352
|
|
10355
10355
|
simo/generic/__pycache__/forms.cpython-38.pyc,sha256=Dd-hgbRNdIFzUDjSZ4yQp7wwR-ILBYQFI8MCob_ZYwQ,21232
|
|
10356
|
-
simo/generic/__pycache__/gateways.cpython-38.pyc,sha256=
|
|
10356
|
+
simo/generic/__pycache__/gateways.cpython-38.pyc,sha256=uubZtp-UgEmKU4vG9ophnCZFEDqmKkeY1yyWUXzdmdY,12015
|
|
10357
10357
|
simo/generic/__pycache__/models.cpython-38.pyc,sha256=MZpum7syAFxuulf47K7gtUlJJ7xRD-IBUBAwUM1ZRnw,5825
|
|
10358
10358
|
simo/generic/__pycache__/routing.cpython-38.pyc,sha256=xtxTUTBTdivzFyA5Wh7k-hUj1WDO_FiRq6HYXdbr9Ks,382
|
|
10359
10359
|
simo/generic/__pycache__/socket_consumers.cpython-38.pyc,sha256=qJO5kvQLWhsQDOr1AtAtsAybuRWioxSkQei3Pc7rdP0,1737
|
|
@@ -10444,7 +10444,7 @@ simo/notifications/migrations/__pycache__/0002_notification_instance.cpython-38.
|
|
|
10444
10444
|
simo/notifications/migrations/__pycache__/0003_alter_notification_instance.cpython-38.pyc,sha256=awhD1F9RyK_706zVNM5io3WT_konFkKQgL7D5MkONwk,851
|
|
10445
10445
|
simo/notifications/migrations/__pycache__/__init__.cpython-38.pyc,sha256=YMBRHVon2nWDtIUbghckjnC12sIg_ykPWhV5aM0tto4,178
|
|
10446
10446
|
simo/users/__init__.py,sha256=6a7uBpCWB_DR7p54rbHusc0xvi1qfT1ZCCQGb6TiBh8,52
|
|
10447
|
-
simo/users/admin.py,sha256=
|
|
10447
|
+
simo/users/admin.py,sha256=2Ay47b1NWBfdUpMZ8qUFAbwiu7-P3JNxNpM7FKVwrLw,6987
|
|
10448
10448
|
simo/users/api.py,sha256=pWmP201jyz7_KCC_c8Fsrnh1R0HoCkcHfwu4LYCIRfg,12373
|
|
10449
10449
|
simo/users/apps.py,sha256=cq0A8-U1HALEwev0TicgFhr4CAu7Icz8rwq0HfOaL4E,207
|
|
10450
10450
|
simo/users/auth_backends.py,sha256=KIw2AdjCUKfm_7Lql6aC4qdE6JznP0ECIMA5MVMLeiM,4251
|
|
@@ -10461,7 +10461,7 @@ simo/users/tasks.py,sha256=HJAqiyWGsaN3wSfquU0UyQ20jL-njXeaaTOdDT3TQ3s,979
|
|
|
10461
10461
|
simo/users/utils.py,sha256=1HGSZyHRqQvdJ4RtAiZDg1juvgG8aOlrGXR7CcvsyQc,1886
|
|
10462
10462
|
simo/users/views.py,sha256=dOQVvmlHG7ihWKJLFUBcqKOA0UDctlMKR0pTc36JZqg,3487
|
|
10463
10463
|
simo/users/__pycache__/__init__.cpython-38.pyc,sha256=VFoDJE_SKKaPqqYaaBYd1Ndb1hjakkTo_u0EG_XJ1GM,211
|
|
10464
|
-
simo/users/__pycache__/admin.cpython-38.pyc,sha256
|
|
10464
|
+
simo/users/__pycache__/admin.cpython-38.pyc,sha256=-TXB5LGoAvCfgNhsqaB-1pgyyfW8lbuGcgD8F4HZojk,7947
|
|
10465
10465
|
simo/users/__pycache__/api.cpython-38.pyc,sha256=4JQ61L-i0GXtnqlGgZfoHHQX9bd8xJc9kkEmvjHC_-Q,10172
|
|
10466
10466
|
simo/users/__pycache__/apps.cpython-38.pyc,sha256=dgbWL8CxzzISJQTmq_4IztPJ2UzykNVdqA2Ae1PmeGk,605
|
|
10467
10467
|
simo/users/__pycache__/auth_backends.cpython-38.pyc,sha256=jYS2hlbTZh_ZtPeWcN50pc0IpyfCSO7_MvIbuVwEp8M,3144
|
|
@@ -10515,7 +10515,7 @@ simo/users/migrations/0035_instanceuser_last_seen_speed_kmh_and_more.py,sha256=l
|
|
|
10515
10515
|
simo/users/migrations/0036_instanceuser_phone_on_charge_user_phone_on_charge.py,sha256=uHXLRmFAASdB9sPivYkRu7WV4rxZDI3RaEwl2i7U_xg,615
|
|
10516
10516
|
simo/users/migrations/0037_rename_last_seen_location_datetime_instanceuser_last_seen_and_more.py,sha256=8f_7fC7k0Dm-0gGVHMI9_490BbEC_SfuAPrAADrZ7BA,1543
|
|
10517
10517
|
simo/users/migrations/0038_userdevicereportlog_at_home_and_more.py,sha256=qL1ZjUJDiSrJat59ToqpNBwnMMPb3Q5mwHq-qd1eFcI,691
|
|
10518
|
-
simo/users/migrations/0039_auto_20241117_1039.py,sha256=
|
|
10518
|
+
simo/users/migrations/0039_auto_20241117_1039.py,sha256=e64AJM2ZId516Px-gmAxkp2NmSC5Vjo_BBTGbYrFuKY,1310
|
|
10519
10519
|
simo/users/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10520
10520
|
simo/users/migrations/__pycache__/0001_initial.cpython-38.pyc,sha256=e4XOKaYRb7l0P7cBnHHi5FQQJMlwjK0g7iqgM-xKmNI,4215
|
|
10521
10521
|
simo/users/migrations/__pycache__/0002_componentpermission.cpython-38.pyc,sha256=pknJnpic8p6Vdx9DX41FfODXNnvexDswJtUCmC5w1tg,995
|
|
@@ -10557,7 +10557,7 @@ simo/users/migrations/__pycache__/0035_instanceuser_last_seen_speed_kmh_and_more
|
|
|
10557
10557
|
simo/users/migrations/__pycache__/0036_instanceuser_phone_on_charge_user_phone_on_charge.cpython-38.pyc,sha256=y1ZDJ8VM5_vJOxTPRERjwukiGXJ89UhDc4bHiHZwQ_w,723
|
|
10558
10558
|
simo/users/migrations/__pycache__/0037_rename_last_seen_location_datetime_instanceuser_last_seen_and_more.cpython-38.pyc,sha256=W4Rc6SRNNJ_yAYrEyoklD5LFmQPAL9mTDrXHMfP8R4I,1162
|
|
10559
10559
|
simo/users/migrations/__pycache__/0038_userdevicereportlog_at_home_and_more.cpython-38.pyc,sha256=khDSeTH3-jJ4yO1D6-i3Pm_NekJkVwBSUJ-rAxu0cr4,836
|
|
10560
|
-
simo/users/migrations/__pycache__/0039_auto_20241117_1039.cpython-38.pyc,sha256=
|
|
10560
|
+
simo/users/migrations/__pycache__/0039_auto_20241117_1039.cpython-38.pyc,sha256=IEOIfvnUiV-GX9VI4W2UKJugC3nfwKfy7QdmS3pW6Ss,1377
|
|
10561
10561
|
simo/users/migrations/__pycache__/__init__.cpython-38.pyc,sha256=NKq7WLgktK8WV1oOqCPbAbdkrPV5GRGhYx4VxxI4dcs,170
|
|
10562
10562
|
simo/users/templates/conf/mosquitto.conf,sha256=1eIGNuRu4Y3hfAU6qiWix648eCRrw0oOT24PnyFI4ys,189
|
|
10563
10563
|
simo/users/templates/conf/mosquitto_acls.conf,sha256=ga44caTDNQE0CBKw55iM2jOuna6-9fKGwAhjyERZdRE,500
|
|
@@ -10567,9 +10567,9 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
|
|
|
10567
10567
|
simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10568
10568
|
simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10569
10569
|
simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10570
|
-
simo-2.5.
|
|
10571
|
-
simo-2.5.
|
|
10572
|
-
simo-2.5.
|
|
10573
|
-
simo-2.5.
|
|
10574
|
-
simo-2.5.
|
|
10575
|
-
simo-2.5.
|
|
10570
|
+
simo-2.5.30.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
|
|
10571
|
+
simo-2.5.30.dist-info/METADATA,sha256=rnYLYWnVpPGB86Gmr15dmR9wmv--Q42fKSUK_3Uu6iI,1953
|
|
10572
|
+
simo-2.5.30.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
10573
|
+
simo-2.5.30.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
|
|
10574
|
+
simo-2.5.30.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
|
|
10575
|
+
simo-2.5.30.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|