From 946b0cb9569ec445de17a0810e427cef0c824f51 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 29 Dec 2023 09:14:33 -1000 Subject: [PATCH] Handle non-str keys when sending commands --- roombapy/roomba.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roombapy/roomba.py b/roombapy/roomba.py index d6af564..0064462 100755 --- a/roombapy/roomba.py +++ b/roombapy/roomba.py @@ -221,7 +221,9 @@ def send_command(self, command, params=None): } roomba_command.update(params) - str_command = orjson.dumps(roomba_command).decode("utf-8") + # params may contain non-string keys, so we need to use the orjson + # OPT_NON_STR_KEYS option + str_command = orjson.dumps(roomba_command, option=orjson.OPT_NON_STR_KEYS).decode("utf-8") self.log.debug("Publishing Roomba Command : %s", str_command) self.remote_client.publish("cmd", str_command)