Read Modbus values and make them visible - failed

Your sheet says that 8198 is system_sensor_status, where 2 = OK

Your sheet says that temperature sensing is in 8197

It seems to me you ought to look where the sheet says.

“But my test software found it at 8198 !!”
See earlier notes about register address / number being out-by-one.
Which does the test software use?

1 Like

You dont seem to understand the sheet you´re using.
As Rossko says, according to the sheet, the register 8198 is the status output.
You receive value “2”, which according to your sheet is equal to “Ok”. (You havnt translated “2” to “Ok” anywhere).

The reading is working just fine.

What I dont get is why your have linked a Switch and a String as well?

1 Like

This is down to the way the Modbus binding works. In Modbus, you just get a register. The binding data Thing allows you to link that register, or a little group of registers, to an openHAB Item in many different types - Dimmer, Switch, Number, etc. A channel is automatically provided by the binding for each possible choice, the user chooses to link them or not (and in most cases links only one)

This is where “simple mode”, auto creating Items and auto linking stuff, becomes unhelpful.

1 Like

Ahh I see. Never seen it before, cause I use manual things files :smiley:

Oh, big thanks to you and @Kim_Andersen.

I tried 8197 before, but there was a also an 2 as the output. Maybe i need to restart the modbus poll after edit them?

So now i delete all and create it with 8197, and now i get the right output “700”.

Anyone can help me to translate the 700 in 70.0°C? The same for 2 -> OK?

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 PaperUIAddonsTransformations

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 PaperUIAddonsTransformations

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.

1 Like

For safety, yes. The binding can be restarted , or the whole system, to be sure that Things edited in file are picked up.
Latest binding version should be better at this kind of thing.

1 Like

Thank you.

I installed the openhab at synology diskstation, where i find the files you tell me?

In both locations from documentation:

  • with public share folder: /volume1/public/openHAB2/conf/
  • without public share folder: /volume1/@appstore/openHAB2/conf/
    are empty item and things folders

I have no idea… I use an Rpi.

Normally you´ll find the folders in /etc/openhab2/ I would have thought its exact same using a Synology NAS. Like:

/etc/openhab2/item/ the folder of the items files.
/etc/openhab2/things/ the folder of the things files
/etc/openhab2/transform/ the folder for transformations files
etc…

1 Like

No changes after create a new item file in these destination…

You need to be more specific…
What does your log show when you saved the item file?

1 Like

log doesnt show any changes for the items.

Then you havn´t saved your file correctly.
What is the name of the file (prefix and suffix) ?

1 Like

the name is “test.item” in folder “items”.

It need to be named: .items
(notice the s ).

And keep an eye on your logfile (tail log).

1 Like

what a stupid fault of me…

now it’s working.

I have create all 100 items over the paper ui. So there are no .items files. I don’t want to delete everything in paper ui and create them again with command line.

Is there a way to divide all temperatures /100? So all the temperatures from my heating system has same ratio.

Where do they come from? Are they modbus derived as well? Is there some reason you wouldn’t use the same transform you already have working?

1 Like

Yes, all values i need to divide about 100 come from modbus.

The script to divide is ok, but i don’t want to delete all items from paper ui and create again in command line.

Or is there a way to use the transform at paper ui? There is a point at modbus data thing “Read Transform”. I look in documentation, but i don’t understand the right syntax for this.

Cant help on this, as I dont use PaperUI for this matter. But I would assume its somehow the same syntax.

1 Like

Now i remove all things and items in Paper UI and created two files.

First file is modbus.things in folder conf/things. modbus…things.txt (5.8 KB)
Second file is modbus.items in folder conf/things.modbus.items.txt (5.6 KB)

In conf/transform i create 4 files "divide1000.js, divide100.js, divide60.js,divide10.js).

No of these created items or things are visible in paper ui.

Where is the fault?