New: the AI firewall watches the whole platform and explains each incident in plain words. See how it works

Tutorial says broker = 192.168.x.x – what address do I put in for Hermetry?

Tutorial says broker = 192.168.x.x – what address do I put in for Hermetry?

Solved 4 3

Founder of a tiny logistics startup, I am NOT an engineer, trying to get a proof of concept done before an investor meeting. Raspberry Pi 4 with a temperature probe for a reefer trailer.

I followed a blog post with paho-mqtt. It has broker = "192.168.1.50" and port = 1883. What is Hermetry’s MQTT IP address? I created a device and copied the access token but I can’t find an IP anywhere. I tried the IP that comes back when I ping the host name on the device page and got on_connect rc=5. Also tried port 1883 with the host name, also rc 5.

Still waiting for the gateway to reconnect.
♥ 0

What exactly does the Connection details card on the device show you? Host and port?

♥ 0

A host name and 8883. So the 1883 in the blog is wrong for this?

Still waiting for the gateway to reconnect.
♥ 2

Yes. That blog is for a broker on your own home network, that’s why it has a 192.168 address. For Hermetry there’s no IP you should use at all: connect by the host name from the Connection details card, TLS on 8883. TLS needs the name (SNI), so the pinged IP fails, and plain 1883 is refused unless the profile allows plain MQTT, which it doesn’t by default. rc=5 is “not authorised”, and the actual reason ends up on the device’s Log tab, worth a look.

import ssl, json, paho.mqtt.client as mqtt

HOST = "<host from Connection details>"
TOKEN = "<access token>"

c = mqtt.Client(client_id="reefer-01")
c.username_pw_set(TOKEN)                  # token as username, no password
c.tls_set(cert_reqs=ssl.CERT_REQUIRED)    # normal public CA bundle
c.connect(HOST, 8883, keepalive=60)
c.loop_start()
c.publish("v1/telemetry", json.dumps({"temperature": -18.2}), qos=1)

With paho 2.x you need mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="reefer-01") instead.

Timestamps in UTC or it didn't happen.
Accepted solution♥ 2

Connected, -18.2 is on the device page. Log tab did say why the 1883 attempt failed (plain port not allowed), I just didn’t know it existed. Thank you, demo is Thursday.

Still waiting for the gateway to reconnect.
♥ 1
Viewing 5 posts – 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Join the conversation

Sign in to ask and answer, like helpful posts and mark the reply that solved your problem. Every contribution earns points and levels.

Share