2222 TrainingStatusFlags ,
2323 TrainingStatusModel ,
2424)
25- from ..const import CONTROL_POINT_UUID , PAUSE , STATUS_UUID , STOP , TRAINING_STATUS_UUID
25+ from ..const import (
26+ CONTROL_POINT_UUID ,
27+ PAUSE ,
28+ STATUS_UUID ,
29+ STOP ,
30+ TRAINING_STATUS_UUID ,
31+ )
2632from .event import (
2733 ControlEvent ,
2834 FtmsCallback ,
@@ -62,7 +68,11 @@ def _simple_status_events(m: MachineStatusModel) -> ControlEvent | None:
6268 return ControlEvent (event_id = "reset" , event_source = "other" )
6369
6470 case MachineStatusCode .STOP_PAUSE :
65- value = STOP if StopPauseCode (m .stop_pause ) == StopPauseCode .STOP else PAUSE
71+ value = (
72+ STOP
73+ if StopPauseCode (m .stop_pause ) == StopPauseCode .STOP
74+ else PAUSE
75+ )
6676 return ControlEvent (event_id = value , event_source = "user" )
6777
6878 case MachineStatusCode .STOP_SAFETY :
@@ -79,7 +89,11 @@ def _simple_control_events(m: ControlModel) -> ControlEvent | None:
7989 return ControlEvent (event_id = "reset" , event_source = "callback" )
8090
8191 case ControlCode .STOP_PAUSE :
82- value = STOP if StopPauseCode (m .stop_pause ) == StopPauseCode .STOP else PAUSE
92+ value = (
93+ STOP
94+ if StopPauseCode (m .stop_pause ) == StopPauseCode .STOP
95+ else PAUSE
96+ )
8397 return ControlEvent (event_id = value , event_source = "callback" )
8498
8599 case ControlCode .START_RESUME :
@@ -216,7 +230,9 @@ async def write_command(
216230
217231 return ResultCode .SUCCESS
218232
219- def _on_machine_status (self , c : BleakGATTCharacteristic , data : bytearray ) -> None :
233+ def _on_machine_status (
234+ self , c : BleakGATTCharacteristic , data : bytearray
235+ ) -> None :
220236 """Machine Status notification callback."""
221237 bio = io .BytesIO (data )
222238 status = MachineStatusModel ._deserialize (bio )
@@ -241,7 +257,9 @@ def _on_machine_status(self, c: BleakGATTCharacteristic, data: bytearray) -> Non
241257
242258 self ._cb (event )
243259
244- def _on_training_status (self , c : BleakGATTCharacteristic , data : bytearray ) -> None :
260+ def _on_training_status (
261+ self , c : BleakGATTCharacteristic , data : bytearray
262+ ) -> None :
245263 """Training Status notification callback."""
246264 bio = io .BytesIO (data )
247265 status = TrainingStatusModel ._deserialize (bio )
@@ -250,7 +268,9 @@ def _on_training_status(self, c: BleakGATTCharacteristic, data: bytearray) -> No
250268
251269 if TrainingStatusFlags .STRING_PRESENT in status .flags :
252270 if b := bio .read ():
253- status_data ["training_status_string" ] = b .decode (encoding = "utf-8" )
271+ status_data ["training_status_string" ] = b .decode (
272+ encoding = "utf-8"
273+ )
254274
255275 event = UpdateEvent (event_id = "update" , event_data = status_data )
256276
0 commit comments