- Platform information:
- Hardware: Supermicro Server
- OS: Debian 10 VM on Proxmox
- Java Runtime Environment: openjdk 1.8.0_272
- openHAB version: 2.5.10
Hi!
I’m trying to set up my first MQTT item where the payload is formatted in JSON and can’t extract the value of it. VSCode always says “NULL” and PaperUI NaN. Since reading the string itself works, probably the JSONPATH transformation isn’t working. JSONPATH transformation is installed.
irrelevant to the problem itself, I’m trying to read the watertemperature of my watercooled PC. aquasuite, my watercooling controller software, can write its sensordata to MQTT since a couple of updates back.
Here is my configuration:
mqtt.things
Bridge mqtt:broker:mosquitto "Mosquitto" [ host="localhost", secure=false, username="mqtt", password="supersecret" ] {
Thing topic Computer "Computer" {
Channels:
Type number : Computer_PC1_watertemperature "watertemperature [%.1f °C]" [stateTopic="computer/pc1/waterT",transformationPattern="JSONPATH:$.Data[0].Value"]
Type string : Computer_PC1_watertemperature_str "watertemperature [%s °C]" [stateTopic="computer/pc1/waterT"]
}
}
mqtt.items
Number Computer_PC1_watertemperature "watertemperature [%.1f °C]" <temperature> (gTemperature,Arbeitszimmer) {channel="mqtt:topic:mosquitto:Computer:Computer_PC1_watertemperature"}
String Computer_PC1_watertemperature_str "watertemperature [%s °C]" <temperature> (gTemperature,Arbeitszimmer) {channel="mqtt:topic:mosquitto:Computer:Computer_PC1_watertemperature_str"}
MQTT-payload of computer/pc1/waterT
{"Id":"7a2aee3e-c4a2-4bb4-bc64-ffffffff","Topic":"computer/pc1/waterT","Title":"Wassertemperatur","Message":"","Data":[{"Name":"Wassertemperatur CPU in","Unit":"°C","Value":27.19}]}
as mentioned above, reading the string works, converting it to a number does not. Is my JSONPATH correct?
best regards
RockNLol
- Issue of the topic: please be detailed explaining your issue
- Please post configurations (if applicable):
- Items configuration related to the issue
- Sitemap configuration related to the issue
- Rules code related to the issue
- Services configuration related to the issue
- If logs where generated please post these here using code fences: