Comfort  Automation/ Security System Forums Home
Home Search search Menu menu Not logged in - Login | Register

Response on PIR ON not working as desired
 Moderated by: slychiu
 New Topic   Reply   Printer Friendly 
 Rate Topic 
AuthorPost
 Posted: Thursday Nov 27th, 2014 02:15 pm
   PM  Quote  Reply 
1st Post
nbexiga
Member
 

Joined: Sunday Oct 17th, 2010
Location: Portugal
Posts: 59
Status: 
Offline

  back to top

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

Attachment: FredDomotica.txt (Downloaded 5 times)



 Posted: Thursday Nov 27th, 2014 05:52 pm
   PM  Quote  Reply 
2nd Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5498
Status: 
Offline

  back to top

The problem is in the line

    If SecurityMode = SecurityOff And Hours > 19 And Hours < 7 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 Hours > 19 OR Hours < 7 Then

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



 Posted: Thursday Nov 27th, 2014 06:33 pm
   PM  Quote  Reply 
3rd Post
nbexiga
Member
 

Joined: Sunday Oct 17th, 2010
Location: Portugal
Posts: 59
Status: 
Offline

  back to top

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... :(Thanks

Attachment: Error.JPG (Downloaded 47 times)



 Posted: Thursday Nov 27th, 2014 07:35 pm
   PM  Quote  Reply 
4th Post
nbexiga
Member
 

Joined: Sunday Oct 17th, 2010
Location: Portugal
Posts: 59
Status: 
Offline

  back to top

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

Attachment: FredDomotica.txt (Downloaded 5 times)

Last edited on Thursday Nov 27th, 2014 07:37 pm by nbexiga



 Posted: Friday Nov 28th, 2014 05:21 am
   PM  Quote  Reply 
5th Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5498
Status: 
Offline

  back to top

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



 Posted: Saturday Nov 29th, 2014 03:40 pm
   PM  Quote  Reply 
6th Post
nbexiga
Member
 

Joined: Sunday Oct 17th, 2010
Location: Portugal
Posts: 59
Status: 
Offline

  back to top

many thanks ;) working! ;)



 Current time is 07:38 pm
Top




UltraBB 1.172 Copyright © 2007-2014 Data 1 Systems