Skip to content

Commit

Permalink
Handle non-str keys when sending commands
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Dec 29, 2023
1 parent 165c8fe commit 946b0cb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion roombapy/roomba.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 946b0cb

Please sign in to comment.