I think I must be missing something obvious here so apologies in advance.
I have an MQTT interface from my heating boiler to my OH 2.5.4 system (on Ubuntu 20.04) that sends info with the path home/ems-esp/boiler_data with the following format:
{
"wWComfort": "Hot",
"wWSelTemp": 55,
"selFlowTemp": 25,
"selBurnPow": 32,
"curBurnPow": 0,
"pumpMod": 0,
"wWCurTmp": 27.2,
"wWCurFlow": 0,
"curFlowTemp": 48.7,
"wWActivated": "on",
"burnGas": "off",
"heatPmp": "off",
"fanWork": "off",
"ignWork": "off",
"wWCirc": "off",
"wWHeat": "on",
"burnStarts": 36567,
"burnWorkMin": 698583,
"heatWorkMin": 568260,
"ServiceCode": "",
"ServiceCodeNumber": 0
}
Screenshot from MQTT Explorer:
I’d like to map those “on” and “off” values to ON and OFF switch items.
I have to use a things file because using the PaperUI causes my OH system CPU usage to go through the roof and can only be fixed with a service restart. My things file looks like this:
Bridge mqtt:broker:mqttboilerbridge "MQTT Broker Bridge Boiler" [ host="192.168.0.20", port=1883, secure=false, username="openhab", password="password", clientID="openHAB2_boiler" ]
{
// Boiler
Thing topic boilerthing "Boiler" @ "Cellar" {
Channels:
Type string : status "Reachable" [ stateTopic="home/ems-esp/status" ]
Type number : tapwater_active "Tapwater Active" [ stateTopic="home/ems-esp/tapwater_active" ]
Type number : heating_active "Heating Active" [ stateTopic="home/ems-esp/heating_active" ]
// Type string : wWComfort "Warm Water Comfort Setting" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.wWComfort" ]
Type string : wWComfort "Warm Water Comfort Setting" [ stateTopic="home/ems-esp/boiler_data/wWComfort" ]
Type number : wWSelTemp "Warm Water Selected Temp" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.wWSelTemp" ]
Type number : selFlowTemp "Flow Selected Temp" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.selFlowTemp" ]
Type number : selBurnPow "Selected Burner Power" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.selBurnPow" ]
Type number : curBurnPow "Current Burner Power" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.curBurnPow" ]
Type number : pumpMod "Pump Modulation" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.pumpMod" ]
Type number : wWCurTemp "Warm Water Current Temp" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.wWCurTmp" ]
Type number : wWCurFlow "Warm Water Flow Rate (L/min)" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.wWCurFlow" ]
Type number : curFlowTemp "Flow Current Temp" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.curFlowTemp" ]
Type string : wWActivated "Warm Water Activated" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.wWActivated" ]
// Type string : wWActivated "Warm Water Activated" [ stateTopic="home/ems-esp/boiler_data/wWActivated", transformationPattern="MAP:onoff.map" ]
Type string : wWActivated2 "Warm Water Activated" [ stateTopic="home/ems-esp/boiler_data/wWActivated", transformationPattern="MAP:onoff.map" ]
Type string : burnGas "Gas Burning" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.burnGas" ]
Type string : heatPmp "Heat Pump On/Off" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.heatPmp" ]
Type string : fanWork "Fan On/Off" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.fanWork" ]
Type string : ignWork "Ignition On/Off" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.ignWork" ]
Type string : wWCirc "Warm Water Circulating On/Off" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.wWCirc" ]
Type string : wWHeat "Warm Water Heat On/Off" [ stateTopic="home/ems-esp/boiler_data", transformationPattern="JSONPATH:$.wWHeat" ]
}
}
I think where I might be stuck is how to use the “JSONPATH:$.burnGas” syntax to get to the relevant value in the MQTT message but also use the MAP:onoff.map to map “on” and “off” to ON/OFF. I tried using the MAP:onoff.map with the wWActivated2 channel but it doesn’t seem to work.
What’s the magic syntax that I’m missing?