I have a program that turns the modem on and off at certain times, as well as when there is a rain event within the night schedule, it should turn on, but apparently this does not happen, can someone guide me on how to solve this problem? I can't get it to turn on within the rain event. I have to turn off the modem at night to save energy.
Thank you very much for your help
My program
ModSecsWin=Public.TimeStamp(1,1) MOD 86400
'se enciende entre las 6am y las 21
If (ModSecsWin>=28800 AND ModSecsWin<=68400) Then
SW12State=true
End If
'si esta dentro de ese horario y hay lluvia se enciende si no se apaga dentro de ese horario
If (ModSecsWin>75601 AND ModSecsWin<86400 AND Rain_mm>0.1) Then
SW12State=true
ElseIf (ModSecsWin>68400 AND ModSecsWin<=86400) Then
SW12State=false
EndIf
'si esta dentro de ese horario y hay lluvia se enciende si no se apaga dentro de ese horario
If (ModSecsWin>=0 AND ModSecsWin<28800 AND Rain_mm>0.1 ) Then
SW12State=true
ElseIf (ModSecsWin>=0 AND ModSecsWin<28.800) Then
SW12State=false
EndIf
'apaga o enciende
SW12(SW12State)
NextScan
try using TimeIsBetween and a countdown timer after detecting a rain event.
Scan (1,Sec,0,0)
If TimeIsBetween (6,21,24,Hr) Then
SW12State=true
ElseIf Rain_mm > 0.1 Then
RainEvent = 300
Else
SW12State=false
End If
If RainEvent > 0 Then
SW12State = true
RainEvent = RainEvent - 1
EndIf
SW12(SW12State)
NextScan