Instant notification x1 then 15 min time repeat

Hello, I think this is pretty basic but even after reading procedures i still cant figure it out.

when temp drops below X I like to call the alert instantly.(once) then repeat every 10-15 min.

i’m just not sure :frowning: please help?notifications final

Are you expecting this to work when your app is asleep ?

1 Like

Have you set the Clock timer to 15 minutes?

That Notifier is not an App Inventor component…?

I am looking for it to work in background. I have another block that keeps it alive. It does work now at 15 min. But the 15min timer always fires. if the timer fired 1 min ago and the low temp alert still not true it will wait 14 more min to send an alert when the timer fires again If low temp went true in the meantime.

I was thinking maybe I need to enable and disable timers to get it to work instead of always firing?
So after low temp it enables a clock T1 and T2. T1 set for 5 sec fire alert then disable timer. T2 I guess will continue to count 15 min and fire alert IF the low temp alarm is still true?

The problem I’m having is say I only want it to alert 5 times. Without a user pressing a button I dont know how to make something happen a set # of times when using clocks and IF statements. If I wanted only 3 alerts, ETC?

I dont think that will work either. I’m lost

I find it always helps to work this out on a piece of paper first, then the workflow and the process becomes clear. you are not giving us everything to work with but it seems:

Get the corrected temp value
Test it against high/low values
if >high or <low then
notify

then repeat the above every 15 minutes, but only three times

I guess you need one clock to do the first check, then another clock to do the three repeat tests (use a counter and add one after each test to stop after three)

?

1 Like

Hi Jeff,

I think this is what you are trying to do?

Set timer 1 to fire say, every 1000ms.

Set timer 2 to fire say, whenever you want (15 min?)

I just threw the blocks together to show you, I didn’t test it, but it should do what you want.

I forgot to add the blocks to reset timer 2, if no alarms are on, so it always starts a new timer cycle, I’m sure you can figure that part out.

Mike.

1 Like

If you a need to display the message X number of times you can do something like shown in the blocks below.

You may want to use separate timers for High and Low alarms so you can control them independently, or use some logic statements to do the same.

You can probably condense this code much better than my example, this is just to give you a general idea of how I would do it.

On another note, if you are receiving the Temperature values from an Arduino, if you display your values on Webviewer, by using setWebViewString, then even when you app sleeps the values will update.

Just use a JavaScript Timer to request data from the Arduino via setWebViewString, every second or so. Use GetWebViewString on the App, inside a timer, to do what you want with the data, like send it to Arduino, sound an alert and so on.

I have a complicated app sending large amounts of data from Arduino, to Webviewer and even when the app sleeps, everything works fine, even JavaScript on/off timers I have will turn things on/off, by using setWebViewString, then Bluetooth to send to Arduino.

Mike.

1 Like

You need to keep two global variable for this:
System time (MS) when the alarm was last sounded, and
Number of remaining alarms to sound before stopping.
This will let you do this with just 1 clock.

Sample app:
https://groups.google.com/forum/#!msg/mitappinventortest/BOj2-ThEe3s/VlmXdcVOAgAJ

1 Like

Thank you so much for taking the time to show me all that! I really really appreciate it!! Ive only doing this about 2 months and have lots to learn. I should be able to get it going from there. It also shows me better ways on some of my existing blocks. Thanks again!.

It is an Arduino project. ESP32 connected to WIFI sends temp data to ThingSpeak. The app interacts with thing speak. It does seem to be always showing values but just the raw values from thingspeak. The app I add some temp corrections and such. Those numbers go to zero as i open the app. Maybe GetWebViewString will stop that from happening? I will look into that for sure. Thanks again for everything!

Your welcome Jeff, like I said I just threw the code together to give you an idea of how I would do it, you can condense the code and refine it to suit your needs.

If your values are resetting to zero on start up, it sounds to me like your not saving/reading to/from Tinydb correctly? But that will just take some trouble shooting to figure out.

There are many great people on here that have way more knowledge than I do that will gladly help you out. I have only been playing with app Inventor a few months as well, so I am far from an expert.

Take care and good luck with your App.
Mike.

interesante estoy buscando algo parecido lo simulo según los bloques y no obtengo nada
esto se lo que tengo en mi screen
1 switch
2 lavels con numeros dferentes
2 clocks
1 notifier

image
image

y no obtengo ningún mensaje
podrías adjuntar el .aia
saludos

Did you check logcat?
Because the LogWarning method will display a message there...

From the documentation User Interface

LogWarning(message)

Writes a warning message to the Android log. See the Google Android documentation for how to access the log

Taifun

alertas.aia (3.8 KB)

donde reviso logcat?
perdón tiene que estar instalado?
porque aun lo estoy simulando en el Al companiom
adjunto .aia

Taifun

no entiendo
solo me gustara saber donde encuentro logcat
envié el .aia podrías visualizarlo quizá me falta algo
yo ya lo revise muchas veces lo simule, lo instale y nada
ningún mensaje

el titulo
Notificación instantánea x1 luego 15 minutos de tiempo de repetición
en ninguna parte habla de logcat y le funciono al amigo m_casky
quizá podría compartir el aia
saludos

read again my previous answer
there is a detailed guide how to use it

if you want to show a notifier in your app, use one of the other methods of the notifier component, for example the ShowAlert method...
protip: read the documentation User Interface

Taifun