From 155dea98cddaf494ccaefb3bb4200af94cac2c27 Mon Sep 17 00:00:00 2001 From: Barbudor Date: Mon, 25 Nov 2024 10:56:35 +0100 Subject: [PATCH] Issue#22535 applying masking window to any power change (#22539) * apply masking to any power change * stupid typo * rephrase --- tasmota/tasmota_xdrv_driver/xdrv_71_magic_switch.ino | 9 +++++++++ 1 file changed, 9 insertions(+) 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;