@@ -574,6 +574,7 @@ The class `NeoPoolCommands` below adds two new commands to Tasmota:
574
574
Command|Parameters
575
575
:---|:---
576
576
NPAux<x\> <a id =" NPAux " ></a >|` <state> ` <BR >Set auxiliary relay <x\> (x=` 1..4 ` , state = ` 0..2 ` ):<ul ><li >` 0 ` - switch off auxiliary relay</li ><li >` 1 ` - switch on auxiliary relay</li >` 2 ` - toggle auxiliary relay</li ></ul >
577
+ NPAntiFreeze<x\> <a id =" NPAntiFreeze " ></a >|` <state> ` <BR >Set Smart mode antifreeze (state = ` 0..2 ` ):<ul ><li >` 0 ` - switch Smart mode antifreeze off</li ><li >` 1 ` - switch Smart mode antifreeze on</li >` 2 ` - toggle Smart mode antifreeze</li ></ul >
577
578
NPTimer<x\> <a id =" NPTimer " ></a >|` 0 ` or ` OFF ` or ` <hh:mm hh:mm>( <period>) ` or ` <json> ` <BR >Set device timer for filtration, light and auxiliary relay (x=` 1..12 ` )<BR > <x\> :<ul ><li >` 1 ` - Filtration timer 1</li ><li >` 2 ` - Filtration timer 2</li ><li >` 3 ` - Filtration timer 3</li ><li >` 4 ` - Light timer</li ><li >` 5 ` - Aux1 timer 1</li ><li >` 6 ` - Aux1 timer 2</li ><li >` 7 ` - Aux2 timer 1</li ><li >` 8 ` - Aux2 timer 2</li ><li >` 9 ` - Aux3 timer 1</li ><li >` 10 ` - Aux3 timer 2</li ><li >` 11 ` - Aux4 timer 1</li ><li >` 12 ` - Aux4 timer 2</li ></ul ><BR ><ul ><li >` 0 ` or ` OFF ` - Switch timer off</li ><li >` hh:mm hh:mm ` - Start/End time pair<li >` period ` - optional period interval (default seconds), use postfix (e. g. "1d") for period unit:<BR >` s ` - seconds<BR >` m ` - minutes<BR >` h ` - hours<BR >` d ` - days<BR >` w ` - weeks</li ><li >` json ` - valid JSON string containng start-/endtime and period e. g. ` #!json {"Start":"17:00","End":"22:15","Period":"1d"} ` </li ></ul >
578
579
NPVersion<a id =" NPVersion " ></a >|Get the firmware info as array (firmware version and creation date)
579
580
@@ -587,13 +588,14 @@ Store the following code into a Tasmota file by using the WebGUI "Console" / "Ma
587
588
```berry
588
589
# File: neopoolcmd.be
589
590
#
590
- # Add commands NPAux, NPTimer and NPVersion
591
+ # Add commands NPAux, NPAntiFreeze, NPTimer and NPVersion
591
592
592
593
# Neopool definitions
593
594
594
595
MBF_POWER_MODULE_REGISTER = 0x000C
595
596
MBF_POWER_MODULE_DATA = 0x000D
596
597
MBF_RELAY_STATE = 0x010E
598
+ MBF_PAR_SMART_ANTI_FREEZE = 0x41A
597
599
598
600
# configuration of the system timers
599
601
MBF_PAR_TIMER_BLOCK_FILT_INT1 = 0x0434
@@ -681,11 +683,6 @@ Store the following code into a Tasmota file by using the WebGUI "Console" / "Ma
681
683
MBF_PAR_TIMER_BLOCK_AUX4_INT1
682
684
]
683
685
684
-
685
-
686
-
687
-
688
-
689
686
import string
690
687
import json
691
688
@@ -771,7 +768,7 @@ Store the following code into a Tasmota file by using the WebGUI "Console" / "Ma
771
768
end
772
769
773
770
# NPAux<x> OFF|0|ON|1|TOGGLE|2 (<x> = 1..4)
774
- def NPAux(cmd, idx, payload, payload_json, subcmd )
771
+ def NPAux(cmd, idx, payload)
775
772
var ctrl, parm
776
773
777
774
if idx < 1 || idx > 4
@@ -786,10 +783,11 @@ Store the following code into a Tasmota file by using the WebGUI "Console" / "Ma
786
783
ctrl = MBV_PAR_CTIMER_ALWAYS_ON
787
784
elif 2 == parm
788
785
try
789
- ctrl = ( self.Read(cmd, "NPRead", MBF_RELAY_STATE) >> (idx+2)) & 1 ? MBV_PAR_CTIMER_ALWAYS_OFF : MBV_PAR_CTIMER_ALWAYS_ON
786
+ ctrl = self.Read(cmd, "NPRead", MBF_RELAY_STATE)
790
787
if nil == ctrl
791
788
return
792
789
end
790
+ ctrl = (ctrl >> (idx+2)) & 1 ? MBV_PAR_CTIMER_ALWAYS_OFF : MBV_PAR_CTIMER_ALWAYS_ON
793
791
except ..
794
792
return
795
793
end
@@ -801,19 +799,59 @@ Store the following code into a Tasmota file by using the WebGUI "Console" / "Ma
801
799
tasmota.cmd("NPExec")
802
800
else
803
801
try
804
- ctrl = ( self.Read("NPRead", MBF_RELAY_STATE) >> (idx+2)) & 1
802
+ ctrl = self.Read(cmd, "NPRead", MBF_RELAY_STATE)
805
803
if nil == ctrl
806
804
return
807
805
end
806
+ ctrl = (ctrl >> (idx+2)) & 1
808
807
except ..
809
808
return
810
809
end
811
810
end
812
- if subcmd != nil
813
- tasmota.resp_cmnd(string.format('{"%s":"%s"}', subcmd, ctrl == (parm != nil ? 4 : 0) ? self.TEXT_OFF : self.TEXT_ON))
811
+ tasmota.resp_cmnd(string.format('{"%s%d":"%s"}', cmd, idx, ctrl == (parm != nil ? 4 : 0) ? self.TEXT_OFF : self.TEXT_ON))
812
+ end
813
+
814
+ # NPAntiFreeze OFF|0|ON|1|TOGGLE|2
815
+ def NPAntiFreeze(cmd, idx, payload)
816
+ var ctrl, parm
817
+ parm = self.ParmSwitch(payload, self.TEXT_TOGGLE)
818
+ if parm != nil
819
+ if 0 == parm
820
+ ctrl = 0
821
+ elif 1 == parm
822
+ ctrl = 1
823
+ elif 2 == parm
824
+ try
825
+ ctrl = self.Read(cmd, "NPRead", MBF_PAR_SMART_ANTI_FREEZE)
826
+ if nil == ctrl
827
+ return
828
+ end
829
+ if 1 == ctrl
830
+ ctrl = 0
831
+ else
832
+ ctrl = 1
833
+ end
834
+ except ..
835
+ return
836
+ end
837
+ else
838
+ tasmota.resp_cmnd_error()
839
+ return
840
+ end
841
+ tasmota.cmd(string.format("NPWrite 0x%04X,%d", MBF_PAR_SMART_ANTI_FREEZE, ctrl))
842
+ tasmota.cmd("NPExec")
814
843
else
815
- tasmota.resp_cmnd(string.format('{"%s%d":"%s"}', cmd, idx, ctrl == (parm != nil ? 4 : 0) ? self.TEXT_OFF : self.TEXT_ON))
844
+ try
845
+ ctrl = self.Read(cmd, "NPRead", MBF_PAR_SMART_ANTI_FREEZE)
846
+ if nil == ctrl
847
+ return
848
+ end
849
+ except ..
850
+ tasmota.resp_cmnd_error()
851
+ return
852
+ end
816
853
end
854
+ tasmota.resp_cmnd(string.format('{"%s":"%s"}', cmd, ctrl ? self.TEXT_ON : self.TEXT_OFF))
817
855
end
818
856
819
857
# NPTimer<x> 0|OFF|<hh:mm hh:mm>( <period>)|<json> (<x> = 1..12)
@@ -856,7 +894,7 @@ Store the following code into a Tasmota file by using the WebGUI "Console" / "Ma
856
894
)
857
895
end
858
896
859
- def NPTimer(cmd, idx, payload, raw )
897
+ def NPTimer(cmd, idx, payload)
860
898
var parm
861
899
862
900
if idx < 1 || idx > 12
@@ -965,18 +1003,20 @@ Store the following code into a Tasmota file by using the WebGUI "Console" / "Ma
965
1003
966
1004
def init()
967
1005
# get tasmota settings
968
- self.TEXT_OFF = tasmota.cmd(" StateText1")[ 'StateText1']
969
- self.TEXT_ON = tasmota.cmd(" StateText2")[ 'StateText2']
970
- self.TEXT_TOGGLE = tasmota.cmd(" StateText3")[ 'StateText3']
1006
+ self.TEXT_OFF = tasmota.cmd(' StateText1').find( 'StateText1', 'OFF')
1007
+ self.TEXT_ON = tasmota.cmd(' StateText2').find( 'StateText2', 'ON')
1008
+ self.TEXT_TOGGLE = tasmota.cmd(' StateText3').find( 'StateText3', 'TOGGLE')
971
1009
# add commands
972
1010
tasmota.add_cmd('NPAux', / cmd, idx, payload -> self.NPAux(cmd, idx, payload))
973
- tasmota.add_cmd('NPTimer', / cmd, idx, payload, raw -> self.NPTimer(cmd, idx, payload, raw))
1011
+ tasmota.add_cmd('NPAntiFreeze', / cmd, idx, payload -> self.NPAntiFreeze(cmd, idx, payload))
1012
+ tasmota.add_cmd('NPTimer', / cmd, idx, payload -> self.NPTimer(cmd, idx, payload))
974
1013
tasmota.add_cmd('NPVersion', / cmd -> self.NPVersion(cmd))
975
1014
end
976
1015
977
1016
def deinit()
978
1017
# remove commands
979
1018
tasmota.remove_cmd('NPAux')
1019
+ tasmota.remove_cmd('NPAntiFreeze')
980
1020
tasmota.remove_cmd('NPTimer')
981
1021
tasmota.remove_cmd('NPVersion')
982
1022
end
0 commit comments