Modbus binding of rollershutter

Hi Yves,

Unfortunately not yet. I am going to prepare a pull request to contribute
these extension. As long as it’s not yet done you will need to take this
one to be found below.

Jens

Hi Jens,

Thanks for replying to my request.
I will be happy to contribute as much as I can.
From what I have understood, I should replace the current modbus binding (1.9) by your own (https://www.dropbox.com/s/rnquvqjutiphrzv/org.openhab.binding.modbus-1.8.0-SNAPSHOT.jar.zip?dl=012). Am I correct ?
The version 1.9 seems to have some improvements, including the float_swap that I’m using for the temperature. I have checked the knx binding (I’m not using it) just to see how it is done. It think we could probably learn from it to improve the modbus binding (rollershutter, dimming, etc.).
What do you think ?
Best Regards

Yves

Hi Yves,

I was able to move my local changes to the actual HEAD.
Please find below the according link for the jar file.

Best regards
Jens

1 Like

Hallo Jens!
Thanks for your work! I tried “your binding” in version 1.8 in openhab 1.8.3.

Unfortunately, I have no success.

In Codesys - globale variables I defined

	myWord0 AT %MW0:WORD
	myWord1 AT %MW1:WORD;   
	myWord2 AT %MW2:WORD;

In openhab.cfg I defined:

modbus:tcp.slave1.connection=10.0.1.63:502
modbus:tcp.slave1.type=holding
modbus:tcp.slave1.id=1
modbus:tcp.slave1.start=12288
modbus:tcp.slave1.length=3

In default.items I defined:

Rollershutter   Roller "Roller"       (Roller) {modbus="slave1:<0:>1"}

… but “nothing” reaches my SPS. I checked the principle connection with switches / coils / MX an everything was fine.

Do you have a hint for me? Does anybody has a hint for me?

Thanks a lot.
Helmut

Dear Helmut,

at first, please double check whether you are using the ‘homebrewed’ version from the link above. I hope this feature will soon be a part of the normal openhab release :wink:

my WAGO code looks as follows:

xJalWZGrossPos			AT %MW0:   INT; (* write *)
xJalWZGrossUpDown	        AT %MW1:   INT; (* read/write *)
xJalWZGrossStopCmd 	        AT %MW2:   INT; (* read/write *)

As you can see I use INT as datatype because UP/DOWN needs to be a signed value in my implementation.

By the way, have you also checked the events.log and openhab.log? You should see some output there.

Best regards
Jens

Hi Jens,

Many thanks.
I will use it and let you know.

Best Regards

Yves

Good morning! / Guten Morgen! :slight_smile:
I actually use the version from above. In the openhab.log I see a lot but no errors concerning the Modbus (as fa as I can see). I will change the datatype in codesys and check it again. I hope it will be my mistake.

Thanks a lot for your fast respond!

Helmut

Hallo!
Using “int” as datatype in the wago code solved my problem for reg 1 and reg 2. Nevertheless reading seems not to work.

In items I have

Rollershutter   Rollade_OE_Schlafzimmer "Rollade [%d %%]"       (OE_Schlafzimmer) {modbus="slave1:<0:>1"}

and in the wago code reg 0 is set to “20”.

When pressing up or down “openhab” sets the value to “0%” or “100%” for the roller position. In the openhab.log I find the messages for writing reg 1 and reg 2 but not reading reg 0. So i guess their might be a last mistake on my side.

Thanks :wink:
Helmut

Update:
Okay, may it be, that up / down arrows set the value to 1 or 0 and the “position” it is only updated via the modbus if the value on the bus is changed?

Hi Helmut, Hi Jens,

Thanks for sharing.
I think I’m missing something.

I’m using 2 digital outputs to connect my shutters : one for “UP” and the second one for "DOWN, coded as “QWx.y” or “%MXa.b” in Wago. I simulate the position with “%QWa”. Using the types “COILS” and value types “BIT” and the SWITCH in openhab, I can manage the shutters. But, of course, this is not the best solution.

Can you, please, let me know how you manage to use the “HOLDING” and “INT” for the shutters ?

Many thanks

Yves

Hey!
In Wago I use Functionblock “FbJalousie” (sorry, it is the German package). The position of the shutter is between 0…100.

In global variables I defined

	Shutter_Position AT %MW0:INT;`   
	Shutter_up AT %MW1:INT;
	Shutter_on AT %MW2:INT;

In openhab.cfg I wrote …

modbus:tcp.slave1.connection=10.0.1.63:502
modbus:tcp.slave1.type=holding
modbus:tcp.slave1.id=1
modbus:tcp.slave1.start=12288
modbus:tcp.slave1.length=3
modbus:tcp.slave1.valuetype=int16

and in default.items …

Rollershutter   Shutter "Shutter [%d %%]"       (Room)       {modbus="slave1:<0:>1"}

… so, now its working … :wink:

Helmut

1 Like

Good work, Helmut :slight_smile:
Nice to see, that you managed it as I did with ‘FbJalousie’.

Yves, if you need further support, please let me know.

Some words to understand why I have used HOLDING types. One of the main benefits of OH was to show the exact position of each shutter inside the UI. Therefore you need a MODBUS variable reflecting this value -> this is HOLDING type, To keep it simple I used the next consecuteive 2 MODBUS-vars to handle once UP/DOWN and STOP commands. As far as I understood these 2 command classes must be seperated in OH. Thats why these types are HOLDING as well.

Hi Helmut, Hi Jens,

Many thanks.
I have implemented the above. I’m also using the same wago lib.
It is not working correctly (the shutter goes up, but not down).
It think I still have to fine tune, and I will get you updated.

Best Regards

Yves

Thanks to you, Jens!

Do you know if your work is already included in the Openhab 2 modbus binding?

Helmut :wink:

Hallo everybody!
I do my first steps using OH2. The modbus binding is of OH1.9. It is doing its job … in principle :wink:

This is the openhab log output:

The item “Rollershutter” seems to be not supported:
binding configuration of type ‘modbus’ of item ‘Rollade_OE_Schlafzimmer’ could not be parsed correctly.

org.eclipse.smarthome.model.item.BindingConfigParseException: item ‘itemName’ is of type ‘RollershutterItem’, only Switch, Contact or Number are allowed - please check your *.items configuration

If I change from Rollershutter to Switch the communication is working fine.

Can anybody help?

Helmut

Hi Helmut,

there is an open pull request on github

https://github.com/openhab/openhab/pull/4654

There is still some open discussion but we are on a good way.

Jens

1 Like

Hallo Jens!
I count on you, Jens! :wink:

If I have to do the job with rules and so on I have to think about OH being the right solution.

Greetings …
Helmut

As now the github issue has been closed (in favour of the rule approach), I would like to announce the experimental version implementing transformation support in the community forums

The roller shutter use case should now be easier to implement using this new version (see the linked thread for example).

I appreciate all the feedback!

1 Like