Jump to content

Program question


GaryK4

Recommended Posts

I install a ms and a toggle linc for our front door porch light. I plan to expand the scope of this program, but for now this is what I want to do.

  • If motion is detected text me and my wife.
  • If dark turn on the light.

I don't think this can be done with one program (no nested if statements), so I have (2) programs.

 

Problem:

I triggered the MS at 11:00AM and the light went on. I don't know why.

Under summary it shows the status as true. I think It should be false.

 

 

Main program ------------------------------

If
        Status  'Front Porch / MS (DD)' is On
 
Then
        Send Notification to 'Text Gary' content 'FrontDoor.Motion'
        Send Notification to 'Text Sandy' content 'FrontDoor.Motion'
        Run Program 'Front Door2' (Then Path)
        $FrontDoor.Triggered  = 1
 
Else
        Wait  10 seconds
        Set 'Front Porch / Front Porch Switch' Query
        Set 'Front Porch / Front Porch Switch' Fast Off
        $FrontDoor.Triggered  = 0
 
 
Sub Program ----------------------------
If
        From    Sunset  -  3 hours 
        To      Sunrise (next day)
 
Then
        Set 'Front Porch / Front Porch Switch' On
 
Else
        Set 'Front Porch / Front Porch Switch' Fast Off
 
 
Link to comment

 

I install a ms and a toggle linc for our front door porch light. I plan to expand the scope of this program, but for now this is what I want to do.

  • If motion is detected text me and my wife.
  • If dark turn on the light.

I don't think this can be done with one program (no nested if statements), so I have (2) programs.

 

Problem:

I triggered the MS at 11:00AM and the light went on. I don't know why.

Under summary it shows the status as true. I think It should be false.

 

 

Main program ------------------------------

If
        Status  'Front Porch / MS (DD)' is On
 
Then
        Send Notification to 'Text Gary' content 'FrontDoor.Motion'
        Send Notification to 'Text Sandy' content 'FrontDoor.Motion'
        Run Program 'Front Door2' (Then Path)
        $FrontDoor.Triggered  = 1
 
Else
        Wait  10 seconds
        Set 'Front Porch / Front Porch Switch' Query
        Set 'Front Porch / Front Porch Switch' Fast Off
        $FrontDoor.Triggered  = 0
 
 
Sub Program ----------------------------
If
        From    Sunset  -  3 hours 
        To      Sunrise (next day)
 
Then
        Set 'Front Porch / Front Porch Switch' On
 
Else
        Set 'Front Porch / Front Porch Switch' Fast Off
 

 

 

You are correct.  This will require 2 programs.

 

This:         Run Program 'Front Door2' (Then Path)  is the problem.  Should be If Path.  You are bypassing the time test by calling the Then directly.

 

A few suggestions:

 

1) Make a new notification address group that contains both Gary and Sandy's addresses/Numbers.  That way you can issue a single transaction to notify both.

 

2) You programs will turn the light off when triggered during the day even if you turned it on manually.

 

Try something like this:

If
        Control  'Front Porch / MS (DD)' is Switched On
Then
        Send Notification to 'Text Gary/Sandy' content 'FrontDoor.Motion'
        Run Program 'Front Door2' (If Path)
        $FrontDoor.Triggered  = 1
Else
        Wait  10 seconds
        $FrontDoor.Triggered  = 0


Sub Program ----------------------------
If
        From    Sunset  -  3 hours 
        To      Sunrise (next day)
Then
        Set 'Front Porch / Front Porch Switch' On
        Wait 5 minutes (Adjust this delay to your needs)
        Set 'Front Porch / Front Porch Switch' Fast Off
Else

The program summary is showing how the programs last ran.  The FrontDoor2 program was forced to run tue by your runThen call.

 

Hope this helps.

 

-Xathros

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...