Hi, the sonoff basic r4 got an esp32 upgrade as well as a new ‘magic switch mode’
That one intrigued me because it allows me to install it to a light fixture and to an existing 2 way wiring without adding new cables.
However, this mode doesn’t seem to work in tasmota/esphome. The relay is not toggled when pressing the switch which leads me to believe there’s additional configuration required.
After some discussion in the discord, it could be using zero crossing detection based on pulse detected at GPIO5.
//Logs from tasmota console with `TelePeriod 10` , and `SetOption79 1` to reset the counter each cycle with GPIO5 assigned as counter.
17:57:33.952 MQT: tele/tasmota_E34494/STATE = {"Time":"2023-11-20T17:57:33","Uptime":"0T00:07:11","UptimeSec":431,"Heap":185,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Berry":{"HeapUsed":4,"Objects":45},"POWER":"ON","Wifi":{"AP":2,"SSId":"Suliana","BSSId":"9C:A2:F4:37:D5:E1","Channel":9,"Mode":"11n","RSSI":100,"Signal":-41,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:57:33.991 MQT: tele/tasmota_E34494/SENSOR = {"Time":"2023-11-20T17:57:33","Switch1":"OFF","COUNTER":{"C1":1030}}
17:57:43.933 MQT: tele/tasmota_E34494/STATE = {"Time":"2023-11-20T17:57:43","Uptime":"0T00:07:21","UptimeSec":441,"Heap":185,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Berry":{"HeapUsed":4,"Objects":45},"POWER":"ON","Wifi":{"AP":2,"SSId":"Suliana","BSSId":"9C:A2:F4:37:D5:E1","Channel":9,"Mode":"11n","RSSI":100,"Signal":-41,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:57:43.973 MQT: tele/tasmota_E34494/SENSOR = {"Time":"2023-11-20T17:57:43","Switch1":"OFF","COUNTER":{"C1":1029}}
17:57:53.917 MQT: tele/tasmota_E34494/STATE = {"Time":"2023-11-20T17:57:53","Uptime":"0T00:07:31","UptimeSec":451,"Heap":185,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":20,"MqttCount":1,"Berry":{"HeapUsed":4,"Objects":45},"POWER":"ON","Wifi":{"AP":2,"SSId":"Suliana","BSSId":"9C:A2:F4:37:D5:E1","Channel":9,"Mode":"11n","RSSI":100,"Signal":-36,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:57:53.955 MQT: tele/tasmota_E34494/SENSOR = {"Time":"2023-11-20T17:57:53","Switch1":"OFF","COUNTER":{"C1":1032}}
17:58:03.954 MQT: tele/tasmota_E34494/STATE = {"Time":"2023-11-20T17:58:03","Uptime":"0T00:07:41","UptimeSec":461,"Heap":185,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Berry":{"HeapUsed":4,"Objects":45},"POWER":"ON","Wifi":{"AP":2,"SSId":"Suliana","BSSId":"9C:A2:F4:37:D5:E1","Channel":9,"Mode":"11n","RSSI":100,"Signal":-43,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:58:03.993 MQT: tele/tasmota_E34494/SENSOR = {"Time":"2023-11-20T17:58:03","Switch1":"OFF","COUNTER":{"C1":1023}}
17:58:13.941 MQT: tele/tasmota_E34494/STATE = {"Time":"2023-11-20T17:58:13","Uptime":"0T00:07:51","UptimeSec":471,"Heap":185,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Berry":{"HeapUsed":4,"Objects":45},"POWER":"ON","Wifi":{"AP":2,"SSId":"Suliana","BSSId":"9C:A2:F4:37:D5:E1","Channel":9,"Mode":"11n","RSSI":100,"Signal":-42,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:58:13.981 MQT: tele/tasmota_E34494/SENSOR = {"Time":"2023-11-20T17:58:13","Switch1":"OFF","COUNTER":{"C1":1038}}
17:58:23.922 MQT: tele/tasmota_E34494/STATE = {"Time":"2023-11-20T17:58:23","Uptime":"0T00:08:01","UptimeSec":481,"Heap":185,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":20,"MqttCount":1,"Berry":{"HeapUsed":4,"Objects":45},"POWER":"ON","Wifi":{"AP":2,"SSId":"Suliana","BSSId":"9C:A2:F4:37:D5:E1","Channel":9,"Mode":"11n","RSSI":100,"Signal":-41,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:58:23.960 MQT: tele/tasmota_E34494/SENSOR = {"Time":"2023-11-20T17:58:23","Switch1":"OFF","COUNTER":{"C1":1026}}
17:58:33.961 MQT: tele/tasmota_E34494/STATE = {"Time":"2023-11-20T17:58:33","Uptime":"0T00:08:11","UptimeSec":491,"Heap":185,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Berry":{"HeapUsed":4,"Objects":45},"POWER":"ON","Wifi":{"AP":2,"SSId":"Suliana","BSSId":"9C:A2:F4:37:D5:E1","Channel":9,"Mode":"11n","RSSI":100,"Signal":-42,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:58:34.001 MQT: tele/tasmota_E34494/SENSOR = {"Time":"2023-11-20T17:58:33","Switch1":"OFF","COUNTER":{"C1":1043}}
I tried assigning zero crossing pulse on pin 5 but that doesn’t work
Tried switchdebounce 99
option but that just toggles the relay every second on its own.
17:29:21.632 MQT: stat/tasmota_E34494/RESULT = {"POWER":"OFF"}
17:29:21.637 MQT: stat/tasmota_E34494/POWER = OFF
17:29:22.260 MQT: stat/tasmota_E34494/RESULT = {"POWER":"ON"}
17:29:22.265 MQT: stat/tasmota_E34494/POWER = ON
17:29:22.990 MQT: stat/tasmota_E34494/RESULT = {"POWER":"OFF"}
17:29:22.996 MQT: stat/tasmota_E34494/POWER = OFF
17:29:24.669 MQT: stat/tasmota_E34494/RESULT = {"POWER":"ON"}
17:29:24.674 MQT: stat/tasmota_E34494/POWER = ON
17:29:25.890 MQT: stat/tasmota_E34494/RESULT = {"POWER":"OFF"}
17:29:25.893 MQT: stat/tasmota_E34494/POWER = OFF
17:29:26.497 MQT: stat/tasmota_E34494/RESULT = {"POWER":"ON"}
17:29:26.503 MQT: stat/tasmota_E34494/POWER = ON
17:29:27.747 MQT: stat/tasmota_E34494/RESULT = {"POWER":"OFF"}
17:29:27.752 MQT: stat/tasmota_E34494/POWER = OFF
17:29:28.930 MQT: stat/tasmota_E34494/RESULT = {"POWER":"ON"}
17:29:28.933 MQT: stat/tasmota_E34494/POWER = ON
Does anyone have any idea how this mode works and if it can be enabled on tasmota?