[SOLVED] Westaflex Binding

Once you’ve had a good chance to play, and figure out which are the actual interesting data;
It would be nice if we can work up a complete example.

I note for example many “coils” seem to be alarms, and presumably read only. There’s a couple of writeable holding registers for controls.

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.

Ive got the Numbers from the ModBus List:
ModBusAdressListV2_4_2(2014-08-07).pdf (327.0 KB)

It´s at Page No.: 5.
Filters:Curr.Timer Adress 305

So you mean the Poller always start at “0” and i have to extend the length up to lets say “306” to fetch the register 305 ?

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”

Ok it worked for me.
Now i can read out the hours before to change the filters.
But the Raspi need a reboot…

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.

Ok, thanks for the informations.

This would be tough. I´d never had something to do with Java etc.
But i will try that.

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.

Ok, so how can I add the read transform ? In the PaperUi or with nano at the console?

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/

Thanks rossko57!

Thats where the magic happens :-}
But I have to put the java script into the /transform folder.

1 Like

You’re very right, I messed that up!

Ok, here comes another issue:
The divide by 10 seems to be working.
See the log:

2019-02-09 13:54:25.261 [vent.ItemStateChangedEvent] - Abluft changed from 18.3 to 18.4

2019-02-09 13:54:30.360 [vent.ItemStateChangedEvent] - Zuluft changed from 14.9 to 14.8

2019-02-09 13:54:30.469 [vent.ItemStateChangedEvent] - Fort_Luft changed from 10.4 to 10.3

2019-02-09 13:54:30.502 [vent.ItemStateChangedEvent] - Abluft changed from 18.4 to 18.3

2019-02-09 13:54:35.643 [vent.ItemStateChangedEvent] - Zuluft changed from 14.8 to 14.9

2019-02-09 13:54:35.696 [vent.ItemStateChangedEvent] - Aussenluft changed from 8.7 to 8.6

2019-02-09 13:54:35.740 [vent.ItemStateChangedEvent] - Fort_Luft changed from 10.3 to 10.4

2019-02-09 13:54:40.876 [vent.ItemStateChangedEvent] - Zuluft changed from 14.9 to 14.8

2019-02-09 13:54:40.950 [vent.ItemStateChangedEvent] - Aussenluft changed from 8.6 to 8.7

But in my PaperUi only “Abluft” shows the decimal point. Al other show the divided value by ten, but no decimal point.

Well, we cannot see your Item definitions from here.

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?

Not me, it’s in JSON somehow.
Most likely problem area is in the label, the [%xxx] part.

Can you clarify? Expected 18.3 , got 183 or 18 ?