Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Response on PIR ON not working as desired
#1
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



Attached Files
.txt   FredDomotica.txt (Size: 352 bytes / Downloads: 5)
Reply
#2
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

Reply
#3
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


Attached Files Thumbnail(s)
   
Reply
#4
HI
it\'s already working Wink thanks for your help.
i changed to the code that is on the file


Attached Files
.txt   FredDomotica.txt (Size: 401 bytes / Downloads: 5)
Reply
#5
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
Reply
#6
many thanks Wink working! Wink
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)