For the “2” to translate to “OK”, you´ll need to do som map transforming. (It easier than it sounds).
This is a example of a map transformation… The file will have to go into the transformation folder, and it files suffix will be .map.
This file is called:
nilan_control_servicemode.map
NULL=0
0=Off
1=Defrost
2=Flaps
3=Inlet
4=Exhaust
5=Compressor
6=Heating
7=Hot water
8=Central heat
The idea is pretty straigt forward.
0 translate to off
1 translate to Defrost
2 …
3 …
etc
In your item youl have to tell it to use the map inside the label, which looks like this:
Number Nilan_Control_ServiceMode "Service mode select [MAP(nilan_control_servicemode.map):%s]" <lock> (gNilan) {channel="modbus:data:myNilan:controlRegisters:hol1005:number"}
And you´ll have to install the Map Transformation
in PaperUI → Addons → Transformations
As for dividing 700 to 70.0 degree, you´ll need to add a javascript file to you Data thing:
Looks like this:
Bridge poller inputRegisters [ start=200, length=23, refresh=6000, type="input" ] {
Thing data inp200 [ readStart="200", readValueType="int16", readTransform="JS(divide100.js)" ]
Notice the part , readTransform=“JS(divide100.js)”
The script looks like this, and should in this case be named dividie100.js and placed inside the tranformation folder as well:
// Wrap everything in a function
(function(i) {
return parseFloat(i) / 100;
})(input)
// input variable contains data passed by openhab
And you´ll have to install the Javascript Transformation
in PaperUI → Addons → Transformations
Small notice…
Since I use manual created files, I have no idea how to do this in PaperUI. Someone else will have to guide you on that part.