OH3 Rolleshutters and scripts/rules

Hi everyone,
occasionally I come back to OH (I first tried OH2, then OH2.5, and now I want to give OH3 a try), but I usually get to a point where I am literally overwhelmed by the steep learning curve.
I think I’ve got the basics of the semantic model: I managed to create my locations/equipment/points and make them (more or less) work (I’m still experimenting).
What I’m really struggling with is rollershutters and scripts/rules.
I managed to make RS appear in the dashboard (location/equipment/properties), and when I push UP/DOWN/STOP buttons, everything works great. I alse managed to make a non semantic group to contain all of the RS in my house, so that I can open or close all of them with a button.
What I really can’t do is to make some basic scripts to open just a bit of a RS (my RS don’t track position, so I have to be creative).

I think I have 2 ways:

  1. make some sort of script/rule to send command UP, then wait for n seconds, then send command STOP
  2. use the binding properties (OpenWebNet (BTicino/Legrand) Binding) which should emulate the position tracking with timing, sending a percent opening command.

In both cases I can’t figure how to do this…I’m making a big mess with scripting language (blockly/ECMA/DSL???). I’ve already read the site guide, searched the forums, viewed tons of youtube videos, but I’m exactly at THAT point, struggling with confusion :frowning:
(I did not specify that I’m certanly not a programmer)

I’ve tried with something like this (scripts):

gRS.sendCommand('UP')
thread::sleep(2)
gRS.sendCommand('STOP')

and also with

RS11.sendCommand(50)

or

events.sendCommand('gRS','UP')
Thread::sleep(2)
events.sendCommand('gRS', 'STOP')

…but I’m still missing the basics…and obviously nothing works…

If anyone could direct me to the right direction, I would be very grateful.
Thanks in advance :slight_smile:

From our point of view we’d need to know what are these gRS and RS11 Items that you are sending commands to?

please check this post. it looks like solution for similar issue

You’re right…I’m so used to my items that I take them for granted…

gRS is a group containing all the rollershutters (non semantic)

RS11 is the control POINT of the rollershutter 11 EQUIPMENT (the number 11 is just an ID I use to distinguish it from other rollershutters).
So, I have eRS11 (EQUIPMENT) → RS11 (POINT)

That’s interesting…this could help me setting timers (maybe I don’t need the entire rule, but there are parts I need indeed).
I still don’t get what a “proxy” is in the example, though…could it be a fake switch?

I’m going to make some tests.

One more question: what’s in general the right way to pass a position parameter to a rollershutter?
Why is RollerShutter.sendCommand(50) wrong?

Commands don’t really care about Points and Equipment in any way. They operate on Items.

If you want your Group Items to accept Rollershutter commands and pass along to members, I think you need to make your Groups to be subtype Rollershutter.
You don’t need any aggregation function just to distribute commands.

If you send a command and it doesn’t do anything you expect, time to look into channels/Thing/binding path. None of that cares about Points or equipment either.

Looking in your events.log may give a clearer view of who is doing what.

mmm…this is unclear…aren’t equipments and points, items?
…if I go under Items section, I find them there…and if I create a rule, it allows me to pick up one of them…
If they are not items, how am I supposed to interact with them with rules?

That’s what I’ve done (if I get what you are saying): as a matter of fact, i can see UP/STOP/DOWN commands for the group gRS in the overview page, and pushing a button gives the command to all of my RS.

…the problem is all about rules/scripts…

Yes, Equipment and Point properties of your Items are completely irrelevant here.

Excellent, so the problem narrows down to your channel-Thing-binding-device chain.

So…I made some tests… (quite) everything seems to work correctly:

  • I managed to create another link (point) with dimmer properties to a single rollershutter, and the binding correctly send the command to open a % of the rollershutter simply dragging the dimmer point (from which I deduce that the basic configuration is correct and the binding is working correctly)
  • I managed to create a rule in the UI where I set to close all of my rollershutters (sending the command to gRS group) at a given time (“when the time is 22.30 then send command DOWN to gRS”) (from which I deduce the group is correctly set)

What I still can’t do is to send a command via script…any example? …scripting is still a mistery :thinking:

Finally I think I got the point…well, YOU got the point.

It seems like i’m still making some sort of mess with definitions…so I ask you to give me one last help.

To create my semantic model, i followed step by step the tutorial ( https://www.openhab.org/docs/tutorial/model.html ).

I created my LOCATIONS, then created EQUIPMENT from thing and then linked channels to create POINTS.

So, just to make an example for the RollerShutterThing THING (bold text are names):

  1. Created location gHome
  2. Selected gHome and created EQUIPMENT eRollerShutter from thing (RollerShutterThing)
  3. In the process of creating eRollerShutter, I checked a channel to link, so I created a pRollerShutter POINT

Now, my (tree) model looks like gHome → eRollerShutter → pRollershutter

Back to your post, now: what’s the name of the ITEM I have to refer to in a script?

Well, when you work with semantics there are no openHAB Things involved. (Though of course you can use word thing in the names that you give)

“Location” and “Equipment” are just properties of Items, and as they are both a sort of collection the Items in question are of Group type.
“Point” is a property of an ‘ordinary’ Item.

I have a Python programm running taking care of the rollershutter movements and functioning as interface to the rollershutter remote(s). I took measurements of the closing times for each roller shutter and put them into this programm. With an MQTT transfer I am telling the programm to which percentage I like to close a rollershutter. This is done by a command to a item in openHAB.

Thanks to everyone.
I finally managed to make it properly work. Everithing was done correctlyt, except for the rules: I used ECMA instead of DSL language. Now I can simply send an item.sendCommand(75) to close 75% my Rollershutter.
For sure @rossko57 pointed me to the right direction making me understand a bit more the OH3 structure. :slight_smile:

1 Like

Hi ,
Could you please explain more and eventually paste your .py script. That would be a good starting point for others including me .
Thanks.

Hello Goran, it will take few days to answer your request specifically. I’m on the road the next 2 weeks. I’m coming back to you when I have all my resources available.

Hi Goran, I could take a quick look to the scripts. Because I wrote it some time ago I had not remembered that it is very specific for my needs. It make no sense to post it.

Some hints:

  1. I have measured the time for each shutter which it takes to close.
  2. I use MQTT for the communication
  3. Topic contains the number/name of the shutter, message contains the value for the movement.
  4. Values: 0 equal Up, 100 equal Down, any value between 0 and 100 to close the shutter correspondingly
  5. I don‘t get any feedback upon the status of the shutter. Therefore I have to make sure to start the movement at the open position.
  6. Now I have only to transfer the percentage of the level the shutter should close.

I hope that this will help you to write a script