Yes. Good idea to make a example.
But first I need to understand more the ModBus Binding etc.
There’s another data that is interesting for me.
Filters:Curr.Timer Holding_Register N/C R 305 Current timer value.
It’s in the group: (4x…) Holdings Read – 03h, Write – 06h, 10h ( Present value, Unsigned Word )
As far as I understand I have to setup a Poller for “holding register” from Address 300 length 10.
And then a data thing and item?
I did like that and no errors in the log, but I can’t read the hour’s…
Not sure where you’ve got those numbers from.
I interpret the chart that you showed us as describing two read-write holding registers, ‘speed’ and ‘tset’, at addresses 0 and 1
For just those two you’d want Poller start 0 length 2 type holding, done properly
Maybe there is more on the next page, but I’d bet the addresses follow on and you just want to extend the length a bit.
Nope. Poller thing starts at what you tell it to start at, and gets as many as you tell it in length. There’s a modbus limitation that you cannot fetch more than 120 in one go.
So you might want two pollers, one for some registers starting at 0, one for registers starting at 300 or whatever.
Try reading 301 because you know what should be, the ID “1”
So now it comes to the divide by 10 for the temperatures.
It put a rules files in the rules folder
rule “Tempumrechnung”
when
Item Abluft changed
then
var Number Temp = (Abluft.state as Number)
Abluft.postUpdate(Temp/10)
end
But in the log i got this:
[WARN ] [ernal.handler.ModbusDataThingHandler] - Channel number will not be updated since transformation was unsuccessful. Channel is expecting the following data types [DecimalType, QuantityType, UnDefType]. Input data: number value 179 (value type ‘int16’ taken into account) and bool value true. Transformation: Transformation@10ab225[tranformation=abluftumrechnung,transformationServiceName=<null>,transformationServiceParam=<null>]
The rule is a crackers idea. If you update a modbus connected Item to some new value … what do you think is going to happen a half-second later when the next modbus poll happens.
Ditch that, delete it.
The WARN message has nothing to do with the rule. You’ve obviously found the Transformation part of the binding notes. That’s good, that’s the part we should make work - the “magic” then happens automatically between modbus and your Item.
You need to make a divide by 10 javascript, and put it in the /conf/scripts folder of your openHAB.
In the data Thing corresponding to your Item’s channel, you add a readTransform= parameter specifying the type of transformation and the name of your script. It’s in the docs.
I am no coding specialist…
but i found that in the docs:
" transform/divide10.js :
// Wrap everything in a function (no global variable pollution)
// variable "input" contains data passed by openhab
(function(inputData) {
// on read: the polled number as string
// on write: openHAB command as string
var DIVIDE_BY = 10;
return parseFloat(inputData) / DIVIDE_BY;
})(input)
Is this the java script you thinking about ?
I put it with nano in to the /conf/folder
But how should i add that readTransform= parameter to the thing ?
You need to put the little srcipt into /conf/scripts/
Again, it’s in the docs, further down the examples.
You add a readTransform= to each data thing that needs the read divide by 10. All of them share the same script.
How did you add/edit the modbus data things for your configuration? You must do it the same way. It’s just another parameter for a data thing.
Guessing you are using PaperUI, find the ‘read transform’ box and put in it
JS(divide10.js)
The JS parts tells openHAB it’s javascript, because there are several types of transformations
The divide10.js is the name of your file in /conf/scripts/
Ok,
as far as I can see in the paperUi item “Abluft” does have the same settings like “Zuluft” but “Abluft” Shows decimal point but “Zuluft” does not.
Can you tell me where to find the file for items made with paperUi to have a closer look?