Hi all
I use VenusOS for my PV system and collect the data via MQTT
everything works as expected, but the BMS data for MinVoltageCellID and MaxVoltageCellID contents the CellID e.g. “C1” or “C16”
I use a JS-script to remoce the “C” in the MQTT value
(function(data) {
var returnValue = data.slice(1);
return returnValue[0]
})(input)
This works fine in OH 3.4.2, but under OH 4.3.3 I cannot combine JSONPath and JS in a Thing-file
within the UI I can add both to the channel definition
UID: mqtt:topic:MQTTVenusOS:VenusOSMQTT
label: VenusOSMQTT
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:MQTTVenusOS
channels:
- id: CELLTEST
channelTypeUID: mqtt:string
label: CellTest
description: ""
configuration:
stateTopic: N/VRMPortalID/battery/1/System/MinVoltageCellId
transformationPattern:
- JSONPATH:$.value
- JS:CellID.js
But how I have to handle this in a Thing-file
how to combine transformationPattern=“JSONPATH:$.value” and JS.CellID.js
Here my Thing definition
Bridge mqtt:broker:myBroker "VENUSOS Broker" [
host="<IP-Adress",
port=<Brokerport>,
clientID="openhabClient"
] {
Thing topic batteryVoltages "Battery 1 Voltages" {
Channels:
Type string : CellLow "Cell ID Low" [ stateTopic="N/VRMPortalID/battery/1/System/MinVoltageCellId", transformationPattern="JSONPATH:$.value" ]
Type string : CellHigh "Cell ID High" [ stateTopic="N/VRMPortalID/battery/1/System/MaxVoltageCellId", transformationPattern="JSONPATH:$.value" ]
}
}
Hope, somebody can help, because I don’t wanna create the channels via UI
BR Uwe