simo 2.6.3__py3-none-any.whl → 2.6.5__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
@@ -121,15 +121,18 @@ class PresenceLighting(Script):
121
121
  name = _("Presence lighting")
122
122
  config_form = PresenceLightingConfigForm
123
123
 
124
- # script specific variables
125
- sensors = {}
126
- condition_comps = {}
127
- light_org_values = {}
128
- is_on = False
129
- turn_off_task = None
130
- last_presence = 0
131
- hold_time = 60
132
- conditions = []
124
+ def __init__(self, *args, **kwargs):
125
+ super().__init__(*args, **kwargs)
126
+ # script specific variables
127
+ self.sensors = {}
128
+ self.condition_comps = {}
129
+ self.light_org_values = {}
130
+ self.light_send_values = {}
131
+ self.is_on = False
132
+ self.turn_off_task = None
133
+ self.last_presence = 0
134
+ self.hold_time = 60
135
+ self.conditions = []
133
136
 
134
137
  def _run(self):
135
138
  self.hold_time = self.component.config.get('hold_time', 0) * 10
@@ -174,7 +177,10 @@ class PresenceLighting(Script):
174
177
  self._regulate()
175
178
 
176
179
  def _on_light_change(self, light):
177
- if self.is_on:
180
+ # change original value if it has been changed to something different
181
+ # than this script does.
182
+ if self.is_on and light.value != self.light_send_values[light.id]:
183
+ self.light_send_values[light.id] = light.value
178
184
  self.light_org_values[light.id] = light.value
179
185
 
180
186
  def _regulate(self, on_val_change=True):
@@ -226,8 +232,12 @@ class PresenceLighting(Script):
226
232
  if not comp or not comp.controller:
227
233
  continue
228
234
  self.light_org_values[comp.id] = comp.value
229
- print(f"Send {light_params['on_value']} to {comp}!")
230
- comp.controller.send(light_params['on_value'])
235
+ on_val = light_params['on_value']
236
+ if type(comp.controller.default_value) == bool:
237
+ on_val = bool(on_val)
238
+ print(f"Send {on_val} to {comp}!")
239
+ self.light_send_values[comp.id] = on_val
240
+ comp.controller.send(on_val)
231
241
  return
232
242
 
233
243
  if self.is_on:
simo/automation/forms.py CHANGED
@@ -149,7 +149,7 @@ class ConditionForm(forms.Form):
149
149
  controller_val_type = type(component.controller.default_value)
150
150
  for val in values:
151
151
  val = val.strip()
152
- if controller_val_type == 'bool':
152
+ if controller_val_type == bool:
153
153
  if val.lower() in ('0', 'false', 'none', 'null'):
154
154
  final_val = False
155
155
  else:
@@ -1,3 +1,4 @@
1
+ import os
1
2
  import sys
2
3
  import logging
3
4
  import pytz
@@ -45,6 +46,7 @@ class ScriptRunHandler(multiprocessing.Process):
45
46
  self.logger = get_component_logger(self.component)
46
47
  sys.stdout = StreamToLogger(self.logger, logging.INFO)
47
48
  sys.stderr = StreamToLogger(self.logger, logging.ERROR)
49
+ self.component.meta['pid'] = os.getpid()
48
50
  self.component.set('running')
49
51
 
50
52
  if hasattr(self.component.controller, '_run'):
simo/automation/models.py CHANGED
@@ -16,7 +16,7 @@ def post_script_change(sender, instance, created, **kwargs):
16
16
 
17
17
  def post_update():
18
18
  instance.controller.stop()
19
- if instance.config.get('keep_alive') or instance.config('autostart'):
19
+ if instance.config.get('keep_alive') or instance.config.get('autostart'):
20
20
  time.sleep(2)
21
21
  instance.controller.start()
22
22
 
@@ -1,4 +1,5 @@
1
1
  import time
2
+ import random
2
3
  from django.utils import timezone
3
4
  from simo.core.middleware import get_current_instance
4
5
  from simo.core.models import Component
@@ -52,4 +53,6 @@ class Automation:
52
53
  new_state = get_day_evening_night_morning(
53
54
  self.sun, timezone.localtime()
54
55
  )
55
- print(f"{new_state.upper()}!")
56
+ print(f"{new_state.upper()}!")
57
+ self.state.send(new_state)
58
+ time.sleep(random.randint(60, 120))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simo
3
- Version: 2.6.3
3
+ Version: 2.6.5
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
@@ -8,25 +8,25 @@ simo/__pycache__/__init__.cpython-38.pyc,sha256=j81de0BqHMr6bs0C7cuYrXl7HwtK_vv8
8
8
  simo/__pycache__/asgi.cpython-38.pyc,sha256=5W_YSKOIrRd6NQQuJDuA3Yuj688GzirXVVOyLe8wJIQ,845
9
9
  simo/__pycache__/celeryc.cpython-38.pyc,sha256=eSRoaKwfYlxVaxAiwqpQ2ndEcx7W-VpZtbxRFSV8UYg,1653
10
10
  simo/__pycache__/conf.cpython-38.pyc,sha256=MYP2yk3ULxiYwZsZR6tCLjKnU-z03A3avzQzIn66y3k,273
11
- simo/__pycache__/settings.cpython-38.pyc,sha256=Grz4Vv3nIjPYHWL7mzOBC3KMVB5Cf73cRVmjNBdTCAk,6149
11
+ simo/__pycache__/settings.cpython-38.pyc,sha256=D6M7v6npEvxE6t4ks0xTW-9b6KeK6SzdCtiIM4mfJuE,6149
12
12
  simo/__pycache__/urls.cpython-38.pyc,sha256=u0x6EqT8S1YfDOSPgbI8Kf-RDlveY9OV-EDXMYKAQ7w,2125
13
13
  simo/__pycache__/wsgi.cpython-38.pyc,sha256=TpRxO7VM_ql31hbKphVdanydC5RI1nHB4l0QA2pdWxo,322
14
14
  simo/automation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  simo/automation/app_widgets.py,sha256=gaqImMZjuMHm7nIb9a4D-Y3qipz_WhSPAHXcwGx4Uzs,199
16
- simo/automation/controllers.py,sha256=gIkEOqq7IJ3BoDF40mN2aTGE8_yVwhQrO0RZlJYiYfg,9451
17
- simo/automation/forms.py,sha256=PxvKWKFm59-kItywVAdDxHGrxILxUoUk9QLr3RihVM0,10083
18
- simo/automation/gateways.py,sha256=1ByxQZPDARU006b30ua6unSbp25bcbyw1ETzQXWhrbU,9349
16
+ simo/automation/controllers.py,sha256=pKC8kXiT8mvkLJChl10cdlgmeetG89wsY1xIW5ULvEs,10045
17
+ simo/automation/forms.py,sha256=wJMaXE5ngO_o60jqxnf4Om09q48yXpWwRna0FkQCZYs,10081
18
+ simo/automation/gateways.py,sha256=7r33NOAiRd_RGMMm44i0KYzuAuweQnEF4HxLo-Rpexs,9408
19
19
  simo/automation/helpers.py,sha256=iP-fxxB8HsFQy3k2CjFubu86aMqvWgmh-p24DiyOrek,4330
20
- simo/automation/models.py,sha256=WuziHZ9rTcAnE5eYSDP8DOMu-PJQJROSaEqTBpCJK7o,923
20
+ simo/automation/models.py,sha256=l45FHgeKGsfpLtd1X1PVFpIjB5JI4BlvKkodpcxm6aE,927
21
21
  simo/automation/serializers.py,sha256=PjyFrjdPK1mBsgbNhyqMi9SWzcymqTa742ipy0LhAN4,1996
22
22
  simo/automation/state.py,sha256=aZZvNBae7unnux_zGHCIWCV2z47hVJc-DIL72Hqfkeo,600
23
23
  simo/automation/__pycache__/__init__.cpython-38.pyc,sha256=YmP0xAD-mxpQHgdTZeC64sXChA8TriMZD1jckNYi3xg,164
24
24
  simo/automation/__pycache__/app_widgets.cpython-38.pyc,sha256=7DfUA9V_1MiwrOe_ta-ts8dYY8xXb9UMg2_9A3XoRcs,523
25
- simo/automation/__pycache__/controllers.cpython-38.pyc,sha256=JUQ105NN-9Si1pyCkqn4P_4yQ9NG7OnQfSRBzBaeth4,7535
26
- simo/automation/__pycache__/forms.cpython-38.pyc,sha256=F3jJAdRD3mEY2GGcCeI58UUnWIjTosfklfL2x5sJyA0,7720
27
- simo/automation/__pycache__/gateways.cpython-38.pyc,sha256=UhLcKI2kasoVnGCoe0M0-giBIVkWWuySMjKTgX2FdOs,7502
25
+ simo/automation/__pycache__/controllers.cpython-38.pyc,sha256=oswJRk8WGzzrNpg9S2LMl-zrAKaGxENacFzj6jT_tNI,7889
26
+ simo/automation/__pycache__/forms.cpython-38.pyc,sha256=qxQZeTafJOT_lrXOKY6134XjIrx5OzABAZdncNnRV4E,7720
27
+ simo/automation/__pycache__/gateways.cpython-38.pyc,sha256=W6OrugOLOGaYbibEWSs-zBZc8jQpNlO_NmJU-rmd6fU,7558
28
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
29
+ simo/automation/__pycache__/models.cpython-38.pyc,sha256=6gXdIMcrWaGACal2omj-b2if5JW8QvLIrtRfYVpDRQU,1230
30
30
  simo/automation/__pycache__/serializers.cpython-38.pyc,sha256=gWgcuPE8aY-TmuRLXCuSR74mvtKerpZ04m0MfPfw0AI,3405
31
31
  simo/automation/__pycache__/state.cpython-38.pyc,sha256=TO2IM6h2hbGVlOUcoMwHkDUF4V-54d_KVhcebMgNtCk,784
32
32
  simo/automation/migrations/0001_initial.py,sha256=VB6WIK1RlUdtqlWYCEhtnVE24odp2dfUvOVcxUZPpQ4,990
@@ -36,7 +36,7 @@ simo/automation/migrations/__pycache__/0001_initial.cpython-38.pyc,sha256=yg99vG
36
36
  simo/automation/migrations/__pycache__/0002_update_helpers_in_scripts.cpython-38.pyc,sha256=O-e7CnihMInCHHBBBE6L28LeryhTECLAKQaeu2cFO5g,1039
37
37
  simo/automation/migrations/__pycache__/__init__.cpython-38.pyc,sha256=L2WU6Wk1EXhqcOKUNA9o--Z4G0aTQqwvRhKYxuUooAM,175
38
38
  simo/automation/templates/admin/controller_widgets/script.html,sha256=biUEMo5V35wqSrM97d5WqNDi47GNaDpi53I3YBfDLOs,1484
39
- simo/automation/templates/automations/auto_away.py,sha256=Vd8zixKvF4-ESn02X3fmK0FJIAQUoKEIl9ECdmxof3w,1802
39
+ simo/automation/templates/automations/auto_away.py,sha256=asz9AJ8eLHkxkpvm5phZhUqCNpghd54TKgllmvYkBoM,1911
40
40
  simo/automation/templates/automations/auto_state_script.py,sha256=pEaeKNss7L-PnhlMUpEfNRqCjquq6FAGrjTZ92CMxUY,1001
41
41
  simo/automation/templates/automations/phones_sleep_script.py,sha256=b6JZkfXdhDd3FwDJWq93kxBsm80kNzMGPWAF5jcWTHo,2894
42
42
  simo/backups/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -127,7 +127,7 @@ simo/core/__pycache__/widgets.cpython-38.pyc,sha256=sR0ZeHCHrhnNDBJuRrxp3zUsfBp0
127
127
  simo/core/db_backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
128
128
  simo/core/db_backend/base.py,sha256=wY5jsZ8hQpwot3o-7JNtDe33xy-vlfMLXa011htDojI,601
129
129
  simo/core/db_backend/__pycache__/__init__.cpython-38.pyc,sha256=sxC6PmFqnwe6RRKzSR7QtUFzRc_aRRR1fffsR3TPLRc,169
130
- simo/core/db_backend/__pycache__/base.cpython-38.pyc,sha256=pmAGMpazhXHIsPL5dXdJICmTzyRiiMIWDzHTGhLGoRQ,977
130
+ simo/core/db_backend/__pycache__/base.cpython-38.pyc,sha256=mJMgw02ZMTB10eepCKgJhEWILAKdRFEX35Dt_1GOWhQ,977
131
131
  simo/core/drf_braces/README,sha256=sYqsYB38WGwrU_zg1ttz7Gv69wElhY9aP8VhCsb9AsU,126
132
132
  simo/core/drf_braces/__init__.py,sha256=YW_TchAczdYPAsb4DIJcKXU7qSUHF3T--Q6OW4YDybc,194
133
133
  simo/core/drf_braces/mixins.py,sha256=yIquEvCDuji1vf76hkzz3Q_DBuldXe64k4Sq2DD-dYI,1624
@@ -189,7 +189,7 @@ simo/core/management/commands/gateways_manager.py,sha256=oHzgC-eV4w_KHkiz6eCAlt3
189
189
  simo/core/management/commands/on_http_start.py,sha256=A2V40pyGY7AfONhtnxiGATOkqd0i9FUvRRxkwyAJF9k,2252
190
190
  simo/core/management/commands/run_gateway.py,sha256=bp0FQQoBeOSoxjHCCMicDL1fxPZZGyLgnq2QKht3bJo,645
191
191
  simo/core/management/commands/__pycache__/__init__.cpython-38.pyc,sha256=WKpfZZpAB9D7U4X6oWQIrU_H-6rUmq8Gl9fj9XaY2fw,178
192
- simo/core/management/commands/__pycache__/gateways_manager.cpython-38.pyc,sha256=g5xhLz6AgU7cGZ5EmoiBZIZuZbs9AN01ZRZEOCEFqeE,6031
192
+ simo/core/management/commands/__pycache__/gateways_manager.cpython-38.pyc,sha256=ijlkNjiMXKNI_81RZJLLGG4dWvLQglOrOYt5zC5WbrQ,6031
193
193
  simo/core/management/commands/__pycache__/on_http_start.cpython-38.pyc,sha256=LQeFW3oYYRrEPEcGghyeahFE114-4VbnKH4XaVGcQcg,3235
194
194
  simo/core/migrations/0001_initial.py,sha256=0Uy7IqJxQQYlurs8Mw_RJy7NaWS7BU0VFmZBBz8YkQI,9220
195
195
  simo/core/migrations/0002_load_icons.py,sha256=s9TtGo5NWEyWV3BspfbDNAlWqmQWxmDj7GjEaJXruFk,2044
@@ -10599,9 +10599,9 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
10599
10599
  simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10600
10600
  simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10601
10601
  simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
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,,
10602
+ simo-2.6.5.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10603
+ simo-2.6.5.dist-info/METADATA,sha256=bqH7ricDLu2pweU223qNedu6xRzUm130-ZOrO192p9g,1952
10604
+ simo-2.6.5.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
10605
+ simo-2.6.5.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10606
+ simo-2.6.5.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10607
+ simo-2.6.5.dist-info/RECORD,,
File without changes