arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.04k stars 4.78k forks source link

SwitchMode 6 TOGGLE CMD on the wrong edge #21294

Closed tomy42 closed 4 months ago

tomy42 commented 5 months ago

PROBLEM DESCRIPTION

A clear and concise description of what the problem is.

I use SwitchMode 6 to change the output status and, in conjunction with PulseTime, to realize an automatic switch-off. I set a longer PulseTime using the HOLD State state=3. I noticed that the TOGGLE command is not sent when the contact is closed but rather when the contact is opened. However, the hold status is triggered as described after the set time (SetOption32).

I checked the logic of the switch with SwitchMode 1, that is correct, the output is switched accordingly.

My Rule:

Rule1 ON Switch1#state=2 DO Backlog PulseTime1 340; Power1 TOGGLE ENDON ON Switch1#state=3 DO Backlog PulseTime1 3700; Power1 ON ENDON

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

- [X] If using rules, provide the output of this command: `Backlog Rule1; Rule2; Rule3`:
```lua
  Rules output here:
21:20:56.786 RSL: RESULT = {"Rule1":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":129,"Free":382,"Rules":"ON Switch1#state=2 DO  Backlog PulseTime1 340; Power1 TOGGLE ENDON ON Switch1#state=3 DO Backlog PulseTime1 3700; Power1 ON ENDON"}}
21:20:57.009 RSL: RESULT = {"Rule2":{"State":"OFF","Once":"OFF","StopOnError":"OFF","Length":0,"Free":511,"Rules":""}}
21:20:57.258 RSL: RESULT = {"Rule3":{"State":"OFF","Once":"OFF","StopOnError":"OFF","Length":0,"Free":511,"Rules":""}}
- [X] Set `weblog` to 4 and then, when you experience your issue, provide the output of the Console log:
```lua
  Console output here:
21:23:32.831 CMD: weblog 4
21:23:32.835 RSL: RESULT = {"WebLog":4}
21:23:33.980 CFG: Saved, Count 137, Bytes 4096
21:23:37.401 RUL: SWITCH1#STATE=2 performs "Backlog PulseTime1 340; Power1 TOGGLE"
21:23:37.402 SRC: Rule
21:23:37.404 CMD: Grp 0, Cmd 'BACKLOG', Idx 1, Len 29, Pld -99, Data 'PulseTime1 340; Power1 TOGGLE'
21:23:37.408 SRC: Backlog
21:23:37.410 CMD: Grp 0, Cmd 'PULSETIME', Idx 1, Len 3, Pld 340, Data '340'
21:23:37.413 RSL: RESULT = {"PulseTime1":{"Set":340,"Remaining":340}}
21:23:37.640 SRC: Backlog
21:23:37.642 CMD: Grp 0, Cmd 'POWER', Idx 1, Len 6, Pld 2, Data 'TOGGLE'
21:23:37.649 RSL: RESULT = {"POWER1":"ON"}
21:23:37.650 RSL: POWER1 = ON
21:23:37.770 CFG: Saved, Count 138, Bytes 4096
21:23:44.104 RUL: SWITCH1#STATE=3 performs "Backlog PulseTime1 3700; Power1 ON"
21:23:44.105 SRC: Rule
21:23:44.107 CMD: Grp 0, Cmd 'BACKLOG', Idx 1, Len 26, Pld -99, Data 'PulseTime1 3700; Power1 ON'
21:23:44.109 SRC: Backlog
21:23:44.111 CMD: Grp 0, Cmd 'PULSETIME', Idx 1, Len 4, Pld 3700, Data '3700'
21:23:44.113 RSL: RESULT = {"PulseTime1":{"Set":3700,"Remaining":3700}}
21:23:44.345 SRC: Backlog
21:23:44.347 CMD: Grp 0, Cmd 'POWER', Idx 1, Len 2, Pld 1, Data 'ON'
21:23:44.353 RSL: RESULT = {"POWER1":"ON"}
21:23:44.354 RSL: POWER1 = ON
21:23:44.871 CFG: Saved, Count 139, Bytes 4096
21:23:51.955 WIF: Checking connection...

TO REPRODUCE

Steps to reproduce the behavior:

The behavior is like this every time you press the contact. I used a normally closed contact and SwitchMode 5 so that the TOGGEL CMD is sent first when the button is released, but the HOLD status is sent when the button is pressed for the set time.

I was also able to determine the problem with a Sonoff MINIR4. However, it has an inverted input so I use switch mode 5. Here too, the TOGGEL CMD is only sent when the switch is released; the OLD state works correctly.

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen.

I expected the TOGGLE CMD to be sent when pressing the button, as described in the documentation. Not at first when you release the button

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

ADDITIONAL CONTEXT

Add any other context about the problem here.

(Please, remember to close the issue when the problem has been addressed)

tomy42 commented 5 months ago

GPIO Pin Status:

Externel Switch not pressed, open -> GPIO LOW Externel Switch pressed, close -> GPIO High

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 4 months ago

This issue was automatically closed because of being stale. Feel free to open a new one if you still experience this problem.