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

Make "MQTT Client ID as a gateway ID source" optional #211

Open
mullerch opened this issue Aug 15, 2022 · 1 comment
Open

Make "MQTT Client ID as a gateway ID source" optional #211

mullerch opened this issue Aug 15, 2022 · 1 comment

Comments

@mullerch
Copy link
Contributor

Actually, if we set client_id in the MQTT auth, the CSGB will try to use it as the gateway ID:

if gatewayID := b.auth.GetGatewayID(); gatewayID != nil {
.

  • If the client ID is not an EUI64, a warning is printed.
  • If the client ID is an EUI64, it's used as the gateway ID

This only covers the very specific use case where the gateway ID has to be taken from the client ID. If we just want the client ID to be set, we either have the gateway ID overridden or a warning printed. This behavior should be documented.

My suggestion is to add an option. Either a use_client_id_as_gateway_id=boolean in the mqtt section or a gateway_id_source=string (backend/mqtt_client_id) in the integration section. This way a fatal error can be generated if the target configuration is inconsistent.

@brocaar
Copy link
Collaborator

brocaar commented Aug 16, 2022

The use-case for this is the last will and testament feature, as in this case we must know the gateway id before connecting to the MQTT broker (as the LWT is a connection parameter).

I would like to avoid adding more config options for the sake of complexity, but I agree that this could be documented better.

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