[BTicino/OpenWebNet] Adding CEN commands: design

yes, its’ every 0.5s and the binding already should send a PRESSED_EXT update everytime the physical button sends it, so one could write a rule like in example above from @gozilla01:

rule "CEN 10-02 PRESSED_EXT"
when
    Item iLR_scenario received update "PRESSED_EXT"
then
		sendCommand(Luce_sala, ON)
end

Caution

@massi
Test with beta9 with problems, channels are not created.
I tried the beta9-pre2 instead it works by modifying bus_scenario_control in bus_scenario_control4
Am I wrong?

.thing
Thing bus_scenario_control cen_gen_giorno "Scenario GEN Giorno" @ "Scena" [ where="2"]

.items
String CEN_TX_Tap_Giorno "T 1 GEN Giorno" <network> (C_Corridoio, G_Cen) [ "Lighting" ] { channel="openwebnet:bus_scenario_control:mybridge:cen_gen_giorno:button2" }

image
image

2018-12-15 16:05:42.578 [.ItemChannelLinkAddedEvent] - Link 'CEN_TX_Tap_Giorno-openwebnet:bus_scenario_control:mybridge:cen_gen_giorno:button2' has been added.

Edit:
Both automatic detection of CEN and pressure sensing did not work.

Hi Michele,
After a CEN/CEN+ device is added from Inbox, scenarioButton channels corresponding to physical buttons are added automatically after they are first activated from the physical device (refresh web page if needed).
So you will need to follow these steps:
start Scan > wait 15 sec > press one of the CEN buttons (eg button2) > it should appear a new CEN thing in Inbox > confirm it to add in the list of things > press again the same CEN button > refresh Control web page > only now after the channel is added it should appear the CEN thing with channel=button2

Can you test this and let me know?

I am already working to simplify this and have channels added during the scan-discovery phase.

The WHERE is wrong here: it must be always prefixed by a 2, so if the address of CEN Control device is 2 then the WHERE to be used is 22. I will add a note in the thing configuration.
You should change the WHERE to 22 and then pressure sensing should work.

Bye
Massi

ok it works
Considerations:

  • The note write it as big as a house, many will do the same my mistake, you can not do the “2” automatically? Do you conflict with the where for CEN?
  • I modified the .things file by putting the “2” in front of it.
    But you have to press the physical button if it does not appear in the paperUI
    Can not you do it automatically?

I performed the test 6 times.
The first 3 nothing, the 4 found me only one CEN +, 5 and 6 the second does not recognize it.
image

Hi Michele,

I suggest you do the following:

  1. remove all CEN/CEN+ devices you have configured in OH2, both from PaperUI or from file (.items/.things) configuration.
  2. deactivate the current OpenWebNet binding from Karaf console (see README howto )
  3. install the binding version beta9, I copy here again:
    org.openhab.binding.openwebnet-2.4.0-b9.pdf (157.8 KB)
  4. start a new discovery for CEN/CEN+.

It’s important to do that during the Scan process:

  1. start Scan from Inbox , wait 15 sec
  2. press one of the CEN/CEN+ buttons (eg button2)
  3. it should appear a new CEN thing in Inbox
  4. confirm the new thing to add in the list of things
  5. IMPORTANT at this moment no item is shown yet in PaperUI>Control page
  6. press again the same CEN button (its’ not important that Scan is still running now)
  7. refresh PaperUI>Control page

You should have now a new Thing in PaperUI with 1 channel: button2.

It works for me (in my simulator) and it works for others here (Julian_Divett, see above), so the CEN/CEN+ discovery by activation should work for you as well.
If it does not work all you have to do is set debug level to DEBUG (see README how), repeat the discovery process, send me the openhab.log file via PM.

Bye
M

Hello Massi,
Thanks for a very good job.
The CEN and CEN+ button works and the rules works.
Example:
rule “Volet_Knx_1_Down”
when
Item VoletKnx1D received update “PRESSED”
then
sendCommand(Volet_Knx1, DOWN)
end

rule “Volet_Knx_1_Up”
when
Item VoletKnx1U received update “PRESSED”
then
sendCommand(Volet_Knx1, UP)
end

rule “volet_Knx_1_Stop”
when
Item VoletKnx1D received update “PRESSED_EXT”
or
Item VoletKnx1U received update “PRESSED_EXT”
then
sendCommand(Volet_Knx1, STOP)
end

rule “Volet_Gen_Down”
when
Item VoletKnx2D received update “PRESSED”
then
sendCommand(gRollladen, DOWN)
end

rule “Volet_Gen_Up”
when
Item VoletKnx2U received update “PRESSED”
then
sendCommand(gRollladen, UP)
end

rule “volet_Gen_Stop”
when
Item VoletKnx2U received update “PRESSED_EXT”
or
Item VoletKnx2D received update “PRESSED_EXT”
then
sendCommand(gRollladen, STOP)
end

Very good
Best Regards
Arnaud

1 Like

@tagada
I suggest you make this change, see link

item changed [from <state>] [to <state>]

other way:

rule "Da CEN 10-02"
  when
    Item iLR_scenario changed
  then
    switch(iLR_scenario.state ) {
      case "PRESSED": {
      }
      case "RELEASE": {
      }  
	  case "PRESSED_EXT": {
		sendCommand(Luce_sala, ON)
      }
      case "RELEASED_EXT": {
		sendCommand(Luce_sala, OFF)
      }
	}
end

The new version beta9-1 has been released, it should close all the requirements and issues with CEN/CEN+.

Note that there are some changes from the previous beta9 version in the support for CEN/CEN+:

  • CEN/CEN+ things are now separated:

    • bus_cen_scenario_control
    • bus_cenplus_scenario_control
  • channels are now named button_X where X is the button number on the Scenario Control device

  • for discovered things, button channels appear in PaperUI after the first time the corresponding button is activated from the physical device. Refresh the PaperUI/Control page if needed

  • when creating CEN/CEN+ things using manual/file configuration, use the new buttons config parameter to define a comma-separated list of buttons numbers [0-31] configured for the scenario device, example: buttons=1,2,4

  • sending commands: PRESSED, RELEASED, etc. will simulate a virtual short/long pressure of the corresponding CEN/CEN+ button, enabling the activation of MH202 scenarios on the BUS from OpenHab

Channel Type ID (channel ID) Item Type Description Read/Write
scenarioButton (button_X) String Events or virtual pressure for CEN/CEN+ scenario buttons: PRESSED, RELEASED, PRESSED_EXT, RELEASED_EXT R/W

example CEN+ thing:

bus_cenplus_scenario_control  LR_CENplus_scenario "Living Room CEN+"        [ where="212", buttons="1,5,18" ]

example item:

String         iLR_scenario_btn1  "Scenario Button 1"               <network>           { channel="openwebnet:bus_cenplus_scenario_control:mybridge:LR_CENplus_scenario:button_1" } 

example rule:

// long pressure on CEN+ button will switch off dimmer
rule "CEN+ dimmer off"
when
    Item iLR_scenario_btn1 received update "RELEASED_EXT"
then
        sendCommand(iLR_dimmer, OFF)  
end

bye,
Massi

Thank you so much

hi massimo,

sorry i can´t get this work, i see the cen/cen+ functionality now first time but if i think right i´m afraid this may be not what i was waiting for.

what i don´t have is a 4-button cenario-control device
i use an mh200n and i wrote a lot of cenarios there.
actually i start this scenarios either with normal physical switches that are coded to send cen/cen+ commands or i even can start them on my mobile with the domotica app.
a cen command consists an “ambient” (0-10), a “pointlight” (0-15) and a button nr (0-99)
a cen+ command consists an “cen-plu” (0-2047), and a button nr (0-31)

for example to switch several lights on i start cen a=2, pl=1, btn=5 and i have to integrate installation niveau (#4#01). best would be a kind of “pushbutton”

can anybody help?

thanks, stefan

Hello,
I report this example of Massimo

scenario

.things

 Thing 	bus_cenplus_scenario_control    LR_scenario      "Scenario " @ "Scena"	[ where="21", buttons="1,2,4,5" ]

.items

String  iLR_scenario_btn1 "Scenario Button 1"   <network>  { channel="openwebnet:bus_cenplus_scenario_control:mybridge:LR_scenario:button_1" }

.sitemap

Switch    item=iLR_scenario_btn1 label="Scenario (btn1)[]" mappings=[PRESSED="Scenario-1 (PRESSED)", PRESSED_EXT="Scenario-2 (PRESSED_EXT)", RELEASED_EXT="Scenario-2 (RELEASED_EXT)"]

clicking on the buttons as in the animation are sent on the BUS of the virtual command CEN / CEN + equivalent to short pressure (PRESSED) or long press / release (PRESSED_EXT / RELEASED_EXT) of the scenario buttons.

@gozilla01 is correct, the binding beta9-1 now supports sending virtual pressure events on the BUS, replicating what happens when you press CEN/+ physical buttons.

You can do that by sending commands to button channels (for example using OH2 rules), or if you want to use sitemaps and oh2 apps you can define buttons like in the example above.
Activating CEN from PaperUI is more complicated because PaperUI does not support simple pushbuttons (at least not in a simple way).

The only thing you have to pay attention from example above you should change the Thing definition to CEN (and not CEN+).

Try to define it , if it does not work copy here your thing/item/sitemap conf and we will give a look.

Bye
M

thank you both, so obviously i did something wrong because it can´t get it work.

i´ll go on and report when sucessfull :blush:

hi massimo,

now i tried to switch a light on (cen 21, btn 9) and off (cen 21, btn 10). two things that i realized:

if i send command with domotica-app i receive this

2018-12-28 16:35:23.012 [INFO ] [org.openwebnet.OpenGatewayBus$a ] - MON RECEIVED &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; *15*09*21#4#01##
2018-12-28 16:35:28.256 [INFO ] [org.openwebnet.OpenGatewayBus$a ] - MON RECEIVED &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; *15*10*21#4#01##

if i send command with openhab i receive this:

2018-12-28 16:38:59.771 [INFO ] [g.openwebnet.bus.MyHomeJavaConnector] - COM SENDING ============&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; *15*9*21#4#01##
2018-12-28 16:38:59.843 [INFO ] [g.openwebnet.bus.MyHomeJavaConnector] - COM SENDING ============&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; *15*9*21#4#01##
2018-12-28 16:39:00.368 [DEBUG] [et.handler.OpenWebNetScenarioHandler] - ==OWN:ScenarioHandler== # 21#4#01 sending CEN virtual release...
 2018-12-28 16:39:00.372 [INFO ] [g.openwebnet.bus.MyHomeJavaConnector] - COM SENDING ============&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; *15*9#1*21#4#01##
2018-12-28 16:39:05.766 [INFO ] [g.openwebnet.bus.MyHomeJavaConnector] - COM SENDING ============&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; *15*10*21#4#01##
 2018-12-28 16:39:05.875 [INFO ] [org.openwebnet.OpenGatewayBus$a ] - MON RECEIVED &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; *15*10*21#4#01##
2018-12-28 16:39:06.355 [DEBUG] [et.handler.OpenWebNetScenarioHandler] - ==OWN:ScenarioHandler== # 21#4#01 sending CEN virtual release...
2018-12-28 16:39:06.359 [INFO ] [g.openwebnet.bus.MyHomeJavaConnector] - COM SENDING ============&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; *15*10#1*21#4#01##
 2018-12-28 16:39:06.442 [INFO ] [org.openwebnet.OpenGatewayBus$a ] - MON RECEIVED &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; *15*10#1*21#4#01##
2018-12-28 16:39:06.654 [DEBUG] [et.handler.OpenWebNetScenarioHandler] - ==OWN:ScenarioHandler== # 21#4#01 updating state to 'RELEASED'...

switching light off that works with both, domotica and openhab. but switching on does only work in domotica, so i suppose it might be the missing “0” at openhab at the button number?

problem with disappearing things:

here is my things (i added the installation-niveau “#4#01” there):

Thing bus_cen_scenario_control  AAA_CENNNNN "AAA CEN Light-test"        [ where="21#4#01", buttons="9,10" ]

my items:


String iLR_scenario_btn1 "Scenario 1" &lt;network&gt; { channel="openwebnet:bus_cen_scenario_control:MH200N:AAA_CENNNNN:button_9" }

String iLR_scenario_btn2 "Scenario 1" &lt;network&gt; { channel="openwebnet:bus_cen_scenario_control:MH200N:AAA_CENNNNN:button_10" }

as you see the name “AAA_CENNNNN” thats because very often if i change something in my things-file, the entry disappears in paperui/things. i have to give a new name then thing is back again. its enough to add a single letter and the thing is back.

do i something wrong?

best, stefan

How did you configure the .sitemap file?

hi michele,
my sitemaps looks simply:

Switch item=iLR_scenario_btn1 label="Scenario (btn1)" mappings=[PRESSED="Scenario-1 (PRESSED)"]
Switch item=iLR_scenario_btn2 label="Scenario (btn1)" mappings=[PRESSED="Scenario-1 (PRESSED)"]

bye, stefan

CORRECT : it’s a bug. Feel free to file a new issue: it will be corrected in the next release/patch.

Do you have another thing (light?) with the same WHERE address 21#4#01 as the CEN?
Does the log show some error when it happens that the CEN thing disappears ?

Bye
M

@bastler

Open new issues

Open new issues

thanks michele for opening the issue for me :slight_smile:

massimo, perhaps i did something wrong, i cannot find out why thing disappeared, this does not happen again - everything ok :slight_smile:

best, stefan