Well, basically I need a notify that sets a dummy device when number is odd/even. Odd number means that channel is actuated. Even number means it has been released
Event monitor:
2015-03-22 01:17:01 CUL_HM CUL_HM_HM_SWI_3_FM_2F332D CUL_HM_HM_SWI_3_FM_2F332D_Sw_01 toggle (to broadcast)
2015-03-22 01:17:01 CUL_HM CUL_HM_HM_SWI_3_FM_2F332D_Sw_01 trigger_cnt: 127
2015-03-22 01:17:01 CUL_HM CUL_HM_HM_SWI_3_FM_2F332D_Sw_01 toggle (to broadcast)
2015-03-22 01:17:01 CUL_HM CUL_HM_HM_SWI_3_FM_2F332D_Sw_01 trigger: Short_127
2015-03-22 01:17:02 CUL_HM CUL_HM_HM_SWI_3_FM_2F332D battery: ok
2015-03-22 01:17:02 CUL_HM CUL_HM_HM_SWI_3_FM_2F332D CUL_HM_HM_SWI_3_FM_2F332D_Sw_01 toggle (to broadcast)
2015-03-22 01:17:02 CUL_HM CUL_HM_HM_SWI_3_FM_2F332D_Sw_01 trigger_cnt: 128
2015-03-22 01:17:02 CUL_HM CUL_HM_HM_SWI_3_FM_2F332D_Sw_01 toggle (to broadcast)
2015-03-22 01:17:02 CUL_HM CUL_HM_HM_SWI_3_FM_2F332D_Sw_01 trigger: Short_128
Notify code I tried but does not work:
define alarm_locked notify CUL_HM_HM_SWI_3_FM_2F332D_Sw_01:trigger.$is_odd set alarm on
$is_odd in a regexp is not doing what it implies, you should use \d*[13579] instead.
You also have to take care of space, the complete regexp should be
CUL_HM_HM_SWI_3_FM_2F332D_Sw_01:trigger_cnt:.\d+[13579]
(untested)
Oh snap, it worked like a charm.
I googled the code for even numbers.
Thanks alot kind sir!
Is it realy necessary to use a Dummy? Or is it enough, if you have a UserReading with 0 or 1 in ist?
attr CUL_HM CUL_HM_HM_SWI_3_FM_2F332D userReadings OnOff {ReadingsVal("CUL_HM CUL_HM_HM_SWI_3_FM_2F332D","trigger_cnt",0) % 2 ? "1" : "0"}
Cheers, Ici