Hi,
I'm trying to use MQTT-Dash in combination with the
esp8266_milight_hub project from sidoh and a mosquitto server running on my pc.
I'm simply trying to turn on/off a lamp and get the status of the lamp from the mosquitto server.
to get the status, i subscribe to "milight/states/" and get the following json as result:
{"state":"OFF","brightness":255,"mode":2,"bulb_mode":"scene","color":{"r":255,"g":255,"b":255}}
to turn the lamp on or off, i publish to "milight" the following json:
{"state":"OFF"}
As I understand, those json messages must be the same to get the MQTT-Dash button to work correctly? I can use $.state the get the value "ON", or "OFF" from the state, but then only that is send when i try to publish a new state.
Is there a way (with javascript?) to either filter the response from the subscription or to format the payload i want to publish, so that they are the same?
Do you have some javascript examples that modify the payload in any way?
Thanks!