[BTicino/OpenWebNet] Adding CEN commands: design

@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

I have found a method for adding channels dynamically to existing things.
So in addition to supporting channels for buttons 0-31 for items/things manually defined (using files), one will be able to first discover a CEN device by activation of one of its buttons, add it to the items from Inbox, and then further channels of the CEN thing will be added dynamically as soon as each physical button is activated.

@Julian_Divett, @tagada: does it make sense to support your plant ?

massi

Yes that sounds like it should work.

Hello Massi,

Yes, it looks good for discovery and use :wink:

Regards

Arnaud

Find here beta9 of the binding:

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

it includes support for WHO=15/25 CEN/CEN+ for rules activation from Scenario Control devices.
Use discovery by activation to discover CEN/CEN+ devices; after the device has been added from Inbox buttons 0-31 are discovered by pressing them.

BEFORE TESTING this version, REMOVE any previous scenario thing/item created.

Channel

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

.thing

bus_scenario_control LR_scenario "Living Room Scenario Control" [ where="20" ]

.item

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

rule

rule "CEN rule"
when
    Item iLR_scenario_btn1 received update "RELEASED"
then
    sendCommand(iLR_dimmer, ON)  
end

Give it a quick test, tomorrow I will release it!

Massi

Hi Massi I had a very quick look and it discovered the button pressed on a CEN25 wall switch!! Here is my log file which seems to be ok. I’ve not tested any rules but I think this should be ok. Thanks very much for the work.

2018-12-14 13:12:47.366 [vent.ItemStateChangedEvent] - ScenarioControlWHERE236_Button1 changed from NULL to PRESSED
2018-12-14 13:12:47.618 [vent.ItemStateChangedEvent] - ScenarioControlWHERE236_Button1 changed from PRESSED to RELEASED
2018-12-14 13:12:51.880 [vent.ItemStateChangedEvent] - Al_Office_ZoneStatus changed from CLOSED to OPEN
2018-12-14 13:12:53.379 [vent.ItemStateChangedEvent] - Al_Office_ZoneStatus changed from OPEN to CLOSED
2018-12-14 13:12:54.386 [vent.ItemStateChangedEvent] - ScenarioControlWHERE236_Button1 changed from RELEASED to PRESSED
2018-12-14 13:12:54.638 [vent.ItemStateChangedEvent] - ScenarioControlWHERE236_Button1 changed from PRESSED to RELEASED
2018-12-14 13:12:55.879 [vent.ItemStateChangedEvent] - Al_Office_ZoneStatus changed from CLOSED to OPEN
2018-12-14 13:12:55.996 [vent.ItemStateChangedEvent] - ScenarioControlWHERE236_Button2 changed from RELEASED to PRESSED_EXT
2018-12-14 13:12:56.058 [vent.ItemStateChangedEvent] - ScenarioControlWHERE236_Button2 changed from PRESSED_EXT to RELEASED_EXT
2018-12-14 13:12:57.380 [vent.ItemStateChangedEvent] - Al_Office_ZoneStatus changed from OPEN to CLOSED
2018-12-14 13:12:57.838 [vent.ItemStateChangedEvent] - ScenarioControlWHERE236_Button1 changed from RELEASED to PRESSED_EXT
2018-12-14 13:12:57.986 [vent.ItemStateChangedEvent] - ScenarioControlWHERE236_Button1 changed from PRESSED_EXT to RELEASED_EXT
2018-12-14 13:12:59.745 [vent.ItemStateChangedEvent] - ScenarioControlWHERE236_Button1 changed from RELEASED_EXT to PRESSED
2018-12-14 13:12:59.996 [vent.ItemStateChangedEvent] - ScenarioControlWHERE236_Button1 changed from PRESSED to RELEASED

Just looked again and we need to check that a long press should keep sending an event PRESSED_EXT, so for example if you wanted to use a switch for volume control you could press and hold the button. I looked at the CEN documentation and it is not clear how often it sends the PRESSED_EXT frame but I think it is every 0.5 seconds.

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