diff --git a/tasmota/tasmota_xdrv_driver/xdrv_71_magic_switch.ino b/tasmota/tasmota_xdrv_driver/xdrv_71_magic_switch.ino index a0c097b28..46bc1e062 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_71_magic_switch.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_71_magic_switch.ino @@ -105,6 +105,12 @@ void MagicSwitchLoop() } } +void MagicSwitchSetPower(void) { + // It can happen that on relay switch, disturbances on the mains is falsy see as a MagicSwitch pulse + // This restart the masking windows on every power change to avoid that effect + MagicSwitch->switch_state = MAGICSWITCH_MASKING_WINDOW_LEN; +} + /******************************************************************************************************** * Driver initialisation */ @@ -173,6 +179,9 @@ bool Xdrv71(uint32_t function) { //case FUNC_EVERY_250_MSECOND: MagicSwitchLoop(); break; + case FUNC_SET_POWER: + MagicSwitchSetPower(); + break; case FUNC_ADD_SWITCH: result = MagicSwitchAddSwitch(); break;