For me, it was a shock to find that the MQTT binding had a major “upgrade” to the extent that the previous binding is no longer available ( or rather from what I could find). I will be brave and report that I don’t like it and please disagree with me .
I spent the better part of today working through the binding and here are my thoughts.
I can appreciate that one would like to configure item and devices through the paper ui and get to some sort of plug and play but, MQTT does not have a universal standard and there are so many different ways it can be implemented in IOT.
My system has the following devices running off MQTT
-
Arduino_Mega that control 24 relays and have 32 inputs - the main brain of the system
-
About 10 or 12 Tasmota Devices (Wemos and SonOff) that have some temp sensors and or other sensors including motion sensors for the outside buildings.
-
SonOff POW to monitor power consumption
-
Victron Inverter running its own MQTT server
None of these complies to the standard of the new MQTT Binding and therefore needs to be manually configured. To do this, in bulk, the text base is still the “quickest” but where one would add the items and then link to the site map you will now need to
- Create an MQTT Bridge with the “Items” / things with a completely new format
- Create the Items
- Link items to the Sitemap
As the format has changed completely the only way to “migrate” your system to the new binding is to redo the complete OH2 setup from scratch. If you start fresh with a new system it could be less of an annoyance but you will most likely need to setup up the sitemap via text base anyway and there in the fun start as the opportunity to make syntax mistakes are plentiful.
Below is an example of a Sonoff device setup that I used for the last year or so
Old setup :
mqtt.cfg - Once off
broker.url=tcp://192.168.8.30:1883 victron.url=tcp://192.168.8.5:1883
sonoff.items “Page”
// Pressure Pump Switch pressurepump "Pressure Pump" (out_switches, CF) { mqtt=">[broker:cmnd/pressurepump/POWER:command:*:default],<[broker:stat/pressurepump/POWER:state:default]" } String pressurepump_Reachable "Pressure Pump: Status [%s]" (gReachable) { mqtt="<[broker:tele/pressurepump/LWT:state:default]" } Number pressurepump_RSSI "Pressure Pump: RSSI [%d %%]" { mqtt="<[broker:tele/pressurepump/STATE:state:JSONPATH($.Wifi.RSSI)]" } Number pressurepump_vcc "Pressure Pump: Vcc [%.2f v]" { mqtt="<[broker:tele/pressurepump/STATE:state:JSONPATH($.Vcc)]" } Number pressurepump_uptime "Pressure Pump: Uptime [%.0f min]" { mqtt="<[broker:tele/pressurepump/STATE:state:JSONPATH($.Uptime)]" } String pressurepump_ip_get "Get IP" { mqtt=">[broker:cmnd/pressurepump/IPAddress:command:*:default]" } String pressurepump_ip "Pressure Pump: ip [%s]" { mqtt="<[broker:stat/pressurepump/ip:state:default]" }
and then the
Sitemap (Extract)
Text item= pressurepump_Reachable valuecolor=[Last_Update=="Offline"="red"] icon="sonoff1" { Frame { Text item=pressurepump_RSSI icon="network" Text item=pressurepump_vcc icon="energy" Text item=pressurepump_uptime icon="clock" Switch item=pressurepump_ip_get mappings=[""="Current Ip"] Text item=pressurepump_ip icon="ipicon1" } }
Compare to the new Setup
mqttConnections.things ;
mqtt:broker:mainBroker2018 [ host=“192.168.8.30”,secure=false ]
then
The MQTT bridge ;
sonoff.things ;
Bridge mqtt:broker:mainBroker2018 [ host="192.168.8.30", secure=false ] { Thing topic sonoff { // Pressure Pump Type switch : pressurepump "Pressure Pump " [ stateTopic="stat/flat_pressurepump/POWER", commandTopic="cmnd/flat_pressurepump/POWER"] Type string : pressurepump_Reachable "Pressure Pump : Status " [ stateTopic="tele/pressurepump/LWT" ] Type number : pressurepump_RSSI "Pressure Pump : RSSI" [ stateTopic="tele/pressurepump/STATE",transformationPattern="JSONPATH:$.Wifi.RSSI"] Type number : pressurepump_vcc "Pressure Pump: Vcc" [ stateTopic="tele/pressurepump/STATE",transformationPattern="JSONPATH:$.Vcc"] Type number : pressurepump_uptime "Pressure Pump: Uptime" [ stateTopic="tele/pressurepump/STATE",transformationPattern="JSONPATH:$.Uptime"] Type string : pressurepump_ip "Pressure Pump: ip" [ stateTopic="stat/pressurepump/ip"] } }
The Items Page
> // Flat Pressure pump > Switch flat_pressurepump "Flat Pressure pump" (out_lights, Lights) { channel="mqtt:topic:mainBroker2018:24relay:flat_pressurepump" } > String flat_pressurepump_Reachable "Flat Pressure pump: Status [%s]" { channel="mqtt:topic:mainBroker2018:24relay:flat_pressurepump_Reachable" } > Number flat_pressurepump_RSSI "Flat Pressure pump: RSSI [%d %%]" { channel="mqtt:topic:mainBroker2018:24relay:flat_pressurepump_RSSI" } > Number flat_pressurepump_vcc "Flat Pressure pump: Vcc [%.2f v]" { channel="mqtt:topic:mainBroker2018:24relay:flat_pressurepump_vcc" } > Number flat_pressurepump_uptime "Flat Pressure pump: Uptime [%.0f min]" { channel="mqtt:topic:mainBroker2018:24relay:flat_pressurepump_uptime" } > String flat_pressurepump_ip "Flat Pressure pump: ip [%s]" { channel="mqtt:topic:mainBroker2018:24relay:flat_pressurepump_ip" }
Sitemap ;
Text item= pressurepump_Reachable valuecolor=[Last_Update=="Offline"="red"] icon="sonoff1"
{
Frame { Switch item=pressurepump icon="sonoff1"
Text item=pressurepump_RSSI icon="network"
Text item=pressurepump_vcc icon="energy"
Text item=pressurepump_uptime icon="timer"
Text item=pressurepump_ip icon="ipicon1"
}
}
Apart from the Sitemap every MQTT node (Used in nodered) and devices will need to be redone and apart from the possible auto detection of some devices I cant see any other benefits.
Would it not be possible to simplify the “generic” version of MQTT and still have the option to auto detect or have the option to pick the old MQTT rather than the new one?
Please keep in mind that is just my viewpoint and I still appreciate all the work and effort that has gone into this binding and I also am well aware that shouting from the couch is the easiest thing to do but here is my 5c worth.
I will take the comments to chin in an attempt to help with making OH even better!