From 6afb71d8ad9677796a2184b6d0c53ba010a75d03 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Tue, 22 Sep 2020 13:34:26 +0200 Subject: [PATCH] always cast option to the correct type --- aiokef/aiokef.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aiokef/aiokef.py b/aiokef/aiokef.py index 85306b1..3c54166 100644 --- a/aiokef/aiokef.py +++ b/aiokef/aiokef.py @@ -603,7 +603,9 @@ async def get_sub_db(self) -> int: @retry(**_CMD_RETRY_KWARGS) async def _set_dsp(self, which, value) -> None: - i = DSP_OPTION_MAPPING[which].index(value) + 128 # "+ 128" seems to do nothing + options = DSP_OPTION_MAPPING[which] + as_type = type(options[0]) + i = options.index(as_type(value)) + 128 # "+ 128" seems to do nothing cmd = COMMANDS[f"set_{which}"](i) # type: ignore response = await self._comm.send_message(cmd) if response != _RESPONSE_OK: