Hi folks,
maybe I’m blind, but how does one send a state to an esphome mqtt topic?
I’m using this on a wemos D1 (ESP8266) to control a connected argb led-strip…
this is what I can sniff from my mqtt broker
topic: argb_controller_01/light/fastled_ws2812b_light/state
{"effect":"None","state":"OFF","brightness":168,"color":{"r":255,"g":255,"b":255}}
so I added this to my mqtt.things
// argb_controller_01
Thing topic ARGB-Controller-01 "MQTT - ARGB-Control-01" @ "None" {
Channels:
Type string : effect "Lichteffect" [
stateTopic="argb_controller_01/light/fastled_ws2812b_light/state",
transformationPattern="JSONPATH:$.effect"
]
Type switch : state "ONOFF State" [
stateTopic="argb_controller_01/light/fastled_ws2812b_light/state",
transformationPattern="JSONPATH:$.state"
]
Type string : brightness "Brightness" [
stateTopic="argb_controller_01/light/fastled_ws2812b_light/state",
transformationPattern="JSONPATH:$.brightness"
]
Type string : colors-r "Red" [
stateTopic="argb_controller_01/light/fastled_ws2812b_light/state",
transformationPattern="JSONPATH:$.color.r"
]
Type string : colors-g "Green" [
stateTopic="argb_controller_01/light/fastled_ws2812b_light/state",
transformationPattern="JSONPATH:$.color.g"
]
Type string : colors-b "Blue" [
stateTopic="argb_controller_01/light/fastled_ws2812b_light/state",
transformationPattern="JSONPATH:$.color.b"
]
}
and these items
// ARGB-Controller-01
String ARGBControlEffect "Light-Effect" <none> (gARGB01) { channel="mqtt:topic:MosquittoMqttBroker:ARGB-Controller-01:effect" }
Switch ARGBControlState "Switch" <none> (gARGB01) { channel="mqtt:topic:MosquittoMqttBroker:ARGB-Controller-01:state" }
String ARGBControlBrightness "Brightness" <none> (gARGB01) { channel="mqtt:topic:MosquittoMqttBroker:ARGB-Controller-01:brightness" }
String ARGBControlColorR "Color R" <none> (gARGB01) { channel="mqtt:topic:MosquittoMqttBroker:ARGB-Controller-01:colors-r" }
String ARGBControlColorG "Color G" <none> (gARGB01) { channel="mqtt:topic:MosquittoMqttBroker:ARGB-Controller-01:colors-g" }
String ARGBControlColorB "Color B" <none> (gARGB01) { channel="mqtt:topic:MosquittoMqttBroker:ARGB-Controller-01:colors-b" }
so far so good, I can display all item states but how do I change a state? I can’t find a command topic,
how can I do this??
thanks
Dan