mvalla / openhab-addons

Add-ons for openHAB
Eclipse Public License 2.0
24 stars 16 forks source link

cenplus commands interpretation #49

Closed weltraumbagger closed 5 years ago

weltraumbagger commented 5 years ago

actually we have this interpretations for cenplus commands: PRESSED, RELEASED, PRESSED_EXT, RELEASED_EXT but this are the correct commands that belong to cenplus:

the difference between pressed and short_press: if using a rule, actually "pressed" will be triggered as soon as i press a physical switch. but in cenplus "short_press" will only be triggered when i press and release the button within about 2 seconds. when i keep pressing, only "start_extended_press" must be triggered (after about 2 seconds). thats an important difference if you run scenarios on the mh200n. so at the moment you cannot trigger an "start_extended_press" because "press" catches the rule before.

mvalla commented 5 years ago

I tried to map both CEN & CEN+ to the same channel states (PRESSED, RELEASED, PRESSED_EXT, RELEASED_EXT), to simplify and uniform OH2 rule writing for CEN&CEN+.

So the mapping CEN+ -> channel state is the following:

received OWN Message PRESSURE_TYPE ---> channel state
*25*21#N*WHERE## SHORT_PRESSURE PRESSED, after shortPressureDelay (0,25sec): RELEASED
*25*22#N*WHERE## START_EXT_PRESSURE PRESSED_EXT
*25*23#N*WHERE## EXT_PRESSURE PRESSED_EXT
*25*24#N*WHERE## RELEASE_EXT_PRESSURE RELEASED_EXT

Please clarify what you want to achieve.

For example if you want to write a OH rule that starts when you long press a CEN+ physical button, you should trigger the rule when the state has a value PRESSED_EXT like this: when Item CENPlusItem changed to PRESSED_EXT

weltraumbagger commented 5 years ago

i think you are right. i thought about this: i have a physical switch that is cen+ with address 25, top is button 10 bottom is button 11. with this switch i control 2 lights: main-light and background-light when pressing button 10 short -> background light switches on when pressing button 10 long -> main-light switches on and when pressing button 11 short -> background light switches off when pressing button 11 long -> main-light switches off this works at the moment with a cenario programmed in mh200n

now i thought it might be not possible to transfer this cenario to openhab because with your interpretation the short press will always be recognized even if it will be a long press. BUT the physical switch does not send the short press at once, it waits and only sends it when releasing the button in short time. because of that i think i have been wrong and we can close this issue.

mvalla commented 5 years ago

correct, PRESSED will be sent on BUS only when a CEN+ button is short pressed, and not when the button is long pressed, so also openhab will receive these states on the channel correctly. This issue will be closed as invalid.