-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
[bug] Zwavejs2mqtt is listening to more topics than needed #361
Comments
I found this code, which should always subscribe to a Also. Isn't there a bug here?.. If the client is not connected, the topic is pushed to the So if a connection is dropped while subscribing, the remaining topics are added to the list itself, potentially creating an infinite loop. |
Oh - I found the place. So the this.client.subscribe([this.config.prefix, CLIENTS_PREFIX, this.clientID, 'api', '+', 'set'].join('/');
this.client.subscribe([this.config.prefix, CLIENTS_PREFIX, this.clientID, 'broadcast', '+', 'set'].join('/');
this.client.subscribe([this.config.prefix, CLIENTS_PREFIX, this.clientID, 'broadcast', '+', '+', 'set'].join('/');
this.client.subscribe([this.config.prefix, CLIENTS_PREFIX, this.clientID, 'broadcast', '+', '+', '+', 'set'].join('/'); |
There's potentially another bug. The But |
This wouldn't cover the case when the gateway is in 'manual' mode. The topic could have infinite levels. Having a |
Why this? The subscriptions are restored both if clean is true or false. The only difference is that if clean is false it will also receive messages while it was offline as the session is persistent |
That's almost impossible as everything is sync in that part but I could fix it by deep copy the subscribe object |
As I understand it, in a clean session:
I just tested on mosquitto, that clean sessions mean the subscriptions are disregarded. Whereas a non-clean session will keep subscriptions (without resubscribing). I'll see if I can reproduce this in z2m. |
It's odd. Clean sessions are enabled in my settings page, but when I restarted my broker and pushed a message - it was received after the reconnect as well.. I'm not entirely sure why this works - but it's probably fine. :O
|
Aha!.. Node-js mqtt:
We're good. :) |
Version
Build/Run method
zwavejs2mqtt version: 1.0.0-rc.1+423a7e7.423a7e7
zwavejs version: 6.1.0-5d49c45
Describe the bug
I was playing with an API, and noticed that the debug log showed the API response as received by zwavejs2mqtt itself. This seems excessive, and unecessary. So I think this app is subscribing to too many/broad topics.
Example log where I publish a message to a */set topic, after which the API response is received by the app.
To Reproduce
Publish a message to
zwavejs2mqtt/_CLIENTS/ZWAVE_GATEWAY-HomeMQTT/api/pollValue
and observe the app reacting to it.Also, publishing to
../set
produces two received messages - both the command, and the response itself.Expected behavior
Zwavejs2mqtt does not subscribe to topics it doesn't need.
Additional context
N/A
The text was updated successfully, but these errors were encountered: