Howto: OpenHAB2, RFXCOM and Somfy RTS Rollershutters

This is the rule I use:

rule "Set value"
	when
		Member of SunBlinds received command
	then
		var command = receivedCommand
		var item = triggeringItem

		switch command {
			case UP: {
				item.postUpdate(new PercentType(0) as Number)
			}
			case DOWN: {
				item.postUpdate(new PercentType(100) as Number)
			}
			case STOP: {
				item.postUpdate(new PercentType(50) as Number)
			}
		}
end

This requires that the blinds are in the SunBlinds group, but can be altered to work with individual items as well.

I’ve been thinking about doing something like this as well, and i could certainly be done (with some margin of error). But IMO it costs more in terms of work than it’s worth. Where it gets most problematic is a case where you first set the blinds to 30% (down → wait 15 * 0.3 seconds → stop), then you want to change to 50% (down → wait 15 * (0.5 - 0.3) seconds → stop) etc. It would probably get out of sync eventually. Not to mention i someone uses the remote to set it to ~90%, then you want to change to 60%, but OH still thinks it’s at 50%.

If you only want to be able to see the percentage based on the moving time it might be easier (down → count time → stop → calculate percentage), but won’t work with the ‘my’-button (since OH only sees a stop command and then nothing more). And, again IMO, quite a lot of work for something I don’t need to know that accurately anyway. YMMV of course.

Yes. You can periodically “recalibrate” by listening for commands and running a timer for just over max run time. If a STOP is issued by rule or UI, cancel the timer. Otherwise if the timer expires, you know the shutter must at the end of travel, and reset your position estimate to 0/100% as appropriate.

Thanks for the rule.
Yeah probably would be a lot of work, and have to hide the remotes from the wife and kids :rofl:
Mine already returns 0 for up and 100 for down, just have to set the MY one.

Hi! I’ve been running my RFXtrx433XL on 433.92 MHz for quite a while now but now I’d like to control a few 433.42 MHz Somfy devices as well. Is this possible with just one RFXtrx433XL?

I tried to define a second bridge (using the same serialPort) and passing both bridges their respective setMode values, hoping that they “automagically” switch between the two transceivers when a command is to be sent using one of them. That didn’t really work out, presumably because setMode is being issued only once during bridge initialization and/or the serial port is being locked by the (first) bridge using it
?

Is there any way I can make this happen, i.e. switch between the transceivers (e.g. via setMode) dynamically somehow?

Thanks!

Hi Brevilo, welcome to the forum!

I don’t have an RFXtrx433XL myself, but what you want to do should be possible. I do think however, that you should be using only one bridge. The RFXtrx433XL will then automatically use the correct frequency depending on whether it needs to control a Somfy device or something else.

Are you able to control you Somfy devices using the RFXmngr program from RFXCOM? If not, then first make sure that you can control them using the RFXmngr before trying with openHAB.
Also, if you can control all your devices with the RFXmngr program then you don’t need to use the setMode option.

I did part of this a while ago and can’t remember the details. However you have to pair both somfy devices with the RFXtrx like decribed in the manual (i did this using the windows RFXmngr like Like marcel_erkel wrote). Use different ID/Unit Code. You will get different rfu codes for both.
I don’t remember what i did in openHAB then and removed the item file some time ago.<\grrr>

EDIT: grabbed out some more info here

.

Thanks guys, it does indeed work with a single bridge and without using setMode, nice! The two mistakes I made earlier were:

  • I missed to change the Rollershutter item’s channel type from command to shutter, so things didn’t work right away (despite everything working in RFXmngr).
  • Next I let RFXmngr trick me into thinking that the frequency/transceiver selection is mandatory, because of its frequency drop down menu that seemed to require some kind of confirmation before being effective. That’s when the idea for the second bridge and setMode was born


Now (after fixing the channel type) it all works as expected! :beers:

One final related question: is there a way to have a state-bearing group item for a group of Rollershutter items in Basic UI? I’d like to control said group of shutters as a whole and it works just fine using HABPanel. Yet I can’t get that to work with a sitemap: Basic UI always just shows a normal group element, leading to a sub-view with the group’s individual items and without the (default) Rollershutter controls on the group itself.

Cheers

You’d want to put it on your sitemap using a widget other than Group.

Switch item=myRollerGroup

Hm, that’s not the needed UX as a switch is an ON/OFF state control. The Rollershutter default control (for a single shutter) provides UP, DOWN and STOP buttons (stateless) per shutter. The group should be controlled in the same way, like HABPanel does it.

If your group is of a type Rollershutter then put it on the sitemap with Default type:

Default item=myRollerGroup

It should render the rollershutter controls (up down and stop)

There is no Rollershutter widget.

There is a Switch widget. When you use a Switch widget with a Rollershutter type Item, you get UP-DOWN

I think this maybe something you should try out, rather than insist that it doesn’t work.

(The Default for a Group will never be UP-DOWN buttons, it’ll be Group pop-up style widget.)

I thought we were speaking about sitemap, not habpanel
sorry maybe I misunderstood

There is no Rollershutter widget.

Never said that. I was talking about the Default control/widget for Rollershutter items.

When you use a Switch widget with a Rollershutter type Item, you get UP-DOWN. I think this maybe something you should try out, rather than insist that it doesn’t work.

That is indeed correct, but all but intuitive. Anyway, this is the answer to my remaining question, so thanks a bunch for your patience :beers:

If your group is of a type Rollershutter then put it on the sitemap with Default type:
Default item=myRollerGroup
It should render the rollershutter controls (up down and stop)

This is what I had tried intuitively and what didn’t work out. Thus, if others are looking for a solution to that problem: use a switch for that shutter group (see previous post)


I’m pleased that it actually works! To spell it out 

sitemap widget
Switch item=myGroup ...
is smart enough to recognise Item
Group:Rollershutter myGroup "blah" ...
as a Rollershutter “flavoured” Item, and so the widget performs the special UP-DOWN version of its button rendering.

Sure, understood. It’s pedantic but there is no actual Default widget, it’s just an instruction to look at the Item type and auto-choose the appropriate widget for it.
In the case of Rollershutter type Item, that’s Switch widget.
In the case of Group Item, that’s Group pop-up widget.