simo 2.0.23__py3-none-any.whl → 2.0.24__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
simo/core/api.py CHANGED
@@ -209,7 +209,8 @@ class ComponentViewSet(InstanceMixin, viewsets.ModelViewSet):
209
209
 
210
210
  return RESTResponse(result)
211
211
 
212
- @action(detail=True, methods=['post'])
212
+ # TODO: remove post when app is updated for all users
213
+ @action(detail=True, methods=['post', 'put'])
213
214
  def subcomponent(self, request, pk=None, *args, **kwargs):
214
215
  component = self.get_object()
215
216
  json_data = request.data
@@ -229,12 +230,12 @@ class ComponentViewSet(InstanceMixin, viewsets.ModelViewSet):
229
230
  self.check_object_permissions(self.request, subcomponent)
230
231
  return self.perform_controller_method(json_data, subcomponent)
231
232
 
232
- @action(detail=True, methods=['post'])
233
+ @action(detail=True, methods=['post', 'put'])
233
234
  def controller(self, request, pk=None, *args, **kwargs):
234
235
  component = self.get_object()
235
236
  return self.perform_controller_method(request.data, component)
236
237
 
237
- @action(detail=False, methods=['post'])
238
+ @action(detail=False, methods=['post', 'put'])
238
239
  def control(self, request, *args, **kwargs):
239
240
  component = self.get_queryset().filter(id=request.data.pop('id', 0))
240
241
  if not component:
simo/core/permissions.py CHANGED
@@ -35,6 +35,15 @@ class InstanceSuperuserCanEdit(BasePermission):
35
35
  message = "Only superusers are allowed to perform this action."
36
36
 
37
37
  def has_object_permission(self, request, view, obj):
38
+ '''
39
+ in this permission we only care about:
40
+ POST - create new object
41
+ PATCH - modify an object
42
+ DELETE - delete an oject
43
+ '''
44
+
45
+ if request.method in SAFE_METHODS + ('PUT', 'POST', ): # TODO: remove POST
46
+ return True
38
47
 
39
48
  # allow deleting only empty categories and zones
40
49
  if type(obj) in (Zone, Category) and request.method == 'DELETE'\
@@ -46,29 +55,23 @@ class InstanceSuperuserCanEdit(BasePermission):
46
55
  user_role = request.user.get_role(view.instance)
47
56
  if user_role.is_superuser:
48
57
  return True
49
- return request.method in SAFE_METHODS
58
+
59
+ return False
50
60
 
51
61
 
52
62
  class ComponentPermission(BasePermission):
53
63
  message = "You do not have permission to do this on this component."
54
64
 
55
- # TODO: clean this up once the app is tested and running 100% correctly for at least 6 months.
56
65
  def has_object_permission(self, request, view, obj):
57
- print(f"Check permission of {request.user} on {obj}")
58
66
  if request.method in SAFE_METHODS:
59
- print("THIS IS SAFE METHOD!")
60
67
  return True
61
68
  if request.user.is_master:
62
- print("USER IS MASTER!")
63
69
  return True
64
70
  user_role = request.user.get_role(view.instance)
65
71
  if user_role.is_superuser:
66
- print("USER IS SUPERUSER!")
67
72
  return True
68
73
  if request.method == 'POST' and user_role.component_permissions.filter(
69
74
  write=True, component=obj
70
75
  ).count():
71
- print("USER HAS RIGHT TO DO THIS!")
72
76
  return True
73
- print("USER IS NOT ALLOWED TO DO THIS!")
74
77
  return False
Binary file
simo/fleet/forms.py CHANGED
@@ -701,6 +701,14 @@ class ColonelRGBLightConfigForm(ColonelComponentForm):
701
701
  help_text="Custom addressable led strip timing (T0H, T0L, T1H, T1L). <br>"
702
702
  "For example SK6812 is: (300, 900, 600, 600)"
703
703
  )
704
+ sustain_color = forms.BooleanField(
705
+ initial=True, required=False,
706
+ help_text="Recommended to leave this enabled. <br>"
707
+ "Addressible signal wire might pick up electrical "
708
+ "noise from it's surroundings which might cause color change "
709
+ "on random pixels. Colonel will send color update every 20s "
710
+ "to sustain last set color if this is enabled. "
711
+ )
704
712
  controls = FormsetField(
705
713
  formset_factory(
706
714
  ControlPinForm, can_delete=True, can_order=True, extra=0, max_num=2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simo
3
- Version: 2.0.23
3
+ Version: 2.0.24
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
@@ -26,7 +26,7 @@ simo/_hub_template/hub/supervisor.conf,sha256=IY3fdK0fDD2eAothB0n54xhjQj8LYoXIR9
26
26
  simo/_hub_template/hub/urls.py,sha256=Ydm-1BkYAzWeEF-MKSDIFf-7aE4qNLPm48-SA51XgJQ,25
27
27
  simo/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  simo/core/admin.py,sha256=cPOC2x45Gjf0T8MKtmE2wJZk7DAuHMsvvy5Nk3YUIG8,17675
29
- simo/core/api.py,sha256=bAX-DXG5aJr3VvjqGKGtjVzel0E7Cp3l5tkA3uLhnFw,22969
29
+ simo/core/api.py,sha256=uMbczzV6gLIOJWRe6sHJGwvZrDhzOPU-zePSihi3MqE,23048
30
30
  simo/core/api_auth.py,sha256=_3hG4e1eLKrcRnSAOB_xTL6cwtOJ2_7JS7GZU_iqTgA,1251
31
31
  simo/core/api_meta.py,sha256=ySmmhtVrWatI3yqnYPuP5ipapmJfyfEbl32w-7_W5O4,3551
32
32
  simo/core/app_widgets.py,sha256=EEQOto3fGR0syDqpJE38tQrx8DoTTyg26nF5kYzHY38,2018
@@ -44,7 +44,7 @@ simo/core/loggers.py,sha256=EBdq23gTQScVfQVH-xeP90-wII2DQFDjoROAW6ggUP4,1645
44
44
  simo/core/managers.py,sha256=WoQ4OX3akIvoroSYji-nLVqXBSJzCiC1u_IiWkKbKmA,2413
45
45
  simo/core/middleware.py,sha256=64PYjnyRnYf4sgMvPfR0oQqf9UEtxUwnhJe3RV6z_HI,2040
46
46
  simo/core/models.py,sha256=zqbPDYLHOsavrBzw5uOmUgcWBnBbjGLvezgETX-pD_E,19672
47
- simo/core/permissions.py,sha256=b2qO_kNaCgWcv2VJbOp6AUXOc_cup7fOT3Up16rn77M,2495
47
+ simo/core/permissions.py,sha256=3PEmEVoRXSN6HjQKoRq7ONU6Yt2mv8c_Ya5KZH815RA,2372
48
48
  simo/core/routing.py,sha256=X1_IHxyA-_Q7hw1udDoviVP4_FSBDl8GYETTC2zWTbY,499
49
49
  simo/core/serializers.py,sha256=kmja52o-BUOcUTX2ZsKWixvKRZSXB7lGe866Q1ajlmo,17563
50
50
  simo/core/signal_receivers.py,sha256=EZ8NSYZxUgSaLS16YZdK7T__l8dl0joMRllOxx5PUt4,2809
@@ -57,7 +57,7 @@ simo/core/views.py,sha256=hlAKpAbCbqI3a-uL5tDp532T2oLFiF0MBzKUJ_SNzo0,5833
57
57
  simo/core/widgets.py,sha256=J9e06C6I22F6xKic3VMgG7WeX07glAcl-4bF2Mg180A,2827
58
58
  simo/core/__pycache__/__init__.cpython-38.pyc,sha256=y0IW37wBUIGa3Eh_ZG28pRqHKoLiPyTgUX2OnbkEPlc,158
59
59
  simo/core/__pycache__/admin.cpython-38.pyc,sha256=EqwHQhU8qQrjfSChyCZXN6J-1Eira9alYIqR45-3OnE,13475
60
- simo/core/__pycache__/api.cpython-38.pyc,sha256=l3BUnLGBsM-FzqdaKi__1R9Z5DJnhgJrkmXQ2XQetT0,18372
60
+ simo/core/__pycache__/api.cpython-38.pyc,sha256=wyjCPKUQtjiQ9xg9kOVhycu8Jm_2ZE1HPPqCRyLRyLE,18383
61
61
  simo/core/__pycache__/api_auth.cpython-38.pyc,sha256=5UTBr3rDMERAfc0OuOVDwGeQkt6Q7GLBtZJAMBse1sg,1712
62
62
  simo/core/__pycache__/api_meta.cpython-38.pyc,sha256=94T3_rybn2T1_bkaDQnQRyjy21LBaGOnz-mmkJ6T0N8,2840
63
63
  simo/core/__pycache__/app_widgets.cpython-38.pyc,sha256=9Es2wZNduzUJv-jZ_HX0-L3vqwpXWBbseEwoC5K6b-w,3465
@@ -75,7 +75,7 @@ simo/core/__pycache__/loggers.cpython-38.pyc,sha256=Z-cdQnC6XlIonPV4Sl4E52tP4NME
75
75
  simo/core/__pycache__/managers.cpython-38.pyc,sha256=5vstOMfm997CZBBkaSiaS7EojhLTWZlbeA_EQ8u-yfg,2554
76
76
  simo/core/__pycache__/middleware.cpython-38.pyc,sha256=bGOFJNEhJeLbpsZp8LYn1VA3paLF5HULHQ6IFKa7Juc,2022
77
77
  simo/core/__pycache__/models.cpython-38.pyc,sha256=meQeK2mVoSDP9cTMSZDW-Ofi53QzwjfHSUlAGlnhyfs,17127
78
- simo/core/__pycache__/permissions.cpython-38.pyc,sha256=7iz0o_jIEhDM2FQd-P-3Y6sm4GQ0MRy4a5biBNkngOA,2680
78
+ simo/core/__pycache__/permissions.cpython-38.pyc,sha256=das7lo0PAfQsiRgkqOxP-rd1p2EElyk4wE8XUhVccuA,2635
79
79
  simo/core/__pycache__/routing.cpython-38.pyc,sha256=3T3FPJ8Cn99xZCGvMyg2xjl7al-Shm9CelbSpkJtNP8,599
80
80
  simo/core/__pycache__/serializers.cpython-38.pyc,sha256=x-obnrdPnoYRhriP_51_Jy_0saCsasWdFQSH1kalVqo,16869
81
81
  simo/core/__pycache__/signal_receivers.cpython-38.pyc,sha256=sgjH_wv-1U99auH5uHb3or0qettPeHAlsz8P7B03ajY,2430
@@ -10171,7 +10171,7 @@ simo/fleet/auto_urls.py,sha256=X04oKJWA48wFW5iXg3PPROY2KDdHn_a99orQSE28QC4,518
10171
10171
  simo/fleet/base_types.py,sha256=wL9RVkHr0gA7HI1wZq0pruGEIgvQqpfnCL4cC3ywsvw,102
10172
10172
  simo/fleet/ble.py,sha256=eHA_9ABjbmH1vUVCv9hiPXQL2GZZSEVwfO0xyI1S0nI,1081
10173
10173
  simo/fleet/controllers.py,sha256=rTxRFf-LKWAZxzixrsLZHHm51BmMx9a1PLdgf6inlNM,20533
10174
- simo/fleet/forms.py,sha256=SOz0CnaRJ1jOOJLzvL2kOfacuaE7nOVlc6NtScSaR1Y,37965
10174
+ simo/fleet/forms.py,sha256=7qe-Izd3yMc43BFdpfgqtz_9dkVxhp4krB-iKsTA5_I,38407
10175
10175
  simo/fleet/gateways.py,sha256=KV5i5fxXIrlK-k6zyEkk83x11GJt-ELQ0npb4Ac83cM,3693
10176
10176
  simo/fleet/managers.py,sha256=XOpDOA9L-f_550TNSyXnJbun2EmtGz1TenVTMlUSb8E,807
10177
10177
  simo/fleet/models.py,sha256=ve-97F1cwGt-AmwfSJK0d-57pP3NyZpeu0XlHu2oK28,14494
@@ -10188,7 +10188,7 @@ simo/fleet/__pycache__/auto_urls.cpython-38.pyc,sha256=SqyTuaz_kEBvx-bL46SclsZEE
10188
10188
  simo/fleet/__pycache__/base_types.cpython-38.pyc,sha256=deyPwjpT6xZiFxBGFnj5b7R-lbdOTh2krgpJhrcGVhc,274
10189
10189
  simo/fleet/__pycache__/ble.cpython-38.pyc,sha256=Nrof9w7cm4OlpFWHeVnmvvanh2_oF9oQ3TknJiV93-0,1267
10190
10190
  simo/fleet/__pycache__/controllers.cpython-38.pyc,sha256=l9bz18Qp33C12TJOKPSn9vIXnlBKnBusODNk7Fg64qA,18103
10191
- simo/fleet/__pycache__/forms.cpython-38.pyc,sha256=0HmLdm3-2_4Zy_lIjUnGpnjf_gFz_KmmTFS1Vt4SY48,27398
10191
+ simo/fleet/__pycache__/forms.cpython-38.pyc,sha256=3MAf9dL-HZjMiOhaLmMjMh_KR0so_9Rq4XYS4htX-zQ,27711
10192
10192
  simo/fleet/__pycache__/gateways.cpython-38.pyc,sha256=YAcgTOqJbtjGI03lvEcU6keFfrwAHkObVmErYzfRvjk,3569
10193
10193
  simo/fleet/__pycache__/managers.cpython-38.pyc,sha256=8uz-xpUiqbGDgXIZ_XRZtFb-Tju6NGxflGg-Ee4Yo6k,1310
10194
10194
  simo/fleet/__pycache__/models.cpython-38.pyc,sha256=pHNRUiPRjH0SLp14pzbSIxHi_-27SpZFgSh_7lzA8Wo,12359
@@ -10448,8 +10448,8 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
10448
10448
  simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10449
10449
  simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10450
10450
  simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10451
- simo-2.0.23.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10452
- simo-2.0.23.dist-info/METADATA,sha256=n65-Fcht6N4VSA8W5igDDeUKN7Hq5YgU8XMTb5pmUcw,1730
10453
- simo-2.0.23.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
10454
- simo-2.0.23.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10455
- simo-2.0.23.dist-info/RECORD,,
10451
+ simo-2.0.24.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10452
+ simo-2.0.24.dist-info/METADATA,sha256=iakv_6SOidRd-FQnFU6PzDNjrtBwjGUHzd-7LK3mW3k,1730
10453
+ simo-2.0.24.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
10454
+ simo-2.0.24.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10455
+ simo-2.0.24.dist-info/RECORD,,
File without changes