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:
Mike Geppert 2026-01-04 22:30:43 -06:00
parent 265fa33497
commit 73acc41145

View File

@ -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