[BTicino/OpenWebNet] Adding CEN commands: design

We use this new thread to discuss the design of adding CEN/CEN+ events to the BTicino/OpenWebNet OH2 binding (work in progress).

The logic in the OH2 binding is that for each:

1 WHERE --corresponds–> 1 Thing
1 Thing --corresponds–> N Channels
each Channel --corresponds–> 1 Item of type: Switch, Number, String, etc.

in the case of CEN we have one button --> 1 WHERE, that can generate different interaction events (short_press, long_press, etc).
We have 2 options:

  1. have a different Switch (on/off) channel for each type of interaction (this I do not like too much), pretty much like it is now in the OH 1.x binding, if I understood correctly from Julian
  2. have one single String channel that can rapidly change its state and be valued “short_press”, “long_press” etc. or “no_action” if nothing is happening to the button.

Which would you see better of the 2 options?

Massi

@bastler I do not think it’s feasible to have both approaches, would make the CEN Thing too much complicated because it would mean to have at least 6 channels for each CEN button.

@Julian_Divett I mean that each Channel in OH has always a state, so a channel associated with a CEN button must probably have one of the 4 types of press or not_pressed state when the button is not pressed.
One then must work on OH rules or BTicino rules to associate the 4 press interactions with some rule execution/scenario.

That is the first design option in my first message, but the more complex to handle and implement.

Regarding states:

CEN/CEN+ may not have states, but in OH2 every channel/item must have a state, always.
So in option 2 I am proposing to have a String channel for each CEN button that can have 5 possible states:

  1. short_press
  2. start_extended_press
  3. extended_press
  4. release_extended_press
  5. no_press

The drowback of this soliution is that in PaperUI/SimpleUI you will never have a simple On/Off or Press button you can operate to activate the associated CEN scenario.

Can you all think about what you would like to get in your UIs and rules with CEN/CEN+ and tell me if the 5-state channel would work ?

Massi

i just cecked in myhomesuite the states for cen and cen-plus. each has 5 states (including “no press”) but they are different to each other. look what myhomesuite offers:

for cen:

  • start pressure
  • release after extended press.
  • extended pressure
  • short pressure

for cen-plus:

  • short pressure
  • start of extended presssure
  • extended pressure
  • release after extended press.

means “start pressure” is only available for cen. by the way this is the only state tha can be sent by domotica-app (and i think for multimedia touchscreen, too)

cen-plus for example has a state “start of extended presssure” what is not available in cen

so depending what kind of pressure i need i decide to use either cen or cen-plus commands.

and:
for me it is not important that cen work in paperui, i use openhab in webbrowser and in openhab-app on my mobile

Maybe my use case is a bit different but I would mostly want to send CEN, CEN÷ from Openhab to the BUS. Then scenarios in the scenario controller can be started by openhab. I am not so interested in openhab detecting CEN, CEN+ on the BUS.

1 Like

Mark,

I agree, detecting CEN/CEN+ in Openhab is not what i’m looking for, ut maybe it could be usefull for others?
As for the different opties, is it even possible to have •start pressure
•release after extended press.
•extended pressure
•short pressure

on a touchscreen?

ok @mark and @jpcolin can you make some examples here how would you activate CEN/CEN+?
From the PaperUI ? From mobile app?
Which OWN commands would you like to send on the BUS exactly ?
Would you need to use extended_press ? If yes, for what ? or just short_press ?

I have looked a bit in the OH community and there is apparently no way to simulate a short-press/long/press interaction from openHAB.
Could you help me in searching for that?

Bye
Massi

I have been thinking in the night and here is how i would like to use CEN/CEN+
Not so easy to describe, so i will take some real life example:

I have a Open sapce (kitchen, living room, dining room)
At the entrance i have a 6 pushbutton module. All CEN’s

  • Off button: Short press: turns al the lights off, long press all the lights off+ heating in night mode
  • Breakfast button: Short press: turns on specific lights and opens the shades if daylight, long press turns on specific lights and no action on shades.
  • TV button: Short press: turns on specific lights and opens the shades if daylight and close the shades if dark outside, long press turns on specific lights and no action on shades.
  • Dinner button : same principle
  • Cook nutton: same principle

So i would be nice to be able to activate those CEN/CEN+ from a button on Habpanel.

thats the same for me as jp describes: i have several physical switches that have more than one funktion, this i can realize with cen / cen+ commands. for example switches near the bed:

  1. switch: short press: tv on / long press: tv on with a timer
  2. switch: short press: light on/off over the bed / long press: all lights in bedroom on/off
  3. switch: short press: open/close big shutter / long press: open/close all shutters in bedroom

@mark: as far as i know on a touchscreen you only can trigger “start press”, the others can not be executed there

for me it is also most important to be able to send commands, but another idea: if it would be possible not only to send commands, even receive them, you can create rules in openhab that replace the scenario-controller.

I have been using CEN+ with the old binding and below is an example of a couple of switches. I don’t see any need for Hab Panel CEN functionality because I use rules which can be called easily enough. All I want is the ability to intercept the commands in OH2. I just treat the wall switches as (expensive) remote controls.

items    
Switch mstr_bed_hd_l_short_1 "Turn off Bedroom Lights" (gCen) {bticino="if=webserver;who=25;what=21#1;where=28"}
Switch mstr_bed_hd_l_long_1 "Turn off TV" (gCen){bticino="if=webserver;who=25;what=22#1;where=28"}
Switch mstr_bed_hd_l_ext_1 "Button 1 continued"(gCen) {bticino="if=webserver;who=25;what=23#1;where=28"}
Switch mstr_bed_hd_l_short_release_1 "Button 1 released" (gCen) {bticino="if=webserver;who=25;what=24#1;where=28"}

  rule "Master bedhead l side Button 4 short press"
    when
    	Item mstr_bed_hd_l_short_4 received update 
    then
    	sendCommand(Lt_Masterbed_Bath_Ceiling,ON)
    	sendCommand(Lt_Masterbed_Bath_Walls,ON)
    end

    rule "Master bedhead l side Button 1 long press"
    when
    	Item mstr_bed_hd_l_long_1 received update 
    then
    	sendCommand(masterbed_tv,OFF)
    end
1 Like

@ Julian,

As i see it, you use Openhab, what i try to do, is use my MH200N as much as possible to define/create rules/senes.
Only wha tis not posible in MH200N will be done in Openhab.

@jcolin

Yes of course I forgot that many users have MH200. I just have the 454 Webserver so all the rules need to be in openhab.

Hi,
I am releasing a beta8 next days (bugfix release), then will attack the CEN/CEN+ problem, since this is already supported in the v1 binding.

Based on your input here I will leave discovery for later, and start with a basic implementation supporting manual configuration on CEN/CEN+ events from the bus, so you can attach OH2 actions/rules to CEN/CEN+ physical buttons.

Of course I will need your support in testing since I have no CEN/CEN+ hw at home to test, so for me it’s all simulated.

Will let you know here when a beta9 with basic support of CEN/CEN+ events is available.

bye
massi

2 Likes

Good news and good job Massimo, looking forward to test!

Hi Massi,
it’s a very good news.
I used a binding modified by Julian Divett in 2016.
Actually, i used a CEN+ button from a 67552 (Celiane Legrand) with the rules to command a Somfy RTS shutters with a RFXCOM.

Example:
Items:
Rollershutter Shutter_FF_Children1 “Volet Fenetre” (gFF_Shutters_Ch1) { channel=“rfxcom:rfy:12e6f57c:shutter” }
Rollershutter Shutter_FF_Children11 “Volet Meurtriere” (gFF_Shutters_Ch1) { channel=“rfxcom:rfy:124694a0:shutter” }
Rollershutter Shutter_FF_Children12 “Volet SdB” (gFF_Shutters_Ch1) { channel=“rfxcom:rfy:c2f8e8b4:shutter” }

Switch Light_FF_Chambre_2_01_HAUT “CEN_01CH2_BTN_HAUT” (Cen) { bticino=“if=default;who=25;what=21#1;where=21” }
Switch Light_FF_Chambre_2_01_BAS “CEN_01CH2_BTN_BAS” (Cen) { bticino=“if=default;who=25;what=21#2;where=21” }
Switch Light_FF_Chambre_2_01_STOP “CEN_01CH2_BTN_STOP” (Cen) { bticino=“if=default;who=25;what=22#1;where=21” }
Switch Light_FF_Chambre_2_01_STOPA “CEN_01CH2_BTN_STOPA” (Cen) { bticino=“if=default;who=25;what=22#2;where=21” }
Switch Light_FF_Chambre_2_01_STOPB “CEN_01CH2_BTN_STOPB” (Cen) { bticino=“if=default;who=25;what=21#3;where=21” }

Rules:
rule “Volet Chambre2 Up”
when
Item Light_FF_Chambre_2_01_HAUT received update
then
sendCommand(Shutter_FF_Children1, UP)
sendCommand(Shutter_FF_Children11, UP)
sendCommand(Shutter_FF_Children12, UP)
end

rule “Volet Chambre2 Down”
when
Item Light_FF_Chambre_2_01_BAS received update
then
sendCommand(Shutter_FF_Children1, DOWN)
sendCommand(Shutter_FF_Children11, DOWN)
sendCommand(Shutter_FF_Children12, DOWN)
end

rule “Volet Chambre2 Stop”
when
Item Light_FF_Chambre_2_01_STOP received update or
Item Light_FF_Chambre_2_01_STOPA received update or
Item Light_FF_Chambre_2_01_STOPB received update
then
sendCommand(Shutter_FF_Children1, STOP)
sendCommand(Shutter_FF_Children11, STOP)
sendCommand(Shutter_FF_Children12, STOP)
end

Lokking forward to test :wink:

Best regards

Arnaud (A french user of Openhab)

Thanks Massi for your very appreciated work. Do you have any update about binding of CEN? I’ve 2 scenarios to configure, but I don’t know how can bind them.

Thanks again
regards

Hi,
after some analysis, I am thinking of defining a scenarioButton channel, which can have 4 states:

  • pressure : the button is being pressed using short pressure, this state can last only <0.5sec
  • release : the button has been released after a short pressure
  • pressure_ext : the button is being pressed using long (extended) pressure, this state value is repeated until is kept pressed
  • release_ext : the button has been released after a long (extended) pressure

and then to map both the CEN/CEN+ messages received from the BUS to one of these 4 states.
So for example the sequence will be:

  • short pressure: previous state (UNDEF/release/release_ext) -> pressure -> release
  • long pressure: previous state (UNDEF/release/release_ext) -> pressure_ext (*repeated if keep pressed) … -> release_ext

In this way you have just to concentrate on the type of pressure you want to react on and the rules in OH2 would be exactly the same no matter if you want to activate them from a CEN or CEN+ command: you have just to write a rule based on the state changes of the scenarioButton channel and activate commands according to your wanted behaviour.

Before going into implementation, I want to have some feedback from you about this design.

bye
m

Hi Massi,
This solution is correct for me.
Regards
Arnaud

Hi Massi yes that should work.

souds good to me too!

ok I will proceed implementing this design. Will let you know here when is ready for testing.
bye
M