Blueforcer / awtrix3

Custom firmware for the Ulanzi Smart Pixel clock or self made awtrix. Getting started is easy as 1-2-3
https://blueforcer.github.io/awtrix3/
Other
1.26k stars 109 forks source link

[BUG] MQTT prefix is used as client ID #390

Closed ahk97 closed 10 months ago

ahk97 commented 10 months ago

Bug report

Describe the bug

Awtrix light uses the configured "MQTT prefix" as the client ID when connecting to the MQTT broker.

This prevents two Awtrix devices with the same prefix connecting to the same broker

Additional information

To Reproduce

Steps to reproduce the behavior: Configure MQTT and check mosquitto log.

1699536844: New connection from 192.168.178.16:60894 on port 1883.
1699536844: Client awtrix/1 already connected, closing old connection.
1699536844: New client connected from 192.168.178.16:60894 as awtrix/1 (p2, c1, k15, u'awtrix2').
1699536844: New connection from 192.168.178.15:57297 on port 1883.
1699536844: Client awtrix/1 already connected, closing old connection.
1699536844: New client connected from 192.168.178.15:57297 as awtrix/1 (p2, c1, k15, u'awtrix1').

Expected behavior

The client should choose a unique ID (for example based on the MAC Address or hostname) or the Client ID should be configurable.

Additional context

It is necesessary to use the same prefix on two Displays to have them display the same content

Blueforcer commented 10 months ago

That's not a bug. It rises historical. And is used in lots of functions.

Standard Prefix/Client is a unique ID if you don't change it.

This behavior will not be changed because now hundreds of users would need to change their systems.

Just use different prefix to all your awtrix. It's also easier for you to differ the clocks in your automations.

ahk97 commented 10 months ago

Thanks for the feedback. But whats the purpose of using MQTT then. Then I could stick with HTTP. If I need to send the same app to 10 different displays in my house, I need 10 MQTT publish commands. The goal is to have one publish and all awtrix show the same information.

ahk97 commented 10 months ago

Should I submit a feature request for a configurable "subscribe to" topic?

Blueforcer commented 10 months ago

Let me think about it this afternoon. The Webinterface is shit and every change to it would force all users to reset their config.

ahk97 commented 10 months ago

I checked the MQTT documentation and it says the client identifier must be unique: https://www.ibm.com/docs/en/ibm-mq/9.3?topic=concepts-client-identifier

Also, just changing the client ID in the code to a unique value should not break any behavior. As long as the standard prefix (MQTT subscription topic) stays the same the functionality would stay the same as well.

Thanks!

Blueforcer commented 10 months ago

I know how mqtt works, but since today you're the first out of thousands users with this "issue".

HA discovery also uses the client ID. But as said before I need to check it if this could break something for existing users.