Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwitchMode 6 TOGGLE CMD on the wrong edge #21294

Open
13 of 14 tasks
tomy42 opened this issue Apr 27, 2024 · 1 comment
Open
13 of 14 tasks

SwitchMode 6 TOGGLE CMD on the wrong edge #21294

tomy42 opened this issue Apr 27, 2024 · 1 comment

Comments

@tomy42
Copy link

tomy42 commented Apr 27, 2024

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!

  • Read the Contributing Guide and Policy and the Code of Conduct
  • Searched the problem in issues
  • Searched the problem in discussions
  • Searched the problem in the docs
  • Searched the problem in the chat
  • Device used (e.g., Sonoff Basic): Shelly Pro2
  • Tasmota binary firmware version number used: 13.4.0
    • Pre-compiled
    • Self-compiled
  • Flashing tools used: esptool & WebUpdate
  • Provide the output of command: Backlog Template; Module; GPIO 255:
  Configuration output here:
21:14:25.279 RUL: SWITCH1#STATE=3 performs "PulseTime1 3700"
21:14:25.283 RSL: RESULT = {"PulseTime1":{"Set":3700,"Remaining":3700}}
21:14:56.335 RSL: STATE = {"Time":"2024-04-27T21:14:56","Uptime":"0T01:20:11","UptimeSec":4811,"Heap":132,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"Berry":{"HeapUsed":4,"Objects":42},"POWER1":"OFF","POWER2":"OFF","Wifi":{"AP":1,"SSId":"PegasusNET_2G4","BSSId":"B4:FB:E4:CA:8A:2E","Channel":1,"Mode":"11n","RSSI":74,"Signal":-63,"LinkCount":1,"Downtime":"0T00:00:04"}}
21:14:56.351 RSL: SENSOR = {"Time":"2024-04-27T21:14:56","Switch1":"ON","Switch2":"OFF","ANALOG":{"Temperature1":29.3,"Temperature2":32.1},"TempUnit":"C"}
21:15:20.677 CMD: rule1 ''
21:15:20.681 RUL: Stored uncompressed, would compress from 2 to 3 (-0%)
21:15:20.684 RSL: RESULT = {"Rule1":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":2,"Free":509,"Rules":"''"}}
21:15:24.858 CMD: Rule1 ON Switch1#state=2 DO  Backlog PulseTime1 340; Power1 TOGGLE ENDON ON Switch1#state=3 DO Backlog PulseTime1 3700; Power1 ON ENDON
21:15:24.862 RUL: Stored uncompressed, would compress from 129 to 80 (-38%)
21:15:24.865 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:15:27.753 RUL: SWITCH1#STATE=2 performs "Backlog PulseTime1 340; Power1 TOGGLE"
21:15:27.761 RSL: RESULT = {"PulseTime1":{"Set":340,"Remaining":340}}
21:15:28.001 RSL: RESULT = {"POWER1":"ON"}
21:15:28.003 RSL: POWER1 = ON
21:15:28.980 RUL: SWITCH1#STATE=2 performs "Backlog PulseTime1 340; Power1 TOGGLE"
21:15:28.987 RSL: RESULT = {"PulseTime1":{"Set":340,"Remaining":340}}
21:15:29.229 RSL: RESULT = {"POWER1":"OFF"}
21:15:29.231 RSL: POWER1 = OFF
21:15:33.887 RUL: SWITCH1#STATE=3 performs "Backlog PulseTime1 3700; Power1 ON"
21:15:33.891 RSL: RESULT = {"PulseTime1":{"Set":3700,"Remaining":3700}}
21:15:34.130 RSL: RESULT = {"POWER1":"ON"}
21:15:34.134 RSL: POWER1 = ON
21:15:37.931 RUL: SWITCH1#STATE=2 performs "Backlog PulseTime1 340; Power1 TOGGLE"
21:15:37.939 RSL: RESULT = {"PulseTime1":{"Set":340,"Remaining":340}}
21:15:38.176 RSL: RESULT = {"POWER1":"OFF"}
21:15:38.178 RSL: POWER1 = OFF
21:15:41.088 RUL: SWITCH1#STATE=2 performs "Backlog PulseTime1 340; Power1 TOGGLE"
21:15:41.097 RSL: RESULT = {"PulseTime1":{"Set":340,"Remaining":340}}
21:15:41.333 RSL: RESULT = {"POWER1":"ON"}
21:15:41.335 RSL: POWER1 = ON
21:19:29.992 CMD: Backlog Template; Module; GPIO 255
21:19:30.025 RSL: RESULT = {"NAME":"Shelly Pro 2","GPIO":[0,1,0,1,768,0,0,0,672,704,736,0,0,0,5600,6214,0,0,0,5568,0,0,0,0,0,0,0,0,0,0,0,32,4736,4737,160,161],"FLAG":0,"BASE":1}
21:19:30.246 RSL: RESULT = {"Module":{"0":"Shelly Pro 2"}}
21:19:30.507 RSL: RESULT = {"GPIO0":{"0":"None"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"768":"SPI CS1"},"GPIO5":{"0":"None"},"GPIO6":{"0":"None"},"GPIO7":{"0":"None"},"GPIO8":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO11":{"0":"None"},"GPIO12":{"672":"SPI MISO1"},"GPIO13":{"704":"SPI MOSI1"},"GPIO14":{"736":"SPI CLK1"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"},"GPIO17":{"0":"None"},"GPIO18":{"5600":"ETH MDIO"},"GPIO19":{"6214":"Option A7"},"GPIO20":{"0":"None"},"GPIO21":{"0":"None"},"GPIO22":{"0":"None"},"GPIO23":{"5568":"ETH MDC"},"GPIO24":{"0":"None"},"GPIO25":{"0":"None"},"GPIO26":{"0":"None"},"GPIO27":{"0":"None"},"GPIO32":{"0":"None"},"GPIO33":{"0":"None"},"GPIO34":{"0":"None"},"GPIO35":{"32":"Button1"},"GPIO36":{"4736":"ADC Temp1"},"GPIO37":{"4737":"ADC Temp2"},"GPIO38":{"160":"Switch1"},"GPIO39":{"161":"Switch2"}}
21:19:41.420 RSL: RESULT = {"POWER1":"OFF"}
21:19:41.421 RSL: POWER1 = OFF
21:19:56.327 RSL: STATE = {"Time":"2024-04-27T21:19:56","Uptime":"0T01:25:11","UptimeSec":5111,"Heap":134,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"Berry":{"HeapUsed":4,"Objects":42},"POWER1":"OFF","POWER2":"OFF","Wifi":{"AP":1,"SSId":"PegasusNET_2G4","BSSId":"B4:FB:E4:CA:8A:2E","Channel":1,"Mode":"11n","RSSI":70,"Signal":-65,"LinkCount":1,"Downtime":"0T00:00:04"}}
21:19:56.339 RSL: SENSOR = {"Time":"2024-04-27T21:19:56","Switch1":"ON","Switch2":"OFF","ANALOG":{"Temperature1":32.3,"Temperature2":33.3},"TempUnit":"C"}
21:20:00.531 CMD: Backlog Template; Module; GPIO 255
21:20:00.566 RSL: RESULT = {"NAME":"Shelly Pro 2","GPIO":[0,1,0,1,768,0,0,0,672,704,736,0,0,0,5600,6214,0,0,0,5568,0,0,0,0,0,0,0,0,0,0,0,32,4736,4737,160,161],"FLAG":0,"BASE":1}
21:20:00.783 RSL: RESULT = {"Module":{"0":"Shelly Pro 2"}}
21:20:01.043 RSL: RESULT = {"GPIO0":{"0":"None"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"768":"SPI CS1"},"GPIO5":{"0":"None"},"GPIO6":{"0":"None"},"GPIO7":{"0":"None"},"GPIO8":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO11":{"0":"None"},"GPIO12":{"672":"SPI MISO1"},"GPIO13":{"704":"SPI MOSI1"},"GPIO14":{"736":"SPI CLK1"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"},"GPIO17":{"0":"None"},"GPIO18":{"5600":"ETH MDIO"},"GPIO19":{"6214":"Option A7"},"GPIO20":{"0":"None"},"GPIO21":{"0":"None"},"GPIO22":{"0":"None"},"GPIO23":{"5568":"ETH MDC"},"GPIO24":{"0":"None"},"GPIO25":{"0":"None"},"GPIO26":{"0":"None"},"GPIO27":{"0":"None"},"GPIO32":{"0":"None"},"GPIO33":{"0":"None"},"GPIO34":{"0":"None"},"GPIO35":{"32":"Button1"},"GPIO36":{"4736":"ADC Temp1"},"GPIO37":{"4737":"ADC Temp2"},"GPIO38":{"160":"Switch1"},"GPIO39":{"161":"Switch2"}}
  • If using rules, provide the output of this command: Backlog Rule1; Rule2; Rule3:
  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":""}}
  • Provide the output of this command: Status 0:
  STATUS 0 output here:
21:21:40.495 CMD: Status 0
21:21:40.500 RSL: STATUS = {"Status":{"Module":0,"DeviceName":"Tasmota","FriendlyName":["Tasmota",""],"Topic":"tasmota_8C3490","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0,"InfoRetain":0,"StateRetain":0,"StatusRetain":0}}
21:21:40.511 RSL: STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota32/release/tasmota32.bin","RestartReason":"Software reset CPU","Uptime":"0T01:26:55","StartupUTC":"2024-04-27T18:54:45","Sleep":50,"CfgHolder":4617,"BootCount":4,"BCResetTime":"2024-04-27T19:47:27","SaveCount":136}}
21:21:40.521 RSL: STATUS2 = {"StatusFWR":{"Version":"13.4.0(tasmota32)","BuildDateTime":"2024-02-14T16:17:40","Core":"2_0_14","SDK":"4.4.6.240105","CpuFrequency":160,"Hardware":"ESP32-D0WDQ6 v1.0","CR":"441/699"}}
21:21:40.530 RSL: STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["PegasusNET_2G4",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["00008009","2805C80001000600003C5A0A192800000000","00000080","00006000","00004000","00000000"]}}
21:21:40.553 RSL: STATUS4 = {"StatusMEM":{"ProgramSize":1907,"Free":972,"Heap":130,"StackLowMark":3,"PsrMax":0,"PsrFree":0,"ProgramFlashSize":8192,"FlashSize":8192,"FlashChipId":"17701C","FlashFrequency":40,"FlashMode":"DIO","Features":["0809","9F9AD7DF","0015A001","B7F7BFCF","05DA9BC4","E0360DC7","480840D2","20200000","D4BC482D","810A80B1","00000004"],"Drivers":"1,2,!3,!4,!5,7,!8,9,10,11,12,!14,!16,!17,!20,!21,!24,26,!27,29,!34,!35,38,50,52,!59,!60,62,!63,!66,!67,!68,82,!86,!87,88,!121","Sensors":"1,2,3,5,6,7,8,9,10,11,12,13,14,15,17,18,19,20,21,22,26,31,34,37,39,40,42,43,45,51,52,55,56,58,59,64,66,67,74,85,92,95,98,103,105,109,127","I2CDriver":"7,8,9,10,11,12,13,14,15,17,18,20,24,29,31,36,41,42,44,46,48,58,62,65,69,76,77,82"}}
21:21:40.572 RSL: STATUS5 = {"StatusNET":{"Hostname":"tasmota-8C3490-5264","IPAddress":"192.168.128.41","Gateway":"192.168.128.254","Subnetmask":"255.255.255.0","DNSServer1":"192.168.128.254","DNSServer2":"2a00:6020:502c:4100:4a5d:35ff:feaa:e202","Mac":"EC:62:60:8C:34:90","IP6Global":"2a00:6020:502c:4100:ee62:60ff:fe8c:3490","IP6Local":"fe80::ee62:60ff:fe8c:3490%st2","Ethernet":{"Hostname":"tasmota-8C3490-5264-eth","IPAddress":"0.0.0.0","Gateway":"0.0.0.0","Subnetmask":"0.0.0.0","DNSServer1":"192.168.128.254","DNSServer2":"2a00:6020:502c:4100:4a5d:35ff:feaa:e202","Mac":"EC:62:60:8C:34:93","IP6Global":"","IP6Local":""},"Webserver":2,"HTTP_API":1,"WifiConfig":4,"WifiPower":16.0}}
21:21:40.586 RSL: STATUS6 = {"StatusMQT":{"MqttHost":"","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_8C3490","MqttUser":"DVES_USER","MqttCount":0,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30,"SOCKET_TIMEOUT":4}}
21:21:40.595 RSL: STATUS7 = {"StatusTIM":{"UTC":"2024-04-27T20:21:40Z","Local":"2024-04-27T21:21:40","StartDST":"2024-03-31T02:00:00","EndDST":"2024-10-27T03:00:00","Timezone":"+01:00","Sunrise":"05:35","Sunset":"19:59"}}
21:21:40.607 RSL: STATUS10 = {"StatusSNS":{"Time":"2024-04-27T21:21:40","Switch1":"ON","Switch2":"OFF","ANALOG":{"Temperature1":32.1,"Temperature2":33.3},"TempUnit":"C"}}
21:21:40.618 RSL: STATUS11 = {"StatusSTS":{"Time":"2024-04-27T21:21:40","Uptime":"0T01:26:55","UptimeSec":5215,"Heap":132,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":20,"MqttCount":0,"Berry":{"HeapUsed":4,"Objects":42},"POWER1":"OFF","POWER2":"OFF","Wifi":{"AP":1,"SSId":"PegasusNET_2G4","BSSId":"B4:FB:E4:CA:8A:2E","Channel":1,"Mode":"11n","RSSI":72,"Signal":-64,"LinkCount":1,"Downtime":"0T00:00:04"}}}
  • Set weblog to 4 and then, when you experience your issue, provide the output of the Console log:
  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
Copy link
Author

tomy42 commented Apr 27, 2024

GPIO Pin Status:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant