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

@@ -12,6 +12,7 @@ autostart=true
12
12
  autorestart=false
13
13
  stopwaitsecs=15
14
14
  killasgroup=true
15
+ environment=PYTHONUNBUFFERED=1
15
16
 
16
17
 
17
18
  # using gunicorn for regular requests
@@ -60,6 +61,7 @@ autostart=true
60
61
  autorestart=true
61
62
  stopwaitsecs=15
62
63
  killasgroup=true
64
+ environment=PYTHONUNBUFFERED=1
63
65
 
64
66
 
65
67
  [program:simo-gateways]
@@ -76,14 +78,15 @@ autorestart=true
76
78
  stopwaitsecs=15
77
79
  killasgroup=true
78
80
  stopsignal=INT
81
+ environment=PYTHONUNBUFFERED=1
79
82
 
80
83
 
81
- [program:simo-app-mqtt]
84
+ [program:simo-mqtt-control]
82
85
  directory={{ project_dir }}/hub/
83
86
  command={{ venv_path }}/python manage.py run_app_mqtt_control
84
87
  process_name=%(program_name)s
85
88
  user=root
86
- stdout_logfile=/var/log/simo/app_mqtt.log
89
+ stdout_logfile=/var/log/simo/mqtt_control.log
87
90
  stdout_logfile_maxbytes=1MB
88
91
  stdout_logfile_backups=3
89
92
  redirect_stderr=true
@@ -92,13 +95,14 @@ autorestart=true
92
95
  stopwaitsecs=15
93
96
  killasgroup=true
94
97
  stopsignal=INT
98
+ environment=PYTHONUNBUFFERED=1
95
99
 
96
- [program:simo-app-mqtt-fanout]
100
+ [program:simo-mqtt-fanout]
97
101
  directory={{ project_dir }}/hub/
98
102
  command={{ venv_path }}/python manage.py run_app_mqtt_fanout
99
103
  process_name=%(program_name)s
100
104
  user=root
101
- stdout_logfile=/var/log/simo/app_mqtt_fanout.log
105
+ stdout_logfile=/var/log/simo/mqtt_fanout.log
102
106
  stdout_logfile_maxbytes=1MB
103
107
  stdout_logfile_backups=3
104
108
  redirect_stderr=true
@@ -107,6 +111,7 @@ autorestart=true
107
111
  stopwaitsecs=15
108
112
  killasgroup=true
109
113
  stopsignal=INT
114
+ environment=PYTHONUNBUFFERED=1
110
115
 
111
116
 
112
117
  [program:simo-celery-beat]
@@ -56,7 +56,7 @@ def prepare_mosquitto():
56
56
  f.write(render_to_string('conf/mosquitto.conf'))
57
57
 
58
58
  subprocess.run(
59
- ['service', 'mosquitto', 'reload'], stdout=subprocess.PIPE
59
+ ['service', 'mosquitto', 'restart'], stdout=subprocess.PIPE
60
60
  )
61
61
 
62
62
 
@@ -21,10 +21,18 @@ class Command(BaseCommand):
21
21
  client.username_pw_set('root', settings.SECRET_KEY)
22
22
  client.on_connect = self.on_connect
23
23
  client.on_message = self.on_message
24
+ client.on_disconnect = self.on_disconnect
25
+ # Back off on reconnects to avoid busy-spin during outages
26
+ client.reconnect_delay_set(min_delay=1, max_delay=30)
27
+ # Route Paho logs to Python logging for visibility
28
+ try:
29
+ client.enable_logger()
30
+ except Exception:
31
+ pass
24
32
  client.connect(host=settings.MQTT_HOST, port=settings.MQTT_PORT)
25
33
  try:
26
- while True:
27
- client.loop()
34
+ # Blocking network loop with built-in reconnect/backoff
35
+ client.loop_forever(retry_first_connection=True)
28
36
  finally:
29
37
  try:
30
38
  client.disconnect()
@@ -37,6 +45,7 @@ class Command(BaseCommand):
37
45
 
38
46
  def on_message(self, client, userdata, msg):
39
47
  try:
48
+ print("Control: ", msg.topic)
40
49
  parts = msg.topic.split('/')
41
50
  # SIMO/user/<user-id>/control/<instance-uid>/Component/<component-id>
42
51
  if len(parts) < 7 or parts[0] != 'SIMO' or parts[1] != 'user' or parts[3] != 'control':
@@ -117,6 +126,14 @@ class Command(BaseCommand):
117
126
  # Never crash the consumer
118
127
  pass
119
128
 
129
+ def on_disconnect(self, client, userdata, rc):
130
+ # Non-zero rc means unexpected disconnect. Paho will back off and retry.
131
+ if rc != 0:
132
+ try:
133
+ print(f"Control MQTT disconnect rc={rc}; reconnecting with backoff...", file=sys.stderr)
134
+ except Exception:
135
+ pass
136
+
120
137
  def respond(self, client, user_id, request_id, ok=True, result=None, error=None):
121
138
  if not request_id:
122
139
  return
@@ -21,10 +21,18 @@ class Command(BaseCommand):
21
21
  self.client.username_pw_set('root', settings.SECRET_KEY)
22
22
  self.client.on_connect = self.on_connect
23
23
  self.client.on_message = self.on_message
24
+ self.client.on_disconnect = self.on_disconnect
25
+ # Back off on reconnects to avoid busy-spin during outages
26
+ self.client.reconnect_delay_set(min_delay=1, max_delay=30)
27
+ # Route Paho logs to Python logging for visibility
28
+ try:
29
+ self.client.enable_logger()
30
+ except Exception:
31
+ pass
24
32
  self.client.connect(host=settings.MQTT_HOST, port=settings.MQTT_PORT)
25
33
  try:
26
- while True:
27
- self.client.loop()
34
+ # Blocking network loop with built-in reconnect/backoff
35
+ self.client.loop_forever(retry_first_connection=True)
28
36
  finally:
29
37
  try:
30
38
  self.client.disconnect()
@@ -36,6 +44,7 @@ class Command(BaseCommand):
36
44
 
37
45
  def on_message(self, client, userdata, msg):
38
46
  try:
47
+ print("Fanout: ", msg.topic)
39
48
  topic_parts = msg.topic.split('/')
40
49
  # SIMO/obj-state/<instance-uid>/<Model>/<id>
41
50
  if len(topic_parts) < 5 or topic_parts[0] != 'SIMO' or topic_parts[1] != 'obj-state':
@@ -94,3 +103,11 @@ class Command(BaseCommand):
94
103
  except Exception:
95
104
  # Never crash the consumer
96
105
  print('Fanout error:', ''.join(traceback.format_exception(*sys.exc_info())), file=sys.stderr)
106
+
107
+ def on_disconnect(self, client, userdata, rc):
108
+ # Non-zero rc means unexpected disconnect. Paho will back off and retry.
109
+ if rc != 0:
110
+ try:
111
+ print(f"Fanout MQTT disconnect rc={rc}; reconnecting with backoff...", file=sys.stderr)
112
+ except Exception:
113
+ pass
@@ -3,4 +3,13 @@ allow_anonymous false
3
3
  # ....which are stored in the following file
4
4
  password_file /etc/mosquitto/mosquitto_users
5
5
 
6
- acl_file /etc/mosquitto/acls.conf
6
+ acl_file /etc/mosquitto/acls.conf
7
+
8
+ # Ensure WebSocket listener for /mqtt/ via Nginx
9
+ listener 8083 127.0.0.1
10
+ protocol websockets
11
+
12
+
13
+ # Ensure local TCP listener for internal services
14
+ listener 1883 127.0.0.1
15
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simo
3
- Version: 3.1.1
3
+ Version: 3.1.4
4
4
  Summary: Smart Home Supremacy
5
5
  Author-email: "Simon V." <simon@simo.io>
6
6
  Project-URL: Homepage, https://simo.io
@@ -286,7 +286,7 @@ simo/core/management/_hub_template/hub/celeryc.py,sha256=3ksDXftIZKJ4Cq9WNKJERdZ
286
286
  simo/core/management/_hub_template/hub/manage.py,sha256=PNNlw3EVeIJDgkG0l-klqoxsKWfTYWG9jzRG0upmAaI,620
287
287
  simo/core/management/_hub_template/hub/nginx.conf,sha256=_-ch60oQYXMWmcvYUEbxMvXq9S46exwKmiBaVrxkQ3c,2339
288
288
  simo/core/management/_hub_template/hub/settings.py,sha256=4QhvhbtLRxHvAntwqG_qeAAtpDUqKvN4jzw9u3vqff8,361
289
- simo/core/management/_hub_template/hub/supervisor.conf,sha256=eHdvz98YtxizyPyiJ57-uiTrHGthXdFEN4lybxGBJZk,3492
289
+ simo/core/management/_hub_template/hub/supervisor.conf,sha256=g9Df8scz-FrcLJWSkFzwcEH9yfGR332W_BWXCxxpR_U,3647
290
290
  simo/core/management/_hub_template/hub/urls.py,sha256=Ydm-1BkYAzWeEF-MKSDIFf-7aE4qNLPm48-SA51XgJQ,25
291
291
  simo/core/management/_hub_template/hub/wsgi.py,sha256=Lo-huLHnMDTxSmMBOodVFMWBls9poddrV2KRzXU0xGo,280
292
292
  simo/core/management/_hub_template/hub/__pycache__/asgi.cpython-312.pyc,sha256=FVjb5whNF2mVopSz71s0Zms8d_b90_4smf84OWWkzDI,396
@@ -297,10 +297,10 @@ simo/core/management/_hub_template/hub/__pycache__/urls.cpython-312.pyc,sha256=d
297
297
  simo/core/management/_hub_template/hub/__pycache__/wsgi.cpython-312.pyc,sha256=oA9duba-bsc_OOQnUaz_qiaB-0OcsS5dfjSVHTscrUM,529
298
298
  simo/core/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
299
299
  simo/core/management/commands/gateways_manager.py,sha256=oHzgC-eV4w_KHkiz6eCAlt3XMIwtS8_7mHDQ4UsU5y0,6967
300
- simo/core/management/commands/on_http_start.py,sha256=SYhE1d2GJ_tOFLvT9VFLPcXA3Lzz-dw5x3zMWPkdHYI,6278
300
+ simo/core/management/commands/on_http_start.py,sha256=kxtWB3lOSyQA8tVmZRmLmaoVsliy5mhZp9_wwCvkj_A,6279
301
301
  simo/core/management/commands/republish_mqtt_state.py,sha256=mc8e7qnhDyC9_fiYr6d0g2s_3wGUXCrLo95-HBIrkOA,2248
302
- simo/core/management/commands/run_app_mqtt_control.py,sha256=Vopy9BPWRCmHaWwqYkJQE5a_OHCrUfC6LVI2VEB9w2o,4820
303
- simo/core/management/commands/run_app_mqtt_fanout.py,sha256=NLLE4A6KijvmId8pWD2qYr4VGbM_65Q8UKlbgXhNfIs,3820
302
+ simo/core/management/commands/run_app_mqtt_control.py,sha256=-eDDAXbGtjqN1OK7Ym2FIdP1wVNJYR0DdvIyRzmXPDc,5592
303
+ simo/core/management/commands/run_app_mqtt_fanout.py,sha256=diSEZM_sBQqm4wzzVgBT90Kt8kAhbZm5at2meEMv73M,4605
304
304
  simo/core/management/commands/run_gateway.py,sha256=bp0FQQoBeOSoxjHCCMicDL1fxPZZGyLgnq2QKht3bJo,645
305
305
  simo/core/management/commands/__pycache__/__init__.cpython-312.pyc,sha256=2Rw8IQ8vlr-wLXgjtc9zACkDD_SWZCxDlbrXw5vfI6o,142
306
306
  simo/core/management/commands/__pycache__/__init__.cpython-38.pyc,sha256=WKpfZZpAB9D7U4X6oWQIrU_H-6rUmq8Gl9fj9XaY2fw,178
@@ -11026,7 +11026,7 @@ simo/users/migrations/__pycache__/0043_userdevicereportlog_avg_speed_kmh.cpython
11026
11026
  simo/users/migrations/__pycache__/0044_permissionsrole_is_person.cpython-312.pyc,sha256=ONWJu9MdXkOPlq1exNumEf1iEnCbvIsEul1EW2WMVgA,832
11027
11027
  simo/users/migrations/__pycache__/__init__.cpython-312.pyc,sha256=i3P6nr4OxZF7ZodnxhMfQ4jecJ7O0gsEAnUPiAEtNZ0,134
11028
11028
  simo/users/migrations/__pycache__/__init__.cpython-38.pyc,sha256=NKq7WLgktK8WV1oOqCPbAbdkrPV5GRGhYx4VxxI4dcs,170
11029
- simo/users/templates/conf/mosquitto.conf,sha256=1eIGNuRu4Y3hfAU6qiWix648eCRrw0oOT24PnyFI4ys,189
11029
+ simo/users/templates/conf/mosquitto.conf,sha256=Df0-4luyyU5b_WW2XJd0SzDYUccNVvWjKqjoTwEfXc0,361
11030
11030
  simo/users/templates/conf/mosquitto_acls.conf,sha256=e_2GN-5stuOO2QgFmELUCdHzZEF4pd2M7YGTTGpVQYo,369
11031
11031
  simo/users/templates/invitations/authenticated_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11032
11032
  simo/users/templates/invitations/authenticated_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -11034,9 +11034,9 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
11034
11034
  simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11035
11035
  simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11036
11036
  simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11037
- simo-3.1.1.dist-info/licenses/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
11038
- simo-3.1.1.dist-info/METADATA,sha256=ZP_qC3cL7BkSgQgvDwKOg6kyjirnyBDdYVIOitaPlEs,2224
11039
- simo-3.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11040
- simo-3.1.1.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
11041
- simo-3.1.1.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
11042
- simo-3.1.1.dist-info/RECORD,,
11037
+ simo-3.1.4.dist-info/licenses/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
11038
+ simo-3.1.4.dist-info/METADATA,sha256=fdQuK5JIjFNaNn7FMY7R2vbKhlMuFf282kuWRWawPhc,2224
11039
+ simo-3.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11040
+ simo-3.1.4.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
11041
+ simo-3.1.4.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
11042
+ simo-3.1.4.dist-info/RECORD,,
File without changes