Comfort Automation/ Security System Forums
Response on PIR ON not working as desired - Printable Version

+- Comfort Automation/ Security System Forums (https://www.comfortforums.com)
+-- Forum: Support (https://www.comfortforums.com/forum-2.html)
+--- Forum: Problems & Troubleshooting (https://www.comfortforums.com/forum-36.html)
+---- Forum: Responses and Actions (https://www.comfortforums.com/forum-74.html)
+---- Thread: Response on PIR ON not working as desired (/thread-4063.html)



- nbexiga - 11-27-2014

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




- slychiu - 11-27-2014

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




- nbexiga - 11-27-2014

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


- nbexiga - 11-27-2014

HI
it\'s already working Wink thanks for your help.
i changed to the code that is on the file


- slychiu - 11-28-2014

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



- nbexiga - 11-29-2014

many thanks Wink working! Wink