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.
In your two payload examples (one for controlling the light and the other for the light’s status) they both use ‘“ON”’ to represent the state. However, your template uses true and false. Why?
According to the documentation, the default value for state_on is ON so it isn’t necessary to specify it in the switch’s configuration (similarly OFF is the default for state_off). That’s why I excluded state_on and state_off in my example.
Please mark my post with the ‘Solution’ tag to make it easier for others to find (I can’t do it; only you, the author of this topic, can mark a post as ‘Solution’). A checkmark will appear next to the topic’s title and a link to the post, containing the solution, will appear below the first post in this thread.
and the test switch’s state changed to on. That’s how it is supposed to work. The default value for state_on is ON so there’s no need to explicitly specify it in the light’s configuration.
I don’t understand why it doesn’t work for your light.
So now i hav another question
I have some seperate switches working fine to call different light effect. But for some of these effects you can choose a color. At the moment i have to click on the three dots on the top right corner of the standard light control, so that the color wheel etc. window pops up.
Is there a way to show this color wheel window by a lonf press on my effect switch (hold_action)?
I tried different something like this in a picture-elements card, but without success
I suggest creating a new topic because this second question is about configuring the Lovelace UI and is unrelated to your first question. By posting it as a new topic (with its own title and tagged with the ‘Lovelace & Frontend’ category) it is more likely to attract the attention of people who know the answer.
You can ask one of the moderators to move your last post to a new topic or just copy/paste it to a new topic and then delete the original one.