Skip to content

/json/state updates with v: true not published to MQTT #4643

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

Open
1 task done
chatziko opened this issue Apr 15, 2025 · 6 comments
Open
1 task done

/json/state updates with v: true not published to MQTT #4643

chatziko opened this issue Apr 15, 2025 · 6 comments

Comments

@chatziko
Copy link

chatziko commented Apr 15, 2025

What happened?

When the "v": true option is passed to /json/state API, the updated values are not published to MQTT. If "v" is missing then the MQTT updates are published as expected.

This is always reproducible under both 0.15.1.beta2 and 0.14.4.

To Reproduce Bug

  • Enable MQTT
  • curl -X POST "http://<host>/json/state" -d '{"bri": 91, "on": true,"v":true}' -H "Content-Type: application/json"
  • Observe the MQTT topics not getting updated
  • curl -X POST "http://<host>/json/state" -d '{"bri": 100, "on": true}' -H "Content-Type: application/json"
  • Observe the update being published to MQTT

Expected Behavior

Updates with "v": true should be published to MQTT.

Install Method

Binary from WLED.me

What version of WLED?

0.15.1.beta2

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@DedeHai
Copy link
Collaborator

DedeHai commented Apr 15, 2025

AFAIK WLED has not special treatment for HA. If HA uses the API incorrectly, not much we can do.

@blazoncek
Copy link
Collaborator

There are two aspects when MQTT message is not published: one is cooldown the other is WS only notification.
Cooldown prevents spamming interfaces with frequent updates. Will not change.
WS only notifications are intended to notify WS clients only. HA is not WS client AFAIK.

@chatziko chatziko changed the title MQTT not updated when interacting with the HA integration /json/state updates with v: true not published to MQTT Apr 15, 2025
@chatziko
Copy link
Author

Thanks for the response, after some digging intro the HA code I isolated the problem, updates are not sent when "v": true is passed to /json/state. I updated the issue to reflect this.

@blazoncek
Copy link
Collaborator

This is intentional. "v" is verbose response, meaning client is interested in getting the state response.

@blazoncek blazoncek removed the bug label Apr 15, 2025
@chatziko
Copy link
Author

This is intentional. "v" is verbose response, meaning client is interested in getting the state response.

But then what's the point of subscribing to MQTT? Whoever subscribed is also interested in the same info.

Moreover, websocket clients get the updates even when "v" is set, why are they different than MQTT clients?

@blazoncek
Copy link
Collaborator

Not my code and can't judge why it was implemented so. Feel free to provide a patch.

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

3 participants