openLuup: Tasmota MQTT Bridge
-
@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.
-
@akbooer what I have seen is that in the "testing" release it seems as if the checkmarks in the Hstorian disappear, at east for me. When I check a variable the check is gone when I return to the Historian.
Despite this I have historical data when looking at a graph, e.g:
I have not connected my test Pi to Grafana, but I assume that if the graph in Historian contains data so should a graph in Grafana.
@Buxton what I have noticed is that Tasmota for BLE sometimes freezes, at least for me running the beta on an ESP32. It seems that it deliveres the same value every time over Mqtt, I assume that OpenLuup then acts on this and that is why the data is not there in Historian.
In fact when I read you report I checked my data for one of the BLE variables and it was gone. A restart of the Tasmota BLE device fixed that and now data is back. -
@therealdb said in openLuup: Tasmota MQTT Bridge:
@archers no need to put ip or anything. Just push the mqtt message to the broker. In you case
I have tried this, but it seems not to work for some strange reason.
I put the Mqtt message in the "MQTT_PowerStatusOn" variable but I do not get any Mqtt message in either the Tasmota Console or in Mqtt Explorer when toggling the device, I assume that it should react when doing that.Any ideas on what could be wrong?
Just for comparison, when testing this in the Lua Code Test it works, so the messsage should be ok.
luup.openLuup.mqtt.publish ("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}")
-
@archers so, to execute something when you turn a device ON, just add this as the SetPowerURL variable's value:
mqtt://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}
(Notice the mqtt:// prefix that I omitted from the docs - my bad).
I've not implemented thermostats yet, but I could do it easily, grabbing some code from the heaters.
-
@therealdb thanks, that works!
A useful addition to the Mqtt setup in OpenLuup for sure. -
akbooerreplied to ArcherS on May 10, 2021, 5:37 PM last edited by akbooer May 10, 2021, 1:40 PM
@archers said in openLuup: Tasmota MQTT Bridge:
Despite this I have historical data when looking at a graph
Yes, this works even if the Historian is not archiving to disk. It maintains an in-memory cache of the 1000, or so, latest values for numeric variables.
@archers said in openLuup: Tasmota MQTT Bridge:
I assume that if the graph in Historian contains data so should a graph in Grafana.
Not so. This cache is not available to Grafana, which requires an on-disk archive. This behaviour is described in some detail on pp.12–13 of the User Guide.
@Buxton, you have two options:
- create the archive files manually (using the correct attributes.) Once they're there, the Historian will continue to write to them.
- Let me know the variable names (I'm assuming Temperature and Humidity?) and I will add them to the archive defaults.
#2 is obviously the better option.
-
@therealdb said in openLuup: Tasmota MQTT Bridge:
I've not implemented thermostats yet, but I could do it easily, grabbing some code from the heaters.
I have the idea to control the temperature of my HVAC and looked at your VirtualHeater device.
For some reason it does not seem to keep the values I set when changing the temperature. Any ideas?My first thought is to keep things simple. A hetater or thermostat device for setting the temp and possibly something more. Maybe fan speed also later on.
-
@akbooer said in openLuup: Tasmota MQTT Bridge:
Not so. This cache is not available to Grafana, which requires an on-disk archive. This behaviour is described in some detail on pp.12–13 of the User Guide.
I had forgotten about setting that up on my main OpenLuup server, but that of course explains the difference with my test server.
@Buxton, you have two options:
create the archive files manually (using the correct attributes.) Once they're there, the Historian will continue to write to them.
Let me know the variable names (I'm assuming Temperature and Humidity?) and I will add them to the archive defaults.On my BLE Tasmota it is Temperature, Humidity and Battery (for my LYWSD03MMC Xiaomi BLE sensors).
-
@akbooer Yes, I'm starting to see what your up against here. MQTT, because of its flexibility, is not going fit into established serviceiDs. Developing a UI to manage this complexity will take some creative insight.....
Attached is a sample screenshot of the device file. Note the three sensors listed on the left with non-friendly names
And here is the actual device file as displayed in the console:
[{ "ControlURLs":[], "altid":"power_BedroomTV", "category_num":0, "device_file":"D_GenericTasmotaDevice.xml", "device_json":"D_GenericTasmotaDevice.json", "device_type":"GenericTasmotaDevice", "disabled":0, "id":30001, "id_parent":262, "invisible":"0", "ip":"", "local_udn":"uuid:d764c8cc-e932-55c4-478d-7aa05d83f3ea", "mac":"", "manufacturer":"could be anyone", "model":"", "name":"power_BedroomTV", "plugin":"", "room":"35", "states":[{ "id":0, "service":"urn:micasaverde-com:serviceId:HaDevice1", "value":"1620676905", "variable":"LastUpdate" },{ "id":1, "service":"power_BedroomTV", "value":"{\"Time\":\"2021-05-10T21:01:44\",\"Switch1\":\"ON\",\"Switch2\":\"ON\",\"ENERGY\":{\"TotalStartTime\":\"2021-04-04T05:29:11\",\"Total\":0.000,\"Yesterday\":0.000,\"Today\":0.000,\"Period\":0,\"Power\":[0,0],\"ApparentPower\":[0,0],\"ReactivePower\":[0,0],\"Factor\":[0.00,0.00],\"Frequency\":60,\"Voltage\":121,\"Current\":[0.000,0.000]}}", "variable":"tele" },{ "id":2, "service":"LYWSD03eb4f4f", "value":"a4c138eb4f4f", "variable":"mac" },{ "id":3, "service":"LYWSD03eb4f4f", "value":"21.7", "variable":"Temperature" },{ "id":4, "service":"LYWSD03eb4f4f", "value":"62", "variable":"Humidity" },{ "id":5, "service":"LYWSD03eb4f4f", "value":"-74", "variable":"RSSI" },{ "id":6, "service":"LYWSD03eb4f4f", "value":"14.1", "variable":"DewPoint" },{ "id":7, "service":"power_BedroomTV", "value":"2021-05-10T21:01:44", "variable":"Time" },{ "id":8, "service":"LYWSD0338eb2e", "value":"a4c13838eb2e", "variable":"mac" },{ "id":9, "service":"LYWSD0338eb2e", "value":"21.6", "variable":"Temperature" },{ "id":10, "service":"LYWSD0338eb2e", "value":"54", "variable":"Humidity" },{ "id":11, "service":"LYWSD0338eb2e", "value":"-85", "variable":"RSSI" },{ "id":12, "service":"LYWSD0338eb2e", "value":"11.9", "variable":"DewPoint" },{ "id":13, "service":"LYWSD03a59e0c", "value":"a4c138a59e0c", "variable":"mac" },{ "id":14, "service":"LYWSD03a59e0c", "value":"20.9", "variable":"Temperature" },{ "id":15, "service":"LYWSD03a59e0c", "value":"58", "variable":"Humidity" },{ "id":16, "service":"LYWSD03a59e0c", "value":"-91", "variable":"RSSI" },{ "id":17, "service":"LYWSD03a59e0c", "value":"12.3", "variable":"DewPoint" },{ "id":18, "service":"power_BedroomTV", "value":"ON", "variable":"Switch2" },{ "id":19, "service":"power_BedroomTV", "value":"ON", "variable":"Switch1" },{ "id":20, "service":"ENERGY", "value":"0", "variable":"Total" },{ "id":21, "service":"ENERGY", "value":"table: 0x556c23b0f060", "variable":"Power" },{ "id":22, "service":"ENERGY", "value":"table: 0x556c23b0f100", "variable":"ApparentPower" },{ "id":23, "service":"ENERGY", "value":"table: 0x556c237e4cd0", "variable":"Current" },{ "id":24, "service":"ENERGY", "value":"121", "variable":"Voltage" },{ "id":25, "service":"ENERGY", "value":"table: 0x556c237e48d0", "variable":"Factor" },{ "id":26, "service":"ENERGY", "value":"0", "variable":"Period" },{ "id":27, "service":"ENERGY", "value":"table: 0x556c23b0f1d0", "variable":"ReactivePower" },{ "id":28, "service":"ENERGY", "value":"0", "variable":"Yesterday" },{ "id":29, "service":"ENERGY", "value":"2021-04-04T05:29:11", "variable":"TotalStartTime" },{ "id":30, "service":"ENERGY", "value":"0", "variable":"Today" },{ "id":31, "service":"ENERGY", "value":"60", "variable":"Frequency" },{ "id":32, "service":"ENERGY", "value":"0", "variable":"Power/1" },{ "id":33, "service":"ENERGY", "value":"0", "variable":"Power/2" },{ "id":34, "service":"ENERGY", "value":"0", "variable":"ApparentPower/1" },{ "id":35, "service":"ENERGY", "value":"0", "variable":"ApparentPower/2" },{ "id":36, "service":"ENERGY", "value":"0", "variable":"Current/1" },{ "id":37, "service":"ENERGY", "value":"0", "variable":"Current/2" },{ "id":38, "service":"ENERGY", "value":"0", "variable":"Factor/1" },{ "id":39, "service":"ENERGY", "value":"0", "variable":"Factor/2" },{ "id":40, "service":"ENERGY", "value":"0", "variable":"ReactivePower/1" },{ "id":41, "service":"ENERGY", "value":"0", "variable":"ReactivePower/2" },{ "id":42, "service":"power_BedroomTV", "value":"50", "variable":"Sleep" },{ "id":43, "service":"power_BedroomTV", "value":"56414", "variable":"UptimeSec" },{ "id":44, "service":"power_BedroomTV", "value":"Dynamic", "variable":"SleepMode" },{ "id":45, "service":"power_BedroomTV", "value":"OFF", "variable":"POWER2" },{ "id":46, "service":"power_BedroomTV", "value":"OFF", "variable":"POWER1" },{ "id":47, "service":"power_BedroomTV", "value":"125", "variable":"Heap" },{ "id":48, "service":"Wifi", "value":"CD", "variable":"SSId" },{ "id":49, "service":"Wifi", "value":"FE:9F:DB:F5:A0:11", "variable":"BSSId" },{ "id":50, "service":"Wifi", "value":"0T00:00:26", "variable":"Downtime" },{ "id":51, "service":"Wifi", "value":"11", "variable":"Channel" },{ "id":52, "service":"Wifi", "value":"86", "variable":"RSSI" },{ "id":53, "service":"Wifi", "value":"2", "variable":"LinkCount" },{ "id":54, "service":"Wifi", "value":"-57", "variable":"Signal" },{ "id":55, "service":"Wifi", "value":"1", "variable":"AP" },{ "id":56, "service":"power_BedroomTV", "value":"2", "variable":"MqttCount" },{ "id":57, "service":"power_BedroomTV", "value":"0T15:40:14", "variable":"Uptime" },{ "id":58, "service":"power_BedroomTV", "value":"19", "variable":"LoadAvg" }], "status":-1, "subcategory_num":0, "time_created":1618456263 }]
-
ArcherSreplied to therealdb on May 10, 2021, 8:29 PM last edited by ArcherS May 10, 2021, 4:37 PM
@therealdb said in openLuup: Tasmota MQTT Bridge:
@archers I need verbose logs. I have mine setup this way to control a dehumidifier and it’s working ok.
I set the debugmode variable to 1. In the ReadMe it says logs could be captured by navigating to http://VeraIP/cgi-bin/cmh/log.sh?Device=LuaUPnP but this does not seem to work, is it another url for OpenLuup? Or can I find the log somewhere in cmh-ludl?
Just to clarify, the device is still not connected to anything (no IP given) could that be the reason, or should it work anyway?
-
Latest openLuup development version (v21.5.10, and yes, we're back to that branch) includes fixes for Tasmota (and Shelly) Historian, including archive rules for Temperature / Humidity / Battery variable names.
Please Note: you should reload openLuup once more after updating, to get the Historian and Grafana to sync properly.
-
@therealdb said in openLuup: Tasmota MQTT Bridge:
@archers it should work regardless. The openluup log page is under /console
Aha, I thought it ended up in a separate logfile.
This is what I get in the log when changing the temperature of the device (no 50):
2021-05-10 22:59:37.312 openLuup.server:: GET /data_request?id=action&output_format=json&DeviceNum=50&serviceId=urn:upnp-org:serviceId:TemperatureSetpoint1_Heat&action=SetCurrentSetpoint&NewCurrentSetpoint=15 HTTP/1.1 tcp{client}: 0x1ec57b0 2021-05-10 22:59:37.313 luup.call_action:: 50.urn:upnp-org:serviceId:TemperatureSetpoint1_Heat.SetCurrentSetpoint 2021-05-10 22:59:37.314 luup_log:50: VirtualDevices[3.0-beta2@50](actionSetCurrentSetpoint@86):actionSetCurrentSetpoint(50,"15","Off","Heating") 2021-05-10 22:59:37.314 luup_log:50: VirtualDevices[3.0-beta2@50](actionSetCurrentSetpoint@90):actionSetCurrentSetpoint: skipped 2021-05-10 22:59:37.315 openLuup.server:: request completed (44 bytes, 1 chunks, 2 ms) tcp{client}: 0x1ec57b0 2021-05-10 22:59:50.043 openLuup.server:: GET /console?page=log HTTP/1.1 tcp{client}: 0x1ec57b0
-
Buxtonreplied to akbooer on May 10, 2021, 10:12 PM last edited by Buxton May 10, 2021, 9:09 PM
@akbooer OK that worked. Thx
Edit: Humidity variables are back. Looks like about 4 hours passed
I still do not see the humidity variables on the cache page though. The humidity values have recently updated as a scene I run based on humidity trigger points, fired about an hour ago. -
@akbooer One small error creating the energy variables
2021-05-10 17:22:42.275 openLuup.context_switch:: ERROR: [dev #0] ./openLuup/whisper.lua:662: Cannot create file '%s' 2021-05-10 17:22:42.275 openLuup.scheduler:: 30001.ENERGY.Current/1 ERROR ./openLuup/whisper.lua:662: Cannot create file '%s' function: 0x5633603dd490 2021-05-10 17:22:42.276 openLuup.context_switch:: ERROR: [dev #0] ./openLuup/whisper.lua:662: Cannot create file '%s' 2021-05-10 17:22:42.276 openLuup.scheduler:: 30001.ENERGY.Current/2 ERROR ./openLuup/whisper.lua:662: Cannot create file '%s' function: 0x5633603dd490
80/127