Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT broken in latest versions of the firmware #49

Closed
peter-mount opened this issue Sep 2, 2022 · 1 comment
Closed

MQTT broken in latest versions of the firmware #49

peter-mount opened this issue Sep 2, 2022 · 1 comment

Comments

@peter-mount
Copy link

Having updated the firmware to a latest release (yes I know it's not final yet) on my Enviro Urban board I found that it stopped sending to my MQTT broker.

After some digging I found in enviro/destinations/mqtt.py you have

    mqtt_client.publish(f"enviro/{nickname}", reading, retain=True)

This fails as reading is not a json object.

By changing it to the following

    mqtt_client.publish(f"enviro/{nickname}", ujson.dumps(reading), retain=True)

and adding import ujson to the top of the script fixes it so that the reading is sent correctly to the broker.

Side note for anyone else trying to debug MQTT: Because you have the try block written with:

  except:
    pass

hid the error so the log just said it failed. Changing it to:

  except Exception as e:
      print(e)

at least allowed the error to be visible and enabled me to find this.

lowfatcode added a commit that referenced this issue Sep 3, 2022
@lowfatcode
Copy link
Member

Hey @peter-mount thanks for the pointer! Fixed in 871d94b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants