Loose minor MQTT oddities #38

Closed
opened 2026-10-05 01:54:21 +02:00 by adam · 13 comments
Owner

A bunch of loose minor random MQTT things I've noticed.

Client Version Format

I see other projects use the format {name}/{version}-{hash}.

Client Version Missing

Looking at LetsMesh (https://analyzer.letsmesh.net/status/observers), sometimes I "RemoteTerm (github.com/jkingsman/Remote-Terminal-for-MeshCore)" or "RemoteTerm unknown". There even is a "Remote Term 3.2.0".

My own observer seems to show "RemoteTerm unknown".

I'm pretty sure the importlib.metadata.version() call inside _get_client_version() needs something more than the pyproject.toml, but damned if I can remember what. Copilot states that there needs to be a project install/packaging step, but that doesn't ring any bells.

Trace in Debug Log

Was poking around api/debug and spotted this log message:

    "2026-03-17 14:35:18 - app.fanout.mqtt_base - WARNING - Community MQTT publish failed on meshcore/<redacted>/<redacted>/packets: [code:4] The client is not currently connected.\naiomqtt.exceptions.MqttCodeError: [code:128] Unspecified error\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File \"/app/app/fanout/mqtt_base.py\", line 90, in publish\n    await self._client.publish(topic, json.dumps(payload), retain=retain)\n  File \"/app/.venv/lib/python3.12/site-packages/aiomqtt/client.py\", line 112, in decorated\n    return await method(self, *args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/app/.venv/lib/python3.12/site-packages/aiomqtt/client.py\", line 504, in publish\n    raise MqttCodeError(\naiomqtt.exceptions.MqttCodeError: [code:4] The client is not currently connected.",

I have two Community MQTT hooks set up (same MQTT topic format, different hosts), so I'm not sure which one was unhappy.

I'm assuming it self-recovered (since the UI and debug shows both fanout_statuses as "connected"), and the Community sites show packets being received.

A bunch of loose minor random MQTT things I've noticed. ## Client Version Format I see other projects use the format `{name}/{version}-{hash}`. ## Client Version Missing Looking at LetsMesh (https://analyzer.letsmesh.net/status/observers), sometimes I "RemoteTerm (github.com/jkingsman/Remote-Terminal-for-MeshCore)" or "RemoteTerm unknown". There even is a "Remote Term 3.2.0". My own observer seems to show "RemoteTerm unknown". I'm pretty sure the `importlib.metadata.version()` call inside `_get_client_version()` needs something more than the `pyproject.toml`, but damned if I can remember what. Copilot states that there needs to be a project install/packaging step, but that doesn't ring any bells. ## Trace in Debug Log Was poking around `api/debug` and spotted this log message: ``` "2026-03-17 14:35:18 - app.fanout.mqtt_base - WARNING - Community MQTT publish failed on meshcore/<redacted>/<redacted>/packets: [code:4] The client is not currently connected.\naiomqtt.exceptions.MqttCodeError: [code:128] Unspecified error\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/app/fanout/mqtt_base.py\", line 90, in publish\n await self._client.publish(topic, json.dumps(payload), retain=retain)\n File \"/app/.venv/lib/python3.12/site-packages/aiomqtt/client.py\", line 112, in decorated\n return await method(self, *args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.12/site-packages/aiomqtt/client.py\", line 504, in publish\n raise MqttCodeError(\naiomqtt.exceptions.MqttCodeError: [code:4] The client is not currently connected.", ``` I have two Community MQTT hooks set up (same MQTT topic format, different hosts), so I'm not sure which one was unhappy. I'm assuming it self-recovered (since the UI and debug shows both fanout_statuses as "connected"), and the Community sites show packets being received. <!-- github-sync-id:4089418565 -->
adam closed this issue 2026-10-05 01:54:21 +02:00
Author
Owner

Ah yeah we can probably normalize our version.

There are some oddities on how the version is derived in a few places in the code; I think on non-release commits, the version will come back as unknown and we should probably fix that to be more clearly unified.

That trace is pretty typical to see an just means that there was a network issue and the connection was lost; it should usually resume pretty smoothly unless the host is unreachable. I think I'll probably keep the stack trace but add a message that this is normal, occasionally, as networks are not perfect, and that it should only be a concern if you see it super frequently.

Ah yeah we can probably normalize our version. There are some oddities on how the version is derived in a few places in the code; I think on non-release commits, the version will come back as unknown and we should probably fix that to be more clearly unified. That trace is pretty typical to see an just means that there was a network issue and the connection was lost; it should usually resume pretty smoothly unless the host is unreachable. I think I'll probably keep the stack trace but add a message that this is normal, occasionally, as networks are not perfect, and that it should only be a concern if you see it super frequently. <!-- github-comment-id:4076782786 -->
Author
Owner

Bugfix: wrap MQTT connection issues in some context that they indicate underlying network issues, and happen occasionally and are likely not an issue unless there are a lot of them.

Bugfix: wrap MQTT connection issues in some context that they indicate underlying network issues, and happen occasionally and are likely not an issue unless there are a lot of them. <!-- github-comment-id:4076786895 -->
Author
Owner

Updated to latest; looks like my client version shows "Remote term 3.4.1" now.

I do think there's still a tweak needed for at least the CommunityMQTT value. Paging around the LetsMesh site, it collates "client ID". So for example RemoteTerm/3.4.1 and RemoteTerm/1.2.3 can be grouped by RemoteTerm and then sub grouped by version.

Updated to latest; looks like my client version shows "Remote term 3.4.1" now. I do think there's still a tweak needed for at least the CommunityMQTT value. Paging around the LetsMesh site, it collates "client ID". So for example `RemoteTerm/3.4.1` and `RemoteTerm/1.2.3` can be grouped by `RemoteTerm` and then sub grouped by version. <!-- github-comment-id:4080167817 -->
Author
Owner

Hm, do you have a link to how those collate? Curious what I'm missing. Found it. https://analyzer.letsmesh.net/status/observers

~~Hm, do you have a link to how those collate? Curious what I'm missing.~~ Found it. https://analyzer.letsmesh.net/status/observers <!-- github-comment-id:4085143373 -->
Author
Owner

Okay handled that in ffc5d75. Lemme know if that shoes up better for you. Vanilla name as client, actual version as version.

Okay handled that in ffc5d75. Lemme know if that shoes up better for you. Vanilla name as client, actual version as version. <!-- github-comment-id:4086683340 -->
Author
Owner

Not entirely sure that's correct.

Updated to v3.4.1·d8e22ef.

Now https://analyzer.letsmesh.net/status/observers shows:
Image

[edit -- not entirely sure this screenshot was correct; it takes a bit for LetsMesh to update some of the page state]

So while it's "different", probably not correct -- since unknown version.

Reverse Engineering

Doing some reverse-engineering, here's the tool referenced by LetsMesh directly: https://github.com/agessaman/meshcore-packet-capture

https://github.com/agessaman/meshcore-packet-capture/blob/4b471c452106f7503ca25a90141ec8657d536625/packet_capture.py#L693
Shows for example f"meshcore-packet-capture/{installer_ver}-{git_hash}"

And called from https://github.com/agessaman/meshcore-packet-capture/blob/4b471c452106f7503ca25a90141ec8657d536625/packet_capture.py#L2269

Which would correspond to:
Image

Not entirely sure that's correct. Updated to v3.4.1·d8e22ef. Now https://analyzer.letsmesh.net/status/observers shows: <img width="276" height="102" alt="Image" src="https://github.com/user-attachments/assets/92d65dcd-60b3-4e3b-b2e2-e92150f1f108" /> [edit -- not entirely sure this screenshot was correct; it takes a bit for LetsMesh to update some of the page state] So while it's "different", probably not correct -- since `unknown` version. ## Reverse Engineering Doing some reverse-engineering, here's the tool referenced by LetsMesh directly: https://github.com/agessaman/meshcore-packet-capture https://github.com/agessaman/meshcore-packet-capture/blob/4b471c452106f7503ca25a90141ec8657d536625/packet_capture.py#L693 Shows for example `f"meshcore-packet-capture/{installer_ver}-{git_hash}"` And called from https://github.com/agessaman/meshcore-packet-capture/blob/4b471c452106f7503ca25a90141ec8657d536625/packet_capture.py#L2269 Which would correspond to: <img width="281" height="110" alt="Image" src="https://github.com/user-attachments/assets/c7e8f247-ed76-4b04-9d1f-2b66d1d377eb" /> <!-- github-comment-id:4086894970 -->
Author
Owner

Summary...

  • "RemoteTerm 3.4.1" showed up on LetsMesh as "RemoteTerm 3.4.1" (and clickdown had "unknown")
  • "RemoteTerm" shows "RemoteTerm" (and clickdown had "unknown")
  • "RemoteTerm (github.com/jkingsman/Remote-Terminal-for-MeshCore)" shows "RemoteTerm (github.com" (and clickdown had "jkingsman/Remote-Terminal-for-MeshCore)"

ah-ha -- that proves the first / is important. So they're definitely following the "User-Agent schema format" (whatever it's really callled) -- <product> / <product-version>

Summary... * "RemoteTerm 3.4.1" showed up on LetsMesh as "RemoteTerm 3.4.1" (and clickdown had "unknown") * "RemoteTerm" shows "RemoteTerm" (and clickdown had "unknown") * "RemoteTerm (github.com/jkingsman/Remote-Terminal-for-MeshCore)" shows "RemoteTerm (github.com" (and clickdown had "jkingsman/Remote-Terminal-for-MeshCore)" ah-ha -- that proves the first `/` is important. So they're definitely following the "User-Agent schema format" (whatever it's really callled) -- `<product> / <product-version>` <!-- github-comment-id:4086911661 -->
Author
Owner

Ahhhh, helpful extraction! Thank you!

Ahhhh, helpful extraction! Thank you! <!-- github-comment-id:4086915488 -->
Author
Owner

I patched my local copy to use f"RemoteTerm/{get_app_build_info().version}"; looks right on bostonme.sh's MQTT observer. LetsMesh hasn't refreshed that part of the data yet (not sure what their backend update interval is).

edit: Oop; it just updated: Client: RemoteTerm/3.4.1
Image

I patched my local copy to use `f"RemoteTerm/{get_app_build_info().version}"`; looks right on bostonme.sh's MQTT observer. LetsMesh hasn't refreshed that part of the data yet (not sure what their backend update interval is). edit: Oop; it just updated: `Client: RemoteTerm/3.4.1` <img width="281" height="110" alt="Image" src="https://github.com/user-attachments/assets/2264957b-c533-415b-a3a5-7121d833c9e6" /> <!-- github-comment-id:4086976237 -->
Author
Owner

Yay for (lack of) documentation! Hobby-code is just as great as work-code!

Yay for (lack of) documentation! Hobby-code is just as great as work-code! <!-- github-comment-id:4086988051 -->
Author
Owner

eyyy awesome. Will get that pushed up in a bit; working on parsing PATH packets right now

eyyy awesome. Will get that pushed up in a bit; working on parsing PATH packets right now <!-- github-comment-id:4086999484 -->
Author
Owner

Oh forgot to show the improved MQTT error log line.

Image
Oh forgot to show the improved MQTT error log line. <img width="1263" height="326" alt="Image" src="https://github.com/user-attachments/assets/bd4f1055-7e61-42b6-84a2-a6f145ab5232" /> <!-- github-comment-id:4087381021 -->
Author
Owner

Just documenting usage, now that version tracking is working.
ImageImage

You got folks updating regularly!

Just documenting usage, now that version tracking is working. <img width="258" height="435" alt="Image" src="https://github.com/user-attachments/assets/e29e9f00-4198-467e-b7aa-e7c66e2d9420" /><img width="256" height="179" alt="Image" src="https://github.com/user-attachments/assets/a7e6513c-5b10-4193-b06b-f9eda49228d7" /> You got folks updating regularly! <!-- github-comment-id:4098654202 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Remote-Terminal-for-MeshCore#38