Jump to content

How to send only one notification if condition is met


pjjameso

Recommended Posts

Posted

Have the following program set to send me a pushover notification if the power usage is greater than to 5.0KW. Issue is the each change in value > 5 kw programs sends a notification.  Obviously only want one notification for each instance where threshold is breached. Thoughts?

MBR Aux Heat On - [ID 0061][Parent 0001][Not Enabled]

If
        'Emporia / Vue 2 L / L11 MBR Furnace' Killowatts > 5.0000 kW
 
Then
        Set 'Notification Controller / Service Pushover polyglot' Send Sys Short With Params To all Priority=Normal Format=Monospace Sound=Pushover (default) Retry=30 Expire=60
 
Else
   - No Actions - (To add one, press 'Action')
 

Posted

Use two programs. The first one senses the event and runs the second program.

The second program disables the first program and sends the notification.
After the desired time or event the second program re-enables the first program.

Techniques like this sometime require a third program to enable the first program to avoid it being 'stuck' in disable mode due to user error or power failure while disabled.

I find I prefer using a variable as they are more bulletproof.

Sent from my SM-G781W using Tapatalk

  • Like 2
  • Thanks 1
Posted
11 hours ago, larryllix said:

Use two programs. The first one senses the event and runs the second program.

@larryllix's solution can make for a very robust system.  If you're looking for something simpler and want to stay with one program, then create an integer variable (I'll call it iUsageAlertSent) and use it to filter when the notification is sent.  Something like this:

MBR Aux Heat On
If
        'Emporia / Vue 2 L / L11 MBR Furnace' Killowatts > 5.0000 kW
    And $iUsageAlertSent = 0
 
Then
        Set 'Notification Controller / Service Pushover polyglot' Send Sys Short With Params To all Priority=Normal Format=Monospace Sound=Pushover (default) Retry=30 Expire=60
        $iUsageAlertSent = 1
 
Else
        $iUsageAlertSent = 0

This program will send one notification when the usage exceeds 5kW and won't send another until the usage drops below 5kW and then exceeds 5kW again. 

You want to use an integer variable and not a state variable because you don't want your program to be triggered when you change the variable value from 0 to 1 or 1 to 0.  When you create the integer variable, you should set the INIT value to 0 so that whenever the ISY is restarted the variable will default to 0.

If you'd rather have a time limit control when another notification can be sent, then create two programs - something like this:

MBR Aux Heat On
If
        'Emporia / Vue 2 L / L11 MBR Furnace' Killowatts > 5.0000 kW
    And $iUsageAlertSent = 0
 
Then
        Set 'Notification Controller / Service Pushover polyglot' Send Sys Short With Params To all Priority=Normal Format=Monospace Sound=Pushover (default) Retry=30 Expire=60
        $iUsageAlertSent = 1
        Run Program 'Reset Usage Alert Sent' (Then Path)
 
Else
  - No Actions - (To add one, press 'Action')

Reset Usage Alert Sent
If
Then
        Wait 10 minutes
        iUsageAlertSent = 0
Else
  - No Actions - (To add one, press 'Action')

 

  • Like 1
  • Thanks 1
Posted (edited)
7 hours ago, kclenden said:

@larryllix's solution can make for a very robust system.  If you're looking for something simpler and want to stay with one program, then create an integer variable (I'll call it iUsageAlertSent) and use it to filter when the notification is sent.  Something like this:

MBR Aux Heat On
If
        'Emporia / Vue 2 L / L11 MBR Furnace' Killowatts > 5.0000 kW
    And $iUsageAlertSent = 0
 
Then
        Set 'Notification Controller / Service Pushover polyglot' Send Sys Short With Params To all Priority=Normal Format=Monospace Sound=Pushover (default) Retry=30 Expire=60
        $iUsageAlertSent = 1
 
Else
        $iUsageAlertSent = 0

This program will send one notification when the usage exceeds 5kW and won't send another until the usage drops below 5kW and then exceeds 5kW again. 

You want to use an integer variable and not a state variable because you don't want your program to be triggered when you change the variable value from 0 to 1 or 1 to 0.  When you create the integer variable, you should set the INIT value to 0 so that whenever the ISY is restarted the variable will default to 0.

If you'd rather have a time limit control when another notification can be sent, then create two programs - something like this:

MBR Aux Heat On
If
        'Emporia / Vue 2 L / L11 MBR Furnace' Killowatts > 5.0000 kW
    And $iUsageAlertSent = 0
 
Then
        Set 'Notification Controller / Service Pushover polyglot' Send Sys Short With Params To all Priority=Normal Format=Monospace Sound=Pushover (default) Retry=30 Expire=60
        $iUsageAlertSent = 1
        Run Program 'Reset Usage Alert Sent' (Then Path)
 
Else
  - No Actions - (To add one, press 'Action')

Reset Usage Alert Sent
If
Then
        Wait 10 minutes
        iUsageAlertSent = 0
Else
  - No Actions - (To add one, press 'Action')

 

There is a problem with the single program in that it will send notifications every second value change.

First time the threshold passes 5.0000 kW the variable $iUsageAlertSent will be set to 1.

Second time the threshold variable changes over 5.0000 kW the $iUsageAlertSent variable will be equal to 1 and the If section will be evaluated as false, running Else. Now $iUsageAlert will be set back to 0.

Third time the threshold changes over 5.0000 kW the notification will be sent again.

Edited by larryllix
  • Like 1
  • Thanks 1
Posted

Here is a one program trick I like to use to create an 'inline If-Then' construct inside programs that should work.

You will get a notification every time the threshold bobbles from <=5.0000 to >5.0000 kW, if there is no time hysteresis used.  I inserted 2 hours as a random amount of time. YMMV.

MBR Aux Heat On
If
        'Emporia / Vue 2 L / L11 MBR Furnace' Killowatts > 5.0000 kW
 
Then
        Repeat while  $iUsageAlertSent = 0
              Set 'Notification Controller / Service Pushover polyglot' Send Sys Short With Params To all Priority=Normal
                          Format=Monospace Sound=Pushover (default) Retry=30 Expire=60
              $iUsageAlertSent = 1
        Repeat 1 times
 
Else
        Wait 2 hours
        $iUsageAlertSent = 0
  • Thanks 1
Posted

I went with the three program solution... Thank you both very much for the suggetions.

MBR Aux Heat Sense - [ID 0065][Parent 0064]

If
        'Emporia / Vue 2 L / L11 MBR Furnace' Killowatts > 5.0000 kW
 
Then
        $sMBR.Aux.On  = 1
 
Else
        $sMBR.Aux.On  = 0

 

MBR Aux Heat On - [ID 0061][Parent 0064]

If
        $sMBR.Aux.On is 1
 
Then
        Set 'Notification Controller / Service Pushover polyglot' Send Sys Short With Params To all Priority=Normal Format=Monospace Sound=Pushover (default) Retry=30 Expire=60
 
Else
   - No Actions - (To add one, press 'Action')
 

MBR Aux Heat Off - [ID 0062][Parent 0064]

If
        $sMBR.Aux.On is 0
 
Then
        Set 'Notification Controller / Service Pushover polyglot' Send Sys Short With Params To all Priority=Normal Format=Monospace Sound=Pushover (default) Retry=30 Expire=60
 
Else
   - No Actions - (To add one, press 'Action')
 

  • Like 2
Posted
13 hours ago, larryllix said:

There is a problem with the single program in that it will send notifications every second value change.

Yeah, that's what happens when I try to program on the fly without testing.  Many a prof in college used to notice the same kind of thing.  😁

  • Haha 1
Posted
On 11/21/2022 at 6:56 AM, pjjameso said:

I went with the three program solution... Thank you both very much for the suggetions.

MBR Aux Heat Sense - [ID 0065][Parent 0064]

If
        'Emporia / Vue 2 L / L11 MBR Furnace' Killowatts > 5.0000 kW
 
Then
        $sMBR.Aux.On  = 1
 
Else
        $sMBR.Aux.On  = 0

 

MBR Aux Heat On - [ID 0061][Parent 0064]

If
        $sMBR.Aux.On is 1
 
Then
        Set 'Notification Controller / Service Pushover polyglot' Send Sys Short With Params To all Priority=Normal Format=Monospace Sound=Pushover (default) Retry=30 Expire=60
 
Else
   - No Actions - (To add one, press 'Action')
 

MBR Aux Heat Off - [ID 0062][Parent 0064]

If
        $sMBR.Aux.On is 0
 
Then
        Set 'Notification Controller / Service Pushover polyglot' Send Sys Short With Params To all Priority=Normal Format=Monospace Sound=Pushover (default) Retry=30 Expire=60
 
Else
   - No Actions - (To add one, press 'Action')
 

I'm pretty sure you get the same result by putting the "then" clause of program 3 into the "else" of program 2 and deleting program 3.  Since your variable seems to have only two possible values (0 and 1) the result will be the same.  In other words, program 2 will run false on a 1 to 1 basis with program 3 running true.

  • Like 1
  • Thanks 1
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.4k
×
×
  • Create New...