Comfort Automation/ Security System Forums

Full Version: Response on PIR ON not working as desired
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
HI
I want to know why this piece of code that i added in the response does not work. what can be fixed. The objective it when the PIR Sensor is set to ON and the SecurityMode=SecurityOff but only from 19h00 to 07h (7pm to 7am) (this code is in the ON Response) , it do the response IL_HALL_ON 
But only the part that is working is the ony below , i want that part to work but i want that the other part work too.
Do C_Hall_60If SecurityMode = AwayMode Or SecurityMode = NightMode Then    Do IL_Hall_On

Please see atached the piece of code that is in the response that i need to put working.
Can anybody help me?Thanks

The problem is in the line

    If SecurityMode = SecurityOff And [color=\"#ff0000\"]Hours > 19 And Hours < 7[/color] Then


Think of the Hours as a number between 0 to 23

It is logically impossible to have Hours > 19 AND Hours < 7 at the same time


The correct form of the condition should be

    If SecurityMode = SecurityOff And [color=\"#ff0000\"]Hours > 19 OR Hours < 7[/color] Then

     That means Hours 19 to 23 OR 0 to 7 will meet the condition

Hi slychiu
yes it makes sense that logically of the hours, i tried to change to the corrected form that you input but when i hit apply it appear the message in the atached file... SadThanks
HI
it\'s already working Wink thanks for your help.
i changed to the code that is on the file
You can shorten the Response like this

If SecurityMode = AwayMode Or SecurityMode = NightMode Then
    Do IL_Hall_On
Else
    If SecurityMode = SecurityOff Then
        If Hours >= 18 Or Hours < 7 Then
            Do IL_Hall_On
        End If
    End If
End If
many thanks Wink working! Wink