Fix SetOption verification to handle ON/OFF vs 1/0 responses
- Tasmota returns 'ON'/'OFF' for SetOption queries - Config file uses '1'/'0' for SetOption values - Added normalize_value() to convert both formats to comparable values - Eliminates false verification warnings for correctly applied settings
This commit is contained in:
parent
265fa33497
commit
73acc41145
@ -235,9 +235,19 @@ class ConsoleSettingsManager:
|
|||||||
return True # Can't verify, assume success
|
return True # Can't verify, assume success
|
||||||
|
|
||||||
# Check if value matches
|
# Check if value matches
|
||||||
current_value = result.get(param_name, '')
|
current_value = str(result.get(param_name, ''))
|
||||||
|
expected = str(expected_value)
|
||||||
|
|
||||||
if str(current_value) == str(expected_value):
|
# Normalize values for comparison (Tasmota returns ON/OFF for 1/0)
|
||||||
|
def normalize_value(val: str) -> str:
|
||||||
|
val_lower = val.lower()
|
||||||
|
if val_lower in ['on', '1', 'true']:
|
||||||
|
return '1'
|
||||||
|
elif val_lower in ['off', '0', 'false']:
|
||||||
|
return '0'
|
||||||
|
return val_lower
|
||||||
|
|
||||||
|
if normalize_value(current_value) == normalize_value(expected):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user