Hi there
Im trying to figure out, how i can get an switch with MQTT and Json to work.
The code on the ESP32 is from the example of Bruh Automation for an WS2812B LED Strip.
Im using Hass,io with Mosquitto Addon and ESPHome.
I changed the code to work with ESPHome and it works fine. I´ve got the Light Card working with all featueres and effects, but the Light is for my 5 years old daughter and she cant read
So i want to create picture cards or somithing like that for every lighteffect, so she can change things by herself. I thougt its the best way to send an MQTT message in Json format by pressing the switch and recieve a message for the state and effect of the light.
SAMPLE PAYLOAD(for switching the LEDs):
{
"brightness": 120,
"effect": "rainbow",
"state": "ON"
}
SAMPLE PAYLOAD(coming back form the ESP to HASS.io):
{
"state": "ON",
"color": {
"r": 255,
"g": 100,
"b": 100
},
"brightness": 120,
"effect": "rainbow",
}
This is the code from my Configuration.yaml but it doesn work. Can someone give me an hint please?
switch:
- platform: mqtt
name: "Treppe Rainbow"
state_topic: "hochbett/treppe"
command_topic: "hochbett/treppe/set"
value_template: "{{ value_json.state }}"
payload_on: '{"state":true,"efecct":"rainbow"}'
payload_off: '{"state":"false","effect":"solid"}'
state_on: "true"
state_off: "false"