SmartApp Severe Weather Notifications Help Needed

I am currently using the built-in “Severe Weather Alert” SmartApp. Sadly, it’s been long enough since I enabled it that I can’t remember if it was from Classic and showed up in New, or if it had its own counterpart in the New App that I used that one. The icon is dark gray, with a lightning bolt going from bottom left to upper right corners. Either way, it works great, except for one thing.

Is there a setting to stop my house from telling me about the bad weather EVERY SINGLE HOUR?
I KNOW that there’s a flood watch :ocean:, a river flood watch :ocean:, AND a winter weather advisory :snowflake: from two days ago until Sunday. I GET IT. Is there a way to drop this down to like once every four hours? Once every six?

I was going to try the steps from this post, but I don’t know where to pull the code from in order to modify and make it my own?

I appreciate being told about the bad weather, but MAN. SO many notifications! haha

3 Likes

@dare2smile

https://github.com/SmartThingsCommunity/SmartThingsPublic/blob/master/smartapps/smartthings/severe-weather-alert.src/severe-weather-alert.groovy

1 Like

Thanks!

Do I just use it as is? I browsed the code and saw “samsungtv” - I don’t have a samsung tv, or a tv with smartthings on it at all. Do I need to modify the code?

@dare2smile, that is just some weird code over there. As you are already using the stock ST version, you are using the same.
I have really no clue what that TV thing it is referring to, but it will not effect you. You just need to modify the part according the other thread’s description to reduce the number of notifications.

Awesome, thanks!

Is this the part I’m supposed to modify? It seems the code has changed since the original 2014 thread date…

>     def scheduleJob() {
>         def sec = Math.round(Math.floor(Math.random() * 60))
>         def min = Math.round(Math.floor(Math.random() * 60))
>         def cron = "$sec $min * * * ?"
>         schedule(cron, "checkForSevereWeather")

I haven’t looked at that part of the code, but I believe so. I will be able to look at it tomorrow, if you want to be sure.

Alright, I’ll mess around with that section and see what happens. At worst, I’ll have to put the raw code back in and overwrite it! :slight_smile:

Change the name just to be able to differentiate.

Hmmm… Apparently I got a little mixed up in things.

I wasn’t getting any change in notification frequency, so I decided to mess with it more and changed the name. Discovered it wasn’t showing up at all in my app, so that’s when I realized that I hadn’t ever actually installed the one linked above.

Just tried to install it, got “error installing SmartApp, please try again”. Okay, tried again. Same error.
So then I decided to delete the original SmartApp. That went fine, however I still can’t install the new one lol. Not really sure where to go now.

Do groovy things work with the NewApp?

Should be, but rather try it in the classic app to confirm it works. I have had recently some issue with the new app and some already installed SmartApp what I wanted to update (ABC Advanced Button Controller), the new app just crashed (as usually does).

@dare2smile, I have looked at the code. You just need to change this:

 def cron = "$sec $min * * * ?"

To something like this for every 4 hours:

def cron = "$sec $min 0/4 * * ?"

Use one of the available free cron generators to define and test what you want, like this:

http://www.cronmaker.com/

PS: Funy thing, that the code has that filter function, what seems to be not used at all, but probably was intended to filter some kind of alerts.

1 Like

dare2smile :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap:

Okay, I was finally able to pull away from work and things long enough to try this!

I think I must have messed something up when I was originally trying to mess with the code - I reinstalled it fresh and it went through. Thankfully didn’t need the oldApp.

Set it to your 0/4 hour example, but of course we’re not under severe weather for the timebeing lol.

Last question - what’s a cron? haha

@dare2smile

Basic scheduling solution from unix used by many platform. Quite robust.

1 Like

Interesting… The most coding I can personally do is like… The introduction course to the introduction course of SQL. :joy:

Thanks!!

Now you know this too! And you have managed to fix your SmartApp with it. :+1:

2 Likes

True!! Thank you for that vote of confidence!!

I use the smart weather station and notifications app from rboy apps. It fixed the exact same issue I was having about repeat notifications. See this: [RELEASE] Smart Weather Station Tile Updater and Severe Weather Notifications - Fix Broken Modes and Repeat Notifications

After 65 degree weather here on Sunday, it dropped 30 degrees and is now supposed to snow tomorrow. :weary: The only plus to this is…

Severe weather alerts kicked on, and I’m SO happy to say that the notifications are truly ringing ever 4 hours! :tada: :tada: :tada:

Thanks for all your help @GSzabados!!

3 Likes