@@ -771,7 +771,7 @@ def _maintenance_on(
771
771
Turn Maintenance mode on.
772
772
"""
773
773
if initial_state is State .IDLE :
774
- print (f 'Turning Maintenance mode on...' )
774
+ print ('Turning Maintenance mode on...' )
775
775
776
776
_toggle_maintenance (modbus_client = modbus_client , enable = True )
777
777
@@ -794,7 +794,7 @@ def _maintenance_off(modbus_client: client.ModbusClient) -> None:
794
794
"""
795
795
Turn Maintenance mode off.
796
796
"""
797
- print (f 'Turning Maintenance mode off...' )
797
+ print ('Turning Maintenance mode off...' )
798
798
799
799
_toggle_maintenance (modbus_client = modbus_client , enable = False )
800
800
@@ -808,7 +808,8 @@ def _maintenance_off(modbus_client: client.ModbusClient) -> None:
808
808
809
809
810
810
def _check_refilling_state (
811
- modbus_client : client .ModbusClient , expected_refilling_state : RefillingState
811
+ modbus_client : client .ModbusClient ,
812
+ expected_refilling_state : RefillingState
812
813
) -> None :
813
814
"""
814
815
Check specific refilling state.
@@ -875,8 +876,8 @@ def _perform_draining(modbus_client: client.ModbusClient) -> None:
875
876
)
876
877
877
878
print (
878
- f '\n =================================================================\n '
879
- f '============================ DRAINING ===========================\n \n '
879
+ '\n =================================================================\n '
880
+ '============================ DRAINING ===========================\n \n '
880
881
)
881
882
_wait_confirmation (
882
883
prompt = (
@@ -898,8 +899,8 @@ def _perform_flushing(modbus_client: client.ModbusClient) -> None:
898
899
Flushing procedure with required checks.
899
900
"""
900
901
print (
901
- f '\n =================================================================\n '
902
- f '============================ FLUSHING ===========================\n \n '
902
+ '\n =================================================================\n '
903
+ '============================ FLUSHING ===========================\n \n '
903
904
)
904
905
905
906
_check_refilling_state (
@@ -925,7 +926,8 @@ def _perform_flushing(modbus_client: client.ModbusClient) -> None:
925
926
f'\n Now electrolyser will be automatically refilled with'
926
927
f' water.\n Current electrolyte level will be reported every'
927
928
f' { ELECTROLYTE_PRESENCE_CHECK_TIMEOUT } seconds until flushing is'
928
- f' complete.\n Type { INPUT_CONFIRMATION } and press Enter to proceed:'
929
+ f' complete.\n Type { INPUT_CONFIRMATION } and press Enter to'
930
+ f' proceed:'
929
931
)
930
932
)
931
933
@@ -940,8 +942,8 @@ def _perform_flushing(modbus_client: client.ModbusClient) -> None:
940
942
941
943
_print_yellow (
942
944
text = (
943
- f 'Now waiting until water is mixed with pump, this process will'
944
- f ' be monitored automatically...'
945
+ 'Now waiting until water is mixed with pump, this process will'
946
+ ' be monitored automatically...'
945
947
)
946
948
)
947
949
@@ -965,8 +967,8 @@ def _perform_refilling(
965
967
)
966
968
967
969
print (
968
- f '\n =================================================================\n '
969
- f '=========================== REFILLING ===========================\n \n '
970
+ '\n =================================================================\n '
971
+ '=========================== REFILLING ===========================\n \n '
970
972
)
971
973
972
974
refill_to_level : ElectrolyteLevel = (
@@ -1081,8 +1083,8 @@ def _finish_refilling(modbus_client: client.ModbusClient) -> None:
1081
1083
1082
1084
_print_yellow (
1083
1085
text = (
1084
- f 'Now waiting until water is mixed with pump, this process will'
1085
- f' be monitored automatically...'
1086
+ 'Now waiting until water is mixed with pump, this process will be '
1087
+ ' monitored automatically...'
1086
1088
)
1087
1089
)
1088
1090
@@ -1110,7 +1112,9 @@ def _wait_electrolyte_level(
1110
1112
1111
1113
while time .time () < wait_until :
1112
1114
if (
1113
- electrolyte_level := _electrolyte_level (modbus_client = modbus_client )
1115
+ electrolyte_level := _electrolyte_level (
1116
+ modbus_client = modbus_client
1117
+ )
1114
1118
) is expected_level :
1115
1119
break
1116
1120
@@ -1195,8 +1199,8 @@ def _check_water_pipe_connection(
1195
1199
else :
1196
1200
_print_yellow (
1197
1201
text = (
1198
- f'Water inlet pressure { actual_water_inlet_pressure } is not '
1199
- f' in allowed bounds ({ min_pressure } , { max_pressure } )'
1202
+ f'Water inlet pressure { actual_water_inlet_pressure } is'
1203
+ f' not in allowed bounds ({ min_pressure } , { max_pressure } )'
1200
1204
)
1201
1205
)
1202
1206
@@ -1233,8 +1237,8 @@ def _check_water_pipe_connection(
1233
1237
1234
1238
_wait_confirmation (
1235
1239
prompt = (
1236
- f'Problems with water pipe detected.\n Please double check water '
1237
- f' pipe, type { INPUT_CONFIRMATION } and press Enter when'
1240
+ f'Problems with water pipe detected.\n Please double check'
1241
+ f' water pipe, type { INPUT_CONFIRMATION } and press Enter when'
1238
1242
f' ready:\n '
1239
1243
)
1240
1244
)
@@ -1285,8 +1289,9 @@ def _run_maintenance_21(
1285
1289
1286
1290
case _:
1287
1291
raise MaintenanceModeException (
1288
- f'Got unexpected refilling state { actual_refilling_state .name } ,'
1289
- f' please contact Enapter customer support'
1292
+ f'Got unexpected refilling state'
1293
+ f' { actual_refilling_state .name } , please contact Enapter'
1294
+ f' customer support'
1290
1295
)
1291
1296
1292
1297
if draining_required :
@@ -1336,8 +1341,9 @@ def _run_maintenance_4x(
1336
1341
1337
1342
case _:
1338
1343
raise MaintenanceModeException (
1339
- f'Got unexpected refilling state { actual_refilling_state .name } ,'
1340
- f' please contact Enapter customer support'
1344
+ f'Got unexpected refilling state'
1345
+ f' { actual_refilling_state .name } , please contact Enapter'
1346
+ f' customer support'
1341
1347
)
1342
1348
1343
1349
if draining_required :
@@ -1456,13 +1462,13 @@ def main() -> None:
1456
1462
'WARNING! Please read carefully!\n This script turns'
1457
1463
f' Maintenance mode on.\n Maintenance mode requires manual'
1458
1464
f' actions with electrolyser such as electrolyte draining,'
1459
- f' flushing (for EL4.x) and refilling.\n If you fill electrolyte '
1460
- f' for the first time, only refilling is required.\n If at some '
1461
- f' step electrolyte level is reported incorrectly, it may '
1462
- f' indicate hardware problems.\n In this case terminate script '
1463
- f' with Ctrl+C and contact Enapter customer support.\n Script '
1464
- f' will be terminated anyway if draining/refilling is not '
1465
- f' complete during'
1465
+ f' flushing (for EL4.x) and refilling.\n If you fill'
1466
+ f' electrolyte for the first time, only refilling is required.'
1467
+ f'\n If at some step electrolyte level is reported incorrectly,'
1468
+ f' it may indicate hardware problems.\n In this case terminate'
1469
+ f' script with Ctrl+C and contact Enapter customer support.\n '
1470
+ f'Script will be terminated anyway if draining/refilling is'
1471
+ f' not complete during'
1466
1472
f' { DRAINING_TIMEOUT // 60 } /{ REFILLING_TIMEOUT // 60 } minutes'
1467
1473
f' correspondingly.\n Type { INPUT_CONFIRMATION } and press Enter'
1468
1474
f' if you really want to continue. Press Ctrl+С or Enter to'
@@ -1514,13 +1520,15 @@ def main() -> None:
1514
1520
print (f'Modbus exception: { modbus_client .last_except_as_txt } ' )
1515
1521
1516
1522
active_errors : str = (
1517
- ', ' .join (_decode_errors (modbus_client = modbus_client )) or
1518
- 'No errors'
1523
+ ', ' .join (
1524
+ _decode_errors (modbus_client = modbus_client )
1525
+ ) or 'No errors'
1519
1526
)
1520
1527
1521
1528
active_warnings : str = (
1522
- ', ' .join (_decode_warnings (modbus_client = modbus_client )) or
1523
- 'No warnings'
1529
+ ', ' .join (
1530
+ _decode_warnings (modbus_client = modbus_client )
1531
+ ) or 'No warnings'
1524
1532
)
1525
1533
1526
1534
_print_red (
0 commit comments