Okay, I have a H801 LED Light strip Controller flashed with Tasmota. I am using it to control a CW/WW LED light strip.
I have the MQTT thing setup as:
Thing mqtt:topic:sonoff-vanity "Sonoff Xmas Front Bed" (mqtt:broker:Mosquitto) @ "MQTT" {
Channels:
Type switch : PowerSwitch "Switch" [ stateTopic="stat/sonoff-vanity/POWER",
commandTopic="cmnd/sonoff-vanity/POWER", on="ON", off="OFF" ]
Type number : CT "Color Temperature" [ stateTopic="tele/sonoff-vanity/STATE", transformationPattern="JSONPATH:$.CT",
commandTopic="cmnd/sonoff-vanity/CT", min=153, max=500]
}
Number vanity_CT "Shanna Vanity CT" (sonoff-vanity) {channel="mqtt:topic:sonoff-vanity:CT"}
Now here’s the issue. It’s the stateTopic. With stateTopic of tele/sonoff-vanity/STATE that means when the H801 first gets power, after a few minutes–and every 5 or so minutes there after–it will public a tele topic with various information in the message and vanity_CT will get updated. So after reboot and a few minutes, openhab knows the state of the H801 color temperature.
Now let’s suppose someone updates the color temperature outside of openhab. Either via the H801’s web interface, it’s api, or whatever. In that case the H801 publishes a stat/sonoff-vanity/RESULT message that containts the current color temperature.
Can I code the “thing” so that it listens to multiple MQTT topics for the same value? Is there another way to do this?
Because if I listen for the tele update, that will guarantee that after update, it will after a few minutes get the current state. But has the side effect that if the current state is updated outside of openhab, it will always take a few minutes for openhab to be aware of the updated state.
But if I listen for the stat topic, then I will get immediate updates when the color temp is updated outside of openhab, but on reboot of the H801 I will not learn it’s current status until it has been updated via openhab or a different mechanism.
Ideas?