openLuup: Tasmota MQTT Bridge
-
@buxton said in openLuup: Tasmota MQTT Bridge:
No errors in 2021.04.18. Thanks for this ...
Thanks to you for excellent description and diagnosis of the problem!
-
@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.
-
akbooerreplied to ArcherS on May 8, 2021, 8:32 PM last edited by akbooer May 8, 2021, 4:33 PM
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.
-
ArcherSreplied to akbooer on May 8, 2021, 9:58 PM last edited by ArcherS May 8, 2021, 7:08 PM
@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}]]
-
ArcherSreplied to therealdb on May 9, 2021, 11:57 AM last edited by ArcherS May 9, 2021, 8:24 AM
@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 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 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}
-
@akbooer I tried to archive several MQTT values from devices by checking the variable's archive box in the historian cache console. When I reloaded the luup engine, the variables disappeared from the console UI. As well, the variables do not show up in the console UI on the historian database page.
-
Not obvious, but answered previously here...
https://smarthome.community/topic/313/historian/4?_=1620559885357
What variables are you trying to archive? From the Tasmota bridge, they’re likely to have special serviceIds. It should be easy enough to set up manually, anyway.
-
Yes, that’s expected. They won’t appear on that display until their value is updated.