[BTicino/OpenWebNet] Adding CEN commands: design

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