Jump to content
View in the app

A better way to browse. Learn more.

Universal Devices Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Program question

Featured Replies

Posted

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
 
 

 

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

Edited by Xathros

Guest
This topic is now closed to further replies.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.