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 running unexpectedly.

Featured Replies

Posted

I kind of get why this is happening but I don't.  Just can't wrap my head around it.  I thought of breaking it up into 2 programs but don't think that will work.

I am looking to clean up this program.  It works fine with the exception that it runs the “Else” part at 3:01 AM when I update my flag in another program.  The flag is a heartbeat flag.  If the flag stays the same, it still runs at 3:01 AM.  These are unnecessary messages.  I only wat the 8:55 and 5:55 message. My gate sensor does not have a heartbeat.  It does have a Unix time stamp.  So, I look to see if yesterday’s stamp is less than today’s stamp and if so, set my flag to 1.  If not, I set it to 2.

Gate Sensor Problem - [ID 0076][Parent 006C]

If
        (
             Time is  8:55:00AM
          Or Time is  5:55:00PM
        )
    And (
             $sSouthGate is not 1
          Or $sNorthGate is not 1
        )
 
Then
        Send Notification to 'Chris email' content 'Gate Sensor Problem'
        Wait  5 seconds
        Send Notification to 'Pushover' content 'Gate Sensor Problem'
        Wait  5 seconds
        Set 'Notification Controller / UD Mobile' Send Message Content 20 Notification ID (ID=20)
 
Else
        Send Notification to 'Chris email' content 'Gate Sensor Normal'
        Wait  5 seconds
        Send Notification to 'Pushover' content 'Gate Sensor Normal'
        Wait  5 seconds
        Set 'Notification Controller / UD Mobile' Send Message Content 21 Notification ID (ID=21)

 

Solved by larryllix

Go to solution
  • Solution

Whatever your SouthGate or NorthGate does will trigger evaluation of your program.

If anything triggers evaluation the two times with never be true and Else will always get run.

Time triggers are always false unless THEY, THEMSELVES trigger the evaluation, even if the time is exactly the same time.

Single time triggers cannot be used for logic filters.

FIX? Change your NorthGate and SouthGate variabes to INTEGER types so they don't trigger your program, and only your times trigger it.

Edited by larryllix

  • Author

@larryllix Thanks. "If anything triggers evaluation the two times with never be true and Else will always get run."   This is exactly where I got stuck and did not know how to fix.

My problem is my lack of good knowledge of integer and state variables.  I changed the $SouthGate and $NorthGate variables to integer.

Else statements that actually perform actions should be very rare. Usually they'll just do something like reset a variable. 

  • Author

@Guy Lavoie I would agree.  This code was left over from some old sensors with actual heartbeats.  Rather than remove some in-depth code and rewrite some new code; I patched the old.  I was being lazy.  But at the same token it was why reinvent the wheel.  I was like it is all here, just use the "Else"!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

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.