[BTicino/OpenWebNet] Adding CEN commands: design

Hi all,
find here beta9-pre2, which implements basic support for CEN scenario buttons:

org.openhab.binding.openwebnet-2.4.0-b9-pre2.pdf (152.8 KB)

Channels button1..button4 are of type scenarioButton and can have the following states:

Channel Type ID Item Type Description Read/Write
scenarioButton String Pressure of a CEN scenario button: PRESSED, RELEASED, PRESSED_EXT, RELEASED_EXT R

senario_control4

You can add a BUS Scenario Control-4 (4 buttons) thing from PaperUI Inbox.

Automatic discovery for CEN is implemented using discovery by activation, a new way to discover things: when item search is still active (spinning arrow in Inbox), activate the physical device (for example push a Scenario button) to have it discovered by the binding.

Alternatively you can configure the thing/item manually:

Thing:

Bridge openwebnet:bus_gateway:mybridge "MyHOMEServer1" [ host="192.168.1.35", passwd="abcde" ] {
    ...
  bus_scenario_control4    LR_scenario      "Living Room Scenario Control" [ where="20" ]
}

item (button 1):

String   iLR_scenario    <network>   { channel="openwebnet:bus_scenario_control4:mybridge:LR_scenario:button1" }

Try the new pre-release and tell me here in this thread how it works!

It would very nice if someone could write a rule example that uses a scenarioButton (WHO=15) to activate some other OH2 command or scenario.

Bye
Massi

can someone here use the official bticino client (https://www.myopen-legrandgroup.com/developers/ -> tab TOOLS) and then send these commands:

  1. *#15*0##
  2. *#25*0##
  3. *#1015*0*7##
  4. *#1025*0*7##

and then send me images of the output windows ?
bye
M

Hi Massi, great to see you are progressing with CEN
Does this work with normal wall switches? I have an F420 scenario module which I never use because I can do more using openhab.

Massimo, Cen don’t has status only command.
Bye
Sandro

if it’s a scenario switch yes: it should work with any device that generates WHO=15 basic and evolved CEN (see here: https://www.myopen-legrandgroup.com/content/uploads/2016/06/WHO_15-25.pdf)

bye
m

Hi Sandro,
correct CEN does not have a state, but every item in OH2 has to have a state, right?
So the binding maps CEN events (about pressure of a button) in these states: PRESSED , RELEASED , PRESSED_EXT , RELEASED_EXT.
do you have suggestions for a different design?
bye
m

Great I’ll have a try later today…the link above is only 152kb and is a .pdf is this correct??

I did the test, no answer on all 4 frames

Yes: change the extension to .jar and follow the instruction on the binding README for upgrading from previous binding version.

M

You should at least have received a NACK response: *#*0##
Did you get it?

@massi

Massi,

I installed it and it managed to discover my normal switches but it does not find the CEN ones. I ran the same test and I’m not getting any reply

Did you follow the “disover by activation” method?

if yes, can you set log level to DEBUG (see README how), repeat the discovery process activating some of your CEN swtiches, and send me your log via PM ?

massi

I did that and there was nothing in the logs

Julian, if you set the logs to DEBUG in OpenHAB (see README how!), and then start a new item discovery from inbox and then during discovery you switch ON one of your CEN scenario buttons, for sure you will have something in the openhab.log file. Check this again.
M

See post update 51

I have run simulation tests.
I created button1 ("iLR_scenario ") and a swith (“iLR_sim_scenario”) to simulate two things:

  • activation of the rules by the pressure of the device (physical) CEN
  • via Openhab switch to activate the rules or scene MH202 through CEN frames

Everything works !!!

image

File .things
Thing	bus_on_off_switch   	mylig_sala		"Luce Sala"	@ "Test"	[ where="22" ]
Thing 	bus_scenario_control4   LR_scenario     "Scenario 10-02" 	@ "Test"	[ where="102" ]
File .items
Switch 		Luce_sala 			"Sala" 				<light>		(C_Sala, G_Lights)  [ "Lighting" ]		{ channel="openwebnet:bus_on_off_switch:mybridge:mylig_sala:switch" }
String   	iLR_scenario        "Scenario 10-02"	<network>   (C_Sala, G_Lights) { channel="openwebnet:bus_scenario_control4:mybridge:LR_scenario:button1" }

Switch 	    iLR_sim_scenario 	"Simula CEN 10-02" 	<light>	(C_Sala, G_Lights)  [ "Lighting" ] 	{ channel="openwebnet:bus_scenario_control4:mybridge:LR_scenario:switch" , expire="5s,command=OFF"}

N.B. the expire command is used to simulate the release

File .rules
/************************************
*** CEN 10-02 PRESSED_EX          ***
*************************************/
rule "CEN 10-02 PRESSED"
when
    Item iLR_scenario received update "PRESSED_EXT"
then
		sendCommand(Luce_sala, ON)
end

/************************************
*** CEN 10-02 RELEASED_EXT		  ***
*************************************/
rule "CEN 10-02"
when
    Item iLR_scenario received update "RELEASED_EXT"
then
		sendCommand(Luce_sala, OFF)  
end



/************************************
*** Simula CEN con Switch ON	  ***
*************************************/
rule "Simula CEN con Switch ON"
when
    Item iLR_sim_scenario received command ON
then
		sendCommand(iLR_scenario, "PRESSED_EXT")
    
end

/************************************
*** Simula CEN con Switch OFF		   ***
*************************************/
rule "Simula CEN con Switch OFF"
when
    Item iLR_sim_scenario received command OFF
then
		sendCommand(iLR_scenario, "RELEASED_EXT")
    
end

What does not work is the recognition both automatic and by pressing the button

In any case, excellent work !!!

I wondered if there is a more streamlined way to simulate the switch without creating the 2 rules
“Simula CEN con Switch ON” and “Simula CEN con Switch OFF”.
Addition of parameters for (ON =“PRESSED_EXT”, OFF =“RELEASED_EXT”)
Or does it already exist?

@massi
Other tests with CEN detection.
In automatic it does not work.
By pressing the button it works but:
Start the survey, wait 15 seconds, and press … so it works.
If you press before 15 seconds it will not detect.

Massi
I just tested the link, with the CEN button.
When you start discovering new items and press the CEN button, this item appears but just with the “WHERE”, it misses the button (1-31)
With CEN on a “WHERE” address there can be 31 possible buttons with 4 functions. Let 31 * 4 = 124 functions.
Regards,
Arnaud

Hi Massi I’ve tried discovery with debug on and I get this:

2018-12-02 17:23:16.679 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *25*24#2*236##
2018-12-02 17:23:16.712 [DEBUG] [bnet.handler.OpenWebNetBridgeHandler] - ==OWN==  BridgeHandler ignoring frame <*25*24#2*236##>. WHO=CEN_PLUS_SCENARIO_SCHEDULER is not supported by the binding
2018-12-02 17:23:16.713 [DEBUG] [et.handler.OpenWebNetLightingHandler] - ==OWN:LightingHandler== updateLightState() for thing: openwebnet:bus_on_off_switch:31720c7b:53
2018-12-02 17:23:16.828 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *#1001*31*7*111111111111111111111111##
2018-12-02 17:23:16.829 [DEBUG] [penwebnet.message.OpenMessageFactory] - ##openwebnet## WHO=AUTOMATION_DIAGNOSTIC NOT SUPPORTED, frame=*#1001*31*7*111111111111111111111111##
2018-12-02 17:23:16.829 [DEBUG] [org.openwebnet.OpenGatewayBus       ] - ##gw-openwebnet-BUS## Malformed/Unsupported OpenMessage: *#1001*31*7*111111111111111111111111##
2018-12-02 17:23:16.864 [INFO ] [g.openwebnet.bus.MyHomeSocketFactory] - COM RECEIVED  <<<<<<<<<<<<============ *#1001*31*7*111111111111111111111111##
2018-12-02 17:23:16.878 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *#1001*01*7*111111111111111111111111##
2018-12-02 17:23:16.878 [DEBUG] [penwebnet.message.OpenMessageFactory] - ##openwebnet## WHO=AUTOMATION_DIAGNOSTIC NOT SUPPORTED, frame=*#1001*01*7*111111111111111111111111##
2018-12-02 17:23:16.879 [DEBUG] [org.openwebnet.OpenGatewayBus       ] - ##gw-openwebnet-BUS## Malformed/Unsupported OpenMessage: *#1001*01*7*111111111111111111111111##
2018-12-02 17:23:16.978 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *#1001*0*7*111111111111111111111111##
2018-12-02 17:23:16.979 [DEBUG] [penwebnet.message.OpenMessageFactory] - ##openwebnet## WHO=AUTOMATION_DIAGNOSTIC NOT SUPPORTED, frame=*#1001*0*7*111111111111111111111111##
2018-12-02 17:23:16.979 [DEBUG] [org.openwebnet.OpenGatewayBus       ] - ##gw-openwebnet-BUS## Malformed/Unsupported OpenMessage: *#1001*0*7*111111111111111111111111##
2018-12-02 17:23:16.979 [INFO ] [g.openwebnet.bus.MyHomeSocketFactory] - COM RECEIVED  <<<<<<<<<<<<============ *#1001*01*7*111111111111111111111111##
2018-12-02 17:23:16.979 [INFO ] [g.openwebnet.bus.MyHomeSocketFactory] - COM RECEIVED  <<<<<<<<<<<<============ *#1001*0*7*111111111111111111111111##
2018-12-02 17:23:17.716 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *25*22#2*236##
2018-12-02 17:23:17.718 [DEBUG] [bnet.handler.OpenWebNetBridgeHandler] - ==OWN==  BridgeHandler ignoring frame <*25*22#2*236##>. WHO=CEN_PLUS_SCENARIO_SCHEDULER is not supported by the binding
2018-12-02 17:23:18.246 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *25*23#2*236##
2018-12-02 17:23:18.248 [DEBUG] [bnet.handler.OpenWebNetBridgeHandler] - ==OWN==  BridgeHandler ignoring frame <*25*23#2*236##>. WHO=CEN_PLUS_SCENARIO_SCHEDULER is not supported by the binding
2018-12-02 17:23:18.426 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *25*24#2*236##
2018-12-02 17:23:18.435 [DEBUG] [bnet.handler.OpenWebNetBridgeHandler] - ==OWN==  BridgeHandler ignoring frame <*25*24#2*236##>. WHO=CEN_PLUS_SCENARIO_SCHEDULER is not supported by the binding
2018-12-02 17:23:20.015 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *25*22#1*236##
2018-12-02 17:23:20.020 [DEBUG] [bnet.handler.OpenWebNetBridgeHandler] - ==OWN==  BridgeHandler ignoring frame <*25*22#1*236##>. WHO=CEN_PLUS_SCENARIO_SCHEDULER is not supported by the binding
2018-12-02 17:23:20.539 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *25*23#1*236##
2018-12-02 17:23:20.540 [DEBUG] [bnet.handler.OpenWebNetBridgeHandler] - ==OWN==  BridgeHandler ignoring frame <*25*23#1*236##>. WHO=CEN_PLUS_SCENARIO_SCHEDULER is not supported by the binding
2018-12-02 17:23:20.971 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *25*24#1*236##
2018-12-02 17:23:20.972 [DEBUG] [bnet.handler.OpenWebNetBridgeHandler] - ==OWN==  BridgeHandler ignoring frame <*25*24#1*236##>. WHO=CEN_PLUS_SCENARIO_SCHEDULER is not supported by the binding
2018-12-02 17:23:22.347 [INFO ] [g.openwebnet.bus.MyHomeSocketFactory] - COM RECEIVED  <<<<<<<<<<<<============ *#*1##
2018-12-02 17:23:22.424 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *1*1*#2##
2018-12-02 17:23:22.439 [DEBUG] [bnet.handler.OpenWebNetBridgeHandler] - ==OWN==  ownId=2 has NO THING associated, ignoring it
2018-12-02 17:23:22.478 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *1*1*36##
2018-12-02 17:23:22.488 [DEBUG] [et.handler.OpenWebNetLightingHandler] - ==OWN:LightingHandler== updateLightState() for thing: openwebnet:bus_on_off_switch:31720c7b:36
2018-12-02 17:23:22.578 [INFO ] [org.openwebnet.OpenGatewayBus$a     ] - MON RECEIVED  <<<<<<<<<<< *25*22#2*236##
2018-12-02 17:23:22.602 [DEBUG] [bnet.handler.OpenWebNetBridgeHandler] - ==OWN==  BridgeHandler ignoring frame <*25*22#2*236##>. WHO=CEN_PLUS_SCENARIO_SCHEDULER is not supported by the binding

I am not sure to understand your comment…
Of course there are no buttons in the Inbox: did you try to confirm the new item? then you will see the buttons in the control tab (if item linking is set to auto).
For now only a 4-buttons CEN device is supported, as I wrote.
In theory there are 32 possible buttons (0-31), but in practice there are 4- and 6-buttons devices, correct? or do you have devices with more buttons?
Also, you should read better my explanation of the channels: there are 4 states possible for each button, so with CEN on each “WHERE” address there can be 4 or 6 buttons channels, each one with 4 possible states.

Massi