corbanmailloux / esp-mqtt-rgb-led

MQTT RGB LEDs Using JSON for Home Assistant
MIT License
270 stars 74 forks source link

Can this be used with cloud mqtt #54

Closed Ameengray closed 5 years ago

Ameengray commented 5 years ago

HI is this limited to Home Assistant, can we use this with cloud mqtt ? I see only one topic when the device connects to the server, what messages do we have send to change the state of the device ?

depuits commented 5 years ago

In the code you can find these sample payloads to adjust the state of the device.

SAMPLE PAYLOAD (BRIGHTNESS):
{
  "brightness": 120,
  "flash": 2,
  "transition": 5,
  "state": "ON"
}
SAMPLE PAYLOAD (RGBW):
{
  "brightness": 120,
  "color": {
    "r": 255,
    "g": 100,
    "b": 100
  },
  "white_value": 255,
  "flash": 2,
  "transition": 5,
  "state": "ON",
  "effect": "colorfade_fast"
}

This example can be found here and the actual parsing of the json currently happens here.

corbanmailloux commented 5 years ago

Thanks for responding, @depuits. The other place I would suggest taking a look at is the Home Assistant docs for the JSON light. Even if you aren't using Home Assistant, it does document the payload format.

And to answer the overall question: Yes, I built this initially with Home Assistant in mind, but it should be perfectly usable with anything else that can speak MQTT.