From 1e2f2385b89dd6fcd5fc193bc4aab1939cae3e09 Mon Sep 17 00:00:00 2001 From: Norbert Richter Date: Sat, 9 Apr 2022 18:33:45 +0200 Subject: [PATCH] Add filtration toggle --- tasmota/tasmota_xsns_sensor/xsns_83_neopool.ino | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota_xsns_sensor/xsns_83_neopool.ino b/tasmota/tasmota_xsns_sensor/xsns_83_neopool.ino index e2171bcfb..09e71b77c 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_83_neopool.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_83_neopool.ino @@ -732,8 +732,11 @@ const char HTTP_SNS_NEOPOOL_STATUS_ACTIVE[] PROGMEM = "filter:invert(1)"; * Commands * * NPFiltration { {speed}} - * get/set manual filtration (state = 0|1, speed = 1..3) + * get/set manual filtration (state = 0..2, speed = 1..3) * get filtration state if is omitted, otherwise set new state + * 0 - switch filtration pump off + * 1 - switch filtration pump on + * 2 - toggle filtration pump * for non-standard filtration types additional speed control is possible * * NPFiltrationMode {} @@ -2129,12 +2132,19 @@ void CmndNeopoolFiltration(void) return; } } - if (value[0] >= 0 && value[0] <= 1) { + if (value[0] >= 0 && value[0] <= 2) { // Set MBF_PAR_FILT_MODE if (NEOPOOL_MODBUS_OK != NeoPoolWriteRegisterWord(MBF_PAR_FILT_MODE, MBV_PAR_FILT_MANUAL)) { NeopoolResponseError(); return; } + if (2 == value[0]) { + if (NEOPOOL_MODBUS_OK != NeoPoolReadRegister(MBF_PAR_FILTRATION_STATE, &data, 1)) { + NeopoolResponseError(); + return; + } + value[0] = data ? 0 : 1; + } // Set filtration mode to manual if (NEOPOOL_MODBUS_OK != NeoPoolWriteRegisterWord(MBF_PAR_FILT_MANUAL_STATE, value[0])) { NeopoolResponseError();