Page 1 of 1

Reset input-switch on MOES MS-104B

Posted: 02 May 2021, 20:11
by Micha_he
Background:
I'll modify a MOES MS-104B (internal a WB2S BEKEN chip) with a ESP. The two input-channels a seems to work as follows:

Short press = single pulse to low
Long press = double pulse to low.

When I configure a Switch-Input-Device with 'Push Button Active Low' and press the button for a short time only, the state remains on '1' (for a long press, the release-impulse correctly reset it to '0').

Can I reset the switch-state with a rule-timer and special command ?
Or does someone have another solution? A normal switch does not work, because the impulses seem too short.

Edit: I have to revise the statement about the normal switch. It is short, but the event is triggered. But that doesn't really change the problem, because sometimes the 0-1-0 change is triggered once and a long press is then triggered twice.

Re: Reset input-switch on MOES MS-104B

Posted: 02 May 2021, 22:11
by Micha_he
Maybe I've found a solution... I'll report more, tomorrow.

Re: Reset input-switch on MOES MS-104B

Posted: 03 May 2021, 11:23
by Micha_he
I have to admit, my idea doesn't work!

Additional information:
  • Press and hold button = First pulse low 250ms
  • Release holded button = Second pulse low 250ms
  • Press button short with immediate release = Single pulse low 250ms
I've no idea how I should differentiate the two states.

Re: Reset input-switch on MOES MS-104B

Posted: 03 May 2021, 12:06
by TD-er
Maybe you could monitor a GPIO pin state and act on it via rules?
In the latest code you can use the %uptime_ms% to store in a variable and when the button is released you can see how long it took.
Problem is that rules are not processed in real time, so you should expect some drift.

Maybe it can be combined with the pulse counter, to inspect the pulse duration from within the rules?

Re: Reset input-switch on MOES MS-104B

Posted: 04 May 2021, 11:39
by Micha_he
For now, I created a block-timer for 2-3s, after the first (or single) pulse. During this period, another pulse is ignored.
If the block-timer is expired, the next pulse toggle the state again.

If someone holds the button longer than 2-3s, the relay will switch off immediately when released. But this is ok for now. I've no better solution.