Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Updating state over MQTT #110

Closed
Boeeerb opened this issue Mar 23, 2018 · 4 comments
Closed

Updating state over MQTT #110

Boeeerb opened this issue Mar 23, 2018 · 4 comments
Assignees

Comments

@Boeeerb
Copy link

Boeeerb commented Mar 23, 2018

I've been playing with the standard MQTT and HA implementation controls, but I still use the web controller for some actions, and noticed that an update is sent to the HA MQTT topic, with state, colours and brightness etc when there is a web controller change, but nothing is sent for the non-HA MQTT.

Would this be an easy addition? I haven't had chance to dive in properly yet, but if I get chance I'll make some changes and create a PR if I'm successful!

@toblum
Copy link
Owner

toblum commented Mar 23, 2018

Hi @Boeeerb,

yes, this might be. This is because HA-MQTT wad implemented by @debsahu and he did it a bit better then my original MQTT implementation.
But why don't you enable "ENABLE_HOMEASSISTANT" and use what's generated in the respective outpu channel then?

Regards
Tobias

@toblum toblum self-assigned this Mar 23, 2018
@debsahu
Copy link
Collaborator

debsahu commented Mar 23, 2018

I can fix this. I will add the lines needed to WebSockets callback.

EDIT: Not so easy, MQTT sends back replies based on what it receives. Like "$" payload gives different information than "~". So from WebSockets callback you want which info back?

@Boeeerb
Copy link
Author

Boeeerb commented Mar 23, 2018

Thanks @debsahu and @toblum, the part that is missing that your update included is requests for any change. I'll try and describe best as I can so it makes sense...

I kept HomeAutomation enabled to play with, purely to watch the extra information through MQTTbox subscribing to #. Any request through OpenHAB or MQTTbox to the topic resulted in a response, such as sending;

  • %200
    Responds with 2 messages;
  • OK %200
  • {"state":"ON","color":{"r":128,"g":128,"b":128},"brightness":200,"effect":"Static"}

As I am playing with OpenHAB, using the OK %200 response fits in much easier than breaking down the full JSON output to update the sliders. If I update any setting through the McLighting web page, I get the HA JSON response only, not the original MQTT message.

Hopefully this will bring both methods to a similar level of functionality

@toblum
Copy link
Owner

toblum commented Mar 30, 2018

@debsahu Thank you for implementing this!
@Boeeerb I hope everything is fine now for you...

@toblum toblum closed this as completed Mar 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants