1010from letpot .exceptions import LetPotException
1111from letpot .models import (
1212 DeviceFeature ,
13+ LightMode ,
1314 TemperatureUnit ,
1415 LetPotDeviceErrors ,
1516 LetPotDeviceStatus ,
@@ -115,7 +116,7 @@ def get_update_status_message(self, status: LetPotDeviceStatus) -> list[int]:
115116 2 ,
116117 1 if status .system_on else 0 ,
117118 status .pump_mode ,
118- status .light_mode ,
119+ status .light_mode . value ,
119120 math .floor (status .plant_days / 256 ),
120121 status .plant_days % 256 ,
121122 status .light_schedule_start .hour ,
@@ -143,7 +144,7 @@ def convert_hex_to_status(self, message: PayloadType) -> LetPotDeviceStatus | No
143144 return LetPotDeviceStatus (
144145 raw = data ,
145146 light_brightness = 256 * data [17 ] + data [18 ],
146- light_mode = data [10 ],
147+ light_mode = LightMode ( data [10 ]) ,
147148 light_schedule_end = time (hour = data [15 ], minute = data [16 ]),
148149 light_schedule_start = time (hour = data [13 ], minute = data [14 ]),
149150 online = data [6 ] == 0 ,
@@ -192,7 +193,7 @@ def get_update_status_message(self, status: LetPotDeviceStatus) -> list[int]:
192193 2 ,
193194 1 if status .system_on else 0 ,
194195 status .pump_mode ,
195- status .light_mode ,
196+ status .light_mode . value ,
196197 math .floor (status .plant_days / 256 ),
197198 status .plant_days % 256 ,
198199 status .light_schedule_start .hour ,
@@ -216,7 +217,7 @@ def convert_hex_to_status(self, message: PayloadType) -> LetPotDeviceStatus | No
216217 return LetPotDeviceStatus (
217218 raw = data ,
218219 light_brightness = None ,
219- light_mode = data [10 ],
220+ light_mode = LightMode ( data [10 ]) ,
220221 light_schedule_end = time (hour = data [15 ], minute = data [16 ]),
221222 light_schedule_start = time (hour = data [13 ], minute = data [14 ]),
222223 online = data [6 ] == 0 ,
@@ -264,7 +265,7 @@ def get_update_status_message(self, status: LetPotDeviceStatus) -> list[int]:
264265 2 ,
265266 1 if status .system_on else 0 ,
266267 status .pump_mode ,
267- status .light_mode ,
268+ status .light_mode . value ,
268269 math .floor (status .plant_days / 256 ),
269270 status .plant_days % 256 ,
270271 status .light_schedule_start .hour ,
@@ -290,7 +291,7 @@ def convert_hex_to_status(self, message: PayloadType) -> LetPotDeviceStatus | No
290291 return LetPotDeviceStatus (
291292 raw = data ,
292293 light_brightness = 256 * data [18 ] + data [19 ],
293- light_mode = data [10 ],
294+ light_mode = LightMode ( data [10 ]) ,
294295 light_schedule_end = time (hour = data [15 ], minute = data [16 ]),
295296 light_schedule_start = time (hour = data [13 ], minute = data [14 ]),
296297 online = data [6 ] == 0 ,
@@ -344,7 +345,7 @@ def get_update_status_message(self, status: LetPotDeviceStatus) -> list[int]:
344345 2 ,
345346 1 if status .system_on else 0 ,
346347 status .pump_mode ,
347- status .light_mode ,
348+ 0 if status .light_mode is LightMode . FLOWER else 1 ,
348349 math .floor (status .plant_days / 256 ),
349350 status .plant_days % 256 ,
350351 status .light_schedule_start .hour ,
@@ -367,7 +368,7 @@ def convert_hex_to_status(self, message: PayloadType) -> LetPotDeviceStatus | No
367368 return LetPotDeviceStatus (
368369 raw = data ,
369370 light_brightness = 256 * data [18 ] + data [19 ],
370- light_mode = data [10 ],
371+ light_mode = LightMode ( data [10 ]) ,
371372 light_schedule_end = time (hour = data [15 ], minute = data [16 ]),
372373 light_schedule_start = time (hour = data [13 ], minute = data [14 ]),
373374 online = data [6 ] == 0 ,
0 commit comments