Skip to content

Commit

Permalink
Fix payload generation bug (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachya authored Apr 28, 2022
1 parent 0476307 commit 2f3c5b0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ecowitt2mqtt/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ async def _async_publish_to_topic(
def _generate_payload(data: Union[Dict[str, Any], float, str]) -> bytes:
"""Generate a binary MQTT payload from input data."""
if isinstance(data, dict):
value = json.dumps(data, default=_json_serial)
data = json.dumps(data, default=_json_serial)
elif not isinstance(data, str):
value = str(data)
return value.encode("utf-8")
data = str(data)
return data.encode("utf-8")


def _json_serial(obj: Any) -> Any:
Expand Down

0 comments on commit 2f3c5b0

Please sign in to comment.