openLuup: Tasmota MQTT Bridge
-
That’s great, thanks on behalf of all future users!
AFAIK, you don’t need to enable the PublishVariableUpdates MQTT option in order for the Tasmota bridge to work (since it is, itself, only one-way) although you may need it for other purposes.
@akbooer speaking of this, are you ok if I release a simple plugin to push data from Veras to openluup UDP? I have one in my system and it’s working flawlessly. I could port it easily. I just need a flag to disable polling from VeraBridge. It’s ok to call Vera’s endpoint to update status.
-
Yes, fine with that! So you just need the existing bridge to create the devices, and control them, but use UDP to update them?
I’m doing this with scene controllers myself, at the moment.
@akbooer No errors in 2021.04.18. Thanks for this as the changes also stabilized my Mosquitto bridge connection, which tended to flop with every error message.
2021-04-18 15:29:04.173 luup.tasmota:262: Topic ignored : tele/power_ServerWork/LWT : Online 2021-04-18 15:29:04.175 luup.tasmota:262: Topic ignored : tele/power_MainVera/LWT : Online 2021-04-18 15:29:04.176 luup.tasmota:262: Topic ignored : tele/power_HAServer/LWT : Online 2021-04-18 15:29:04.177 luup.tasmota:262: Topic ignored : tele/power_SideLandscape/LWT : Online 2021-04-18 15:29:04.178 luup.tasmota:262: Topic ignored : tele/power_GarageVera/LWT : Online
-
Yes, fine with that! So you just need the existing bridge to create the devices, and control them, but use UDP to update them?
I’m doing this with scene controllers myself, at the moment.
-
@akbooer No errors in 2021.04.18. Thanks for this as the changes also stabilized my Mosquitto bridge connection, which tended to flop with every error message.
2021-04-18 15:29:04.173 luup.tasmota:262: Topic ignored : tele/power_ServerWork/LWT : Online 2021-04-18 15:29:04.175 luup.tasmota:262: Topic ignored : tele/power_MainVera/LWT : Online 2021-04-18 15:29:04.176 luup.tasmota:262: Topic ignored : tele/power_HAServer/LWT : Online 2021-04-18 15:29:04.177 luup.tasmota:262: Topic ignored : tele/power_SideLandscape/LWT : Online 2021-04-18 15:29:04.178 luup.tasmota:262: Topic ignored : tele/power_GarageVera/LWT : Online
-
@akbooer I am now testing my Tasmota IR Tranceiver with the Tasmota Mqtt Bridge on my test Pi running OpenLuup v21.4.29b.
Link to Tasmota IR documentation.When looking in the Console the Tasmota sends the following messages when I start it:
00:00:03 MQT: Attempting connection... 00:00:03 MQT: Connected 00:00:03 MQT: tele/TasmotaIR/LWT = Online (retained) 00:00:03 MQT: cmnd/TasmotaIR/POWER = 00:00:03 MQT: tele/TasmotaIR/INFO1 = {"Module":"Generic","Version":"9.1.0(ir)","FallbackTopic":"cmnd/TasmotaIR_fb/","GroupTopic":"cmnd/tasmotas/"} 00:00:03 MQT: tele/TasmotaIR/INFO2 = {"WebServerMode":"Admin","Hostname":"TasmotaIR-2895","IPAddress":"192.168.1.59"} 00:00:03 MQT: tele/TasmotaIR/INFO3 = {"RestartReason":"Software/System restart"} 00:00:06 QPC: Reset 00:00:07 MQT: tele/TasmotaIR/STATE = {"Time":"1970-01-01T00:00:07","Uptime":"0T00:00:09","UptimeSec":9,"Vcc":3.069,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":29,"MqttCount":1,"Wifi":{"AP":1,"SSId":"BeachAC","BSSId":"FC:EC:DA:D1:7A:64","Channel":11,"RSSI":66,"Signal":-67,"LinkCount":1,"Downtime":"0T00:00:03"}}
It does however not show up as a Tasmota child device in OpenLuup for some reason.
The idea is to use it for my HVAC, the following message is received when I press a button on the remote:
17:53:29 MQT: tele/TasmotaIR/RESULT = {"IrReceived":{"Protocol":"FUJITSU_AC","Bits":128,"Data":"0x0x1463001010FE0930400400000000206C","Repeat":0,"IRHVAC":{"Vendor":"FUJITSU_AC","Model":1,"Mode":"Heat","Power":"On","Celsius":"On","Temp":20,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"Off","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}}
The other application for a Tasmota IR Tranceiver would be for regular remotes for TVs etc. A message from a regular IR remote (for a cheap Led light) looks like this:
17:56:21 MQT: tele/TasmotaIR/RESULT = {"IrReceived":{"Protocol":"NEC","Bits":0,"Data":"0xFFFFFFFFFFFFFFFF","DataLSB":"0xFFFFFFFFFFFFFFFF","Repeat":1}}
-
@akbooer thanks that worked right away.
The child device is added and the variables are populated as they should.
I tried both the HVAC remote and the led light one and the both seem to report as they should.
Briliant support as always!
Next question is how to send Mqtt commands from inside OpenLuup to one of the Tasmota devices?
It is probably quite simple, but I have missed how to do that.As far as I have found out the Mqtt command for controlling an HVAC is something like:
cmnd/<device_name>/IRhvac {"Vendor":"LG2", "Power":"On","Mode":"Hot","FanSpeed":3,"Temp":22.5}
So far I have only received messages from the Mqtt/Tasmota devices, so not quite sure how to do that.
-
Next question is how to send Mqtt commands from inside OpenLuup to one of the Tasmota devices?
It is probably quite simple, but I have missed how to do that.As far as I have found out the Mqtt command for controlling an HVAC is something like:
cmnd/<device_name>/IRhvac {"Vendor":"LG2", "Power":"On","Mode":"Hot","FanSpeed":3,"Temp":22.5}
So far I have only received messages from the Mqtt/Tasmota devices, so not quite sure how to do that.
Because there’s infinite variety, I’ve not implemented any command/control from the Tasmota bridge.
I could certainly add a device action to send a generic command with device_name and command parameters, or such like, if that helps.
Edit: the alternative is to publish an MQTT message directly.
-
Because there’s infinite variety, I’ve not implemented any command/control from the Tasmota bridge.
I could certainly add a device action to send a generic command with device_name and command parameters, or such like, if that helps.
Edit: the alternative is to publish an MQTT message directly.
@akbooer I think that I could try publishing an Mqtt message directly first. A generic command could perhaps also be of use.
The below text is edited after I got it to work by adding \ before the " so that it is passed trough as it should.
I found this:
local mqtt = luup.openLuup.mqtt
mqtt.publish ("My/Topic/Name", "My Application message")
For my simple test this works from Lua Code Test:
cmnd/<device_name>/IrSend/ <rest of the message>
e.g.
luup.openLuup.mqtt.publish ("cmnd/TasmotaIR/IrSend","{\"Protocol\":\"NEC\",\"Bits\":32,\"Data\":\"0x10EF08F7\",\"DataLSB\":\"0x08F710EF\",\"Repeat\":0}")
I will continue to try this for the HVAC, something like this:
cmnd/<device_name>/IRhvac <rest of message>
e.g.
cmnd/TasmotaIR/IrSend/ {\"Vendor\":\"LG2\", \"Power\":\"On\",\"Mode\":\"Hot\",\"FanSpeed\":3,\"Temp\":22.5}
-
@akbooer I think that I could try publishing an Mqtt message directly first. A generic command could perhaps also be of use.
The below text is edited after I got it to work by adding \ before the " so that it is passed trough as it should.
I found this:
local mqtt = luup.openLuup.mqtt
mqtt.publish ("My/Topic/Name", "My Application message")
For my simple test this works from Lua Code Test:
cmnd/<device_name>/IrSend/ <rest of the message>
e.g.
luup.openLuup.mqtt.publish ("cmnd/TasmotaIR/IrSend","{\"Protocol\":\"NEC\",\"Bits\":32,\"Data\":\"0x10EF08F7\",\"DataLSB\":\"0x08F710EF\",\"Repeat\":0}")
I will continue to try this for the HVAC, something like this:
cmnd/<device_name>/IRhvac <rest of message>
e.g.
cmnd/TasmotaIR/IrSend/ {\"Vendor\":\"LG2\", \"Power\":\"On\",\"Mode\":\"Hot\",\"FanSpeed\":3,\"Temp\":22.5}
Yes, that will work, although two alternatives are available to make the string handling easier...
'{"Vendor":"LG2", "Power":"On", "Mode":"Hot", "FanSpeed":3, "Temp":22.5}'
or
[[{"Vendor":"LG2", "Power":"On", "Mode":"Hot", "FanSpeed":3, "Temp":22.5}]]
-
Yes, that will work, although two alternatives are available to make the string handling easier...
'{"Vendor":"LG2", "Power":"On", "Mode":"Hot", "FanSpeed":3, "Temp":22.5}'
or
[[{"Vendor":"LG2", "Power":"On", "Mode":"Hot", "FanSpeed":3, "Temp":22.5}]]
-
@archers if you want virtual device, v3 beta of my Virtual Devices can send MQTT messages under openLuup, for attached and supported devices/actions.
@therealdb that sounds interesting! I will try that.
Edit: I do not remember; how do I update to the v3 beta for the Virtual Devices plugin? Also I am a bit unsure how I can see the current version.
I typed in "development" in the plugins table and it says "GitHub.development", should that do it? -
@therealdb that sounds interesting! I will try that.
Edit: I do not remember; how do I update to the v3 beta for the Virtual Devices plugin? Also I am a bit unsure how I can see the current version.
I typed in "development" in the plugins table and it says "GitHub.development", should that do it? -
@archers just download the files from GitHub or use alt appstore. Version should be visible in logs.
@therealdb when looking in github I cannot see the development branch. I can only see the master branch with mqtt, beta2.
Not sure if I am doing something wrong though (quite possible).
In my log it says "VirtualDevices[3.0-beta2@37]".
-
@therealdb when looking in github I cannot see the development branch. I can only see the master branch with mqtt, beta2.
Not sure if I am doing something wrong though (quite possible).
In my log it says "VirtualDevices[3.0-beta2@37]".
-
@archers you’re good. No development branch, as it’s almost stable and only attached to openluup, since I’ll not update the Vera AppStore soon.
@therealdb I created a simple Virtual Binary Switch and it now has three Mqtt variables:
MQTT_BrightnessValue
MQTT_PowerStatusOff
MQTT_PowerStatusOnI can see the format "topic/=/message" in the instructions, but I am clerarly missing something.
Do I need to define IP address etc in some other variable?I tried to get it to work, but I do not get it right, no reaction in the Tasmota device console. How do I put e.g. the following into "MQTT_PowerStatusOn", i.e. to get the device to send this when it is powered on?
cmnd/TasmotaIR/IRhvac {"Vendor":"FUJITSU_AC","Model":1,"Mode":"Heat","Power":"On","Celsius":"On","Temp":20,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"Off","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}
(Where the TasmotaIR has IP 192.168.1.59)
Sorry for the stupid questions.
-
@therealdb I created a simple Virtual Binary Switch and it now has three Mqtt variables:
MQTT_BrightnessValue
MQTT_PowerStatusOff
MQTT_PowerStatusOnI can see the format "topic/=/message" in the instructions, but I am clerarly missing something.
Do I need to define IP address etc in some other variable?I tried to get it to work, but I do not get it right, no reaction in the Tasmota device console. How do I put e.g. the following into "MQTT_PowerStatusOn", i.e. to get the device to send this when it is powered on?
cmnd/TasmotaIR/IRhvac {"Vendor":"FUJITSU_AC","Model":1,"Mode":"Heat","Power":"On","Celsius":"On","Temp":20,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"Off","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}
(Where the TasmotaIR has IP 192.168.1.59)
Sorry for the stupid questions.
@archers no need to put ip or anything. Just push the mqtt message to the broker. In you case
cmnd/TasmotaIR/IRhvac/=/{"Vendor":"FUJITSU_AC","Model":1,"Mode":"Heat","Power":"On","Celsius":"On","Temp":20,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"Off","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}