@@ -131,18 +131,17 @@ def turn_off_sync(self) -> None:
131131 """Sync turn off this crownstone"""
132132 self .loop .run_until_complete (self .turn_off ())
133133
134- async def set_brightness (self , percentage : int ) -> None :
134+ async def set_brightness (self , brightness : float ) -> None :
135135 """
136136 Set the brightness of this crownstone, if dimming enabled
137137
138- :param percentage: the brightness percentage (0 - 100 )
138+ :param brightness: brightness value between (0 - 1 )
139139 """
140140 if self .dimming_enabled :
141141 if self .dimming_synced_to_crownstone :
142- if percentage < 0 or percentage > 100 :
143- raise ValueError ("Enter a percentage between 0 and 100 " )
142+ if brightness < 0 or brightness > 1 :
143+ raise ValueError ("Enter a value between 0 and 1 " )
144144 else :
145- brightness = percentage / 100
146145 await RequestHandler .put ('Stones' , 'setSwitchStateRemotely' , model_id = self .cloud_id ,
147146 command = 'switchState' , value = brightness )
148147 else :
@@ -151,10 +150,10 @@ async def set_brightness(self, percentage: int) -> None:
151150 else :
152151 _LOGGER .error ("Dimming is not enabled for this crownstone. Go to the crownstone app to enable it" )
153152
154- def set_brightness_sync (self , percentage : int ) -> None :
153+ def set_brightness_sync (self , brightness : float ) -> None :
155154 """
156155 Sync set the brightness of this crownstone, if dimming enabled
157156
158- :param percentage : the brightness percentage (0 - 100 )
157+ :param brightness : the brightness percentage (0 - 1 )
159158 """
160- self .loop .run_until_complete (self .set_brightness (percentage ))
159+ self .loop .run_until_complete (self .set_brightness (brightness ))
0 commit comments