I am having an issue obtaining a specific value from an item that gets its value via MQTT from nodejs poolController. Most of the items work with no issue as seen below. When I come to the status items, for example, the values are shown as follows. If you see below the two items that report status report back with a JSON type string. I have tried a few different ways to get the value of “desc” specifically but nothing I have tried works. If I am reading the documentation correctly, it seems that all I would need at the end of my existing JSON transform line is to append .desc to get that specific value but it doesn’t seem to do anything. No change I make to the things file as shown below does anything as if the transform is not being recognized. I have confirmed that JSONPATH is installed.
This is the section from my mqtt.things file.
Thing mqtt:topic:aquarite (mqtt:broker:mosquitto) @ "Pool Controller" {
Channels:
Type string : power "Aquartie Chlorinator Power [%s]" [ stateTopic="nixie-singlebody/state/chlorinators/1/aquaritet15", commandTopic="nixie-singlebody/state/chlorinators/1/aquaritet15", transformationPattern="JSONPATH:$.isOn" ]
Type number : output "AquaRite Output [%s]" [ stateTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/currentOutput", commandTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/currentOutput", transformationPattern="JSONPATH:$.currentOutput" ]
Type number : setpoint "AquaRite Output [%s]" [ stateTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/poolSetpoint", commandTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/poolSetpoint", transformationPattern="JSONPATH:$.poolSetpoint" ]
Type string : status "AquaRite Output [%s]" [ stateTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/status", commandTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/status", transformationPattern="JSONPATH:$.status.desc" ]
Type string : superchlorinate "AquaRite Output [%s]" [ stateTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/superChlor", commandTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/superChlor" , transformationPattern="JSONPATH:$.superChlor" ]
Type number : superchlorinatehours "AquaRite SuperChlorinate Hours [%s]" [ stateTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/superChlorHours", commandTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/superChlorHours", transformationPattern="JSONPATH:$.superChlorHours" ]
Type number : saltlevel "AquaRite Salt Level [%s]" [ stateTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/saltLevel", commandTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/saltLevel", transformationPattern="JSONPATH:$.saltLevel" ]
Type number : targetoutput "AquaRite Target Output [%s]" [ stateTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/targetOutput", commandTopic="nixie-singlebody/state/chlorinators/1/aquaritet15/targetOutput" , transformationPattern="JSONPATH:$.targetOutput" ]
}
Here is the section of my mqtt.items.
String AquaRiteT15Chlorinator_Power "Aquartie Chlorinator Power [%s]" <pool> (gAquaRite) {channel="mqtt:topic:aquarite:power"}
Number AquaRiteT15Chlorinator_CurrentOutput "AquaRite Current Output [%s]" <pool> (gAquaRite) {channel="mqtt:topic:aquarite:output"}
Number AquaRiteT15Chlorinator_Setpoint "AquaRite Setpoint [%s]" <pool> (gAquaRite) {channel="mqtt:topic:aquarite:setpoint"}
String AquaRiteT15Chlorinator_SuperChlorinate "AquaRite Super Chlorinate [%s]" <pool> (gAquaRite) {channel="mqtt:topic:aquarite:superchlorinate"}
Number AquaRiteT15Chlorinator_SuperChlorinateHours "AquaRite SuperChlorinate Hours [%s]" <pool> (gAquaRite) {channel="mqtt:topic:aquarite:superchlorinatehours"}
Number AquaRiteT15Chlorinator_SaltLevel "AquaRite Salt Level [%s]" <pool> (gAquaRite) {channel="mqtt:topic:aquarite:saltlevel"}
Number AquaRiteT15Chlorinator_TargetOutput "AquaRite Target Output [%s]" <pool> (gAquaRite) {channel="mqtt:topic:aquarite:targetoutput"}
String AquaRiteT15Chlorinator_CurrentStatus "AquaRite Current Status [%s]" <pool> (gAquaRite) {channel="mqtt:topic:aquarite:status"}
and finally my sitemap
Text item=AquaRiteT15Chlorinator_Power
Setpoint item=AquaRiteT15Chlorinator_Setpoint minValue=00 maxValue=100 step=1
Text item=AquaRiteT15Chlorinator_CurrentOutput
Text item=AquaRiteT15Chlorinator_CurrentStatus
Switch item=AquaRiteT15Chlorinator_SuperChlorinate
Setpoint item=AquaRiteT15Chlorinator_SuperChlorinateHours minValue=00 maxValue=24 step=1
Text item=AquaRiteT15Chlorinator_SaltLevel
Text item=AquaRiteT15Chlorinator_TargetOutput
Text label=""
One of the items I have an issue with is “AquaRiteT15Chlorinator_CurrentStatus” which is the one that says “AquaRite Current Status” on the sitemap picture above. I simply want to show the desc which says “Ok” and not the entire string “{val=0, name=ok, desk=Ok}”
Finally, this is what it looks like in my MQTT explorer. The one I highlighted is the one that I can’t get the value from.