Skip to content

Commit

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

Please sign in to comment.