[BTicino/OpenWebNet] Adding CEN commands: design

@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

@Julian_Divett : are your physical buttons configured using CEN or CENPlus ??
As I wrote, I did the first implementation for CEN only, as a test.
CENPlus is not supported yet.

M

Ah that explains I have them as Cen Plus #25
I guess I could change them to Cen #15 I can’t remember what is the difference between the 2

I suggest you do not do change that in your plant.
Some gateways do not support CEN Plus and your scenarios may not work anymore.
If with the help of your test CEN WHO=15 works well, I can quite quickly add CENPlus WHO=25 (I am already on it).
bye
M

Yes I just looked and it is not clear that I would be easy to change over! I’ll wait for the next version.

Good luck and thank you for all the work…I look forward to testing it.

Hi Michele,
very good that things work in your setup!

It’s normal right now you have to wait 15sec before discovery by activation works. I am working on that, but for now I implemented this way to avoid messing up with the normal discovery cycle (which asks for all device states instead).

I do not understand very well in your rules why you have to use PRESSED_EXT and RELEASED_EXT to trigger the rule.
I would expect that when you long press the CEN physical button it switches ON the light, when you release the button after long press it switches the light off. Is really this the behavior you want?

Regarding activating CEN scenarios from OH2, this is not available yet.
So any command you send to a bus_scenario_control4 button channel, it does not produce any message on the BUS, for now.
So I wonder if really does it work and you see some scenario activated on the BUS when you press your Simula CEN 10-2 switch !

Bye
M

@massi

Light is a quick and visual test.
In fact I will use it to interface alarm (no bticino) with OpenHab Apps with notifications. Actually I have the management in AUX on the system for this that I asked the implementation of the AUX … I will do some concrete tests with CEN.
In the rule you can use both pressure and prolonged pressure.

Actually I have not tried in practice.
I assumed you were sending the status change update on the bus.
It will be like this ?

Massi,
Example,
With the L4652 / 2 Living Bticino control with 4 buttons.
It is possible to put “where A-PL = 10” on the left side with the number 31 on the top button with 4 states. And put the number 10 on the bottom button with 4 states.
It is possible to put the “where A-PL = 25” on the right side with the number 5 on the top button with 4 states. And put the number 18 on the bottom button with 4 states.
Thus the “where A-PL = 10” could be put on several L4652 / 2 commands to go up to 32 buttons with 4 states.
it would be nice to detect the “where A-PL” and the button number because otherwise we limit the “where A-PL” to 1 button with 4 states.

I hope I explained myself better :wink:

Regards

Arnaud

HHi Arnaud
Now I understand better, and you example is correct.

However…

First I wonder why one would do such a configuration, setting one WHERE then divide it into several device buttons around the house? What is the advantage compared to set one WHERE for each physical device and name its 4 buttons 1-4 ? I really do not understand!

Second I cannot find a way to discover single CEN buttons except one has to press them one by one during item scan, which is not very user friendly.
Unfortunately OpenWebNet does not provide a consistent way to discover devices (at least one that is documented), and the test you did with the official client shows that the 2 commands I know cannot be used for CEN: the commands I gave you to try were exactly hoping to get some answer about CEN device discovery.

So unless there is a clear need, I think I will keep the current design for now, where it is assumed buttons are numbered 1-4 (or 1-6) for each CEN WHERE

Bye,
Massimo

Hello,
This post replaces the previous one 38
for beginners like me, I publish the rules that I’m starting to use to use the new CEN function.
The sendCommand lights are used for pure demonstration example.

Update:
Item iLR_scenario received command : does not work
Item iLR_scenario received update : if you hold down continue, repeat the rules
Item iLR_scenario changed : it works

Thing 	bus_scenario_control4   LR_scenario     "Scenario 10-02" 	@ "Test"	[ where="102" ]
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" ] 				{ expire="5s,command=OFF"}
/**************************************
*** Da CEN 10-02					***
***************************************/
rule "Da CEN 10-02"
  when
    Item iLR_scenario changed
  then
    logInfo("Rules" , "Start Da CEN 10-02")  
    switch(iLR_scenario.state ) {
      case "PRESSED": {
	  
      }
      case "RELEASE": {

      }  
	  case "PRESSED_EXT": {
		sendCommand(Luce_sala, ON)
      }
      case "RELEASED_EXT": {
		sendCommand(Luce_sala, OFF)
      }
	}
end

/**************************************
*** Da Simula CEN con Switch		***
***************************************/
rule "Da Simula CEN 10-02 con Switch"
  when
    Item iLR_sim_scenario received command
  then
    logInfo("Rules" , "Start Da Simula CEN 10-02 con Switch")  
    switch(receivedCommand ) {
      case ON: {
		//sendCommand(iLR_scenario, "PRESSED")
		sendCommand(iLR_scenario, "PRESSED_EXT")
      }
      case OFF: {
		//sendCommand(iLR_scenario, "RELEASED")
		sendCommand(iLR_scenario, "RELEASED_EXT")
      }
	}
end

Does anyone have a better idea?

@massi

Item iLR_scenario received command : does not work… bug ??

1 Like

Massi I think it is ok to have 1 - 4 as the buttons on discovery but I would like to be able to create items/things manually which are not limited to these numbers. Personally I prefer using item files to the paper UI