Hi there,
I would like to do the same as described in this thread.
Unfortunately, I’m facing problems with adopting this to the new mqtt 2.4 binding.
So, the aim is to send a mqtt command from openhab to the H801 controller.
// .items
Number test_mqtt_led
// .sitemap
Frame label="MQTT send" {
Switch item=test_mqtt_led mappings=[3="grün", 2="rot", 1="blau", 0="Aus"]
}
// .rules
rule "MQTT send"
when
Item test_mqtt_led changed
then
switch (test_mqtt_led.state as DecimalType) {
case 0 : {
// send power = off via mqtt
logInfo("RULE", "--> LED: AUS")
}
case 1 : {
// send color = 1 via mqtt
logInfo("RULE", "--> LED: 1")
}
case 2 : {
// send color = 2 via mqtt
logInfo("RULE", "--> LED: 2")
}
case 3 : {
// send color = 3 via mqtt
logInfo("RULE", "--> LED: 3")
}
}
end
Instead of the comment lines // send ...
the mqtt command should be there.
For example if case = 1 color should be set to 1.
In tasmota console of H801 it is possible with color 1
The output is:
tasmota/sonoff-2550-h801/stat/RESULT = {"POWER":"ON","Dimmer":100,"Color":"FF00000000","HSBColor":"0,100,100","Channel":[100,0,0,0,0],"CT":327}
My mqtt broker is defined as Bridge mqtt:broker:mosquitto
in .things file.
The H801 thing is
Thing topic h801_2550 "LED H801 #1 (sonoff-2550-h801)" @ "MQTT" {
Channels:
Type switch : h801_2550_switch "LED H801 #1: Power Switch" [ stateTopic="tasmota/sonoff-2550-h801/stat/POWER", commandTopic="tasmota/sonoff-2550-h801/cmnd/POWER", on="ON", off="OFF" ]
Type colorHSB : h801_2550_color "LED H801 #1: Farbe" [ stateTopic="tasmota/sonoff-2550-h801/stat/RESULT/HSBColor", commandTopic="tasmota/sonoff-2550-h801/cmnd/HSBColor" ]
Type string : h801_2550_reachable "LED H801 #1: Reachable" [ stateTopic="tasmota/sonoff-2550-h801/tele/LWT" ]
Type number : h801_2550_rssi "LED H801 #1: Empfang: RSSI" [ stateTopic="tasmota/sonoff-2550-h801/stat/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
}