Skip to content

Feature Request: Configurable MQTT client IDs for parallel GroBro instances #142

@nixo2

Description

@nixo2

Hi, and thank you for your great work on GroBro — it’s an essential part of my local NOAH/Growatt monitoring setup.

I would like to request a small but important feature related to MQTT client IDs, which would enable running multiple GroBro instances in parallel.


Problem

When running two GroBro instances (e.g., production + test) against the same MQTT source broker, both instances currently use the same MQTT client IDs:

grobro-grobro

grobro-ha

This leads to a standard MQTT conflict:

The broker disconnects an existing client when another client connects using the same client ID.

As a result, two GroBro instances cannot receive all packets reliably.
Here is an excerpt from my Mosquitto log showing the duplicate client IDs:

New client connected from 172.19.0.1:42028 as grobro-ha (p2, c1, k60)
New client connected from 172.19.0.1:50494 as grobro-grobro (p5, c1, k60)
New client connected from 172.19.0.1:35904 as grobro-ha (p2, c1, k60)
New client connected from 172.19.0.1:48258 as grobro-grobro (p5, c1, k60)

This makes it impossible to run two GroBro versions in parallel for testing or comparison.


Why this matters

There are several common use cases where multiple parallel instances are useful:

Testing a new GroBro release alongside the stable version

Comparing behavior or debugging

Running production and lab/debug setups simultaneously

Running multiple instances with different Home Assistant base topics

Currently, all of these setups result in MQTT disconnections due to identical client IDs.


Requested Feature

Please make both MQTT client IDs configurable via environment variables, e.g.:

SOURCE_MQTT_CLIENT_ID

TARGET_MQTT_CLIENT_ID

Suggested behavior:

If the variable is not set, use the current built-in default

If it is set, override it and use the specified client ID

Example Docker configuration:

Production

SOURCE_MQTT_CLIENT_ID=grobro-prod-src
TARGET_MQTT_CLIENT_ID=grobro-prod-target

Test instance

SOURCE_MQTT_CLIENT_ID=grobro-test-src
TARGET_MQTT_CLIENT_ID=grobro-test-target

This would fully prevent collisions and allow two or more GroBro instances to connect safely to the same source broker.

Alternative

A less flexible fallback would be to include the version number in the default client IDs (e.g., grobro-source-v2.1.0).
However, configurable client IDs would be the most robust and general solution.

Adding optional client-ID configuration would greatly improve flexibility and make GroBro safer to use in real-world environments where parallel operation (for testing or comparison) is needed.

Thanks again for your work!

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestnext-releaseIssues that need to be fixed before Nest release

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions