Skip to content

Commit 2c2eb22

Browse files
authored
fix issue with codes with leading zero
1 parent 577fe0f commit 2c2eb22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

custom_components/duofern/config_flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async def async_step_user(self, user_input: Mapping[str, Any]|None =None) -> Flo
2121
errors["base"] = "not_hex"
2222
else:
2323
try:
24-
if hex(int(user_input['code'], 16)).lower() != "0x" + user_input['code'].lower():
24+
if f"0x{int(user_input['code'],16):04x}" != "0x" + user_input['code'].lower():
2525
errors["base"] = "not_hex"
2626
except ValueError:
2727
errors["base"] = "not_hex"

0 commit comments

Comments
 (0)