UV Monitor, app to alert about sun danger


(Alex) #1

Hi,

I wanted to share the app that I wrote. It’s kind of handy in the summer. It will alert you if UV index is dangerously high.

Feel free to modify and share the code.

https://github.com/625alex/SmartThings/blob/master/apps/UVMonitor.groovy


(Alex) #2

I made minor changes to validate UV value, since sometimes the WU returns -1 for UV.


(Amauri Viguera) #3

I installed this yesterday but I’m getting seemingly random alerts. I haven’t looked at the code but I assume no configuration is needed?

Earlier today it was alerting to UV 5, then 4, then around 9 an hour later.

Incidentally, it’s been cloudy here all day so I’m not sure the UV index is that high.


(Alex) #4

@viguera
That’s right, no configuration is needed.

The app checks UV report of Weather Underground based on your home’s location every 15 minutes. If UV reading is grater than 5 (high), it will alert you. You will not get any alerts until the value changes. Once the UV rating gets below 5, you will not get any more notifications until it gets above 5 again.

If you had broken clouds all day, it’s possible that the UV rating greatly fluctuated throughout the day.

I compared readings from Weather Underground’s website and ones reported by my app. They seem to match.

I also subscribed to UV alerts from IFTTT, but Yahoo weather reports rather different UV ratings. Maybe it’s because IFTTT uses city’s official report. Weather Underground has a weather station right next to my house, so their weather report is always slightly different than city center’s.


(Amauri Viguera) #5

Thanks.

I’ll look at the UV report from WU and compare.


(Alex) #6

Check app properties in the IDE. It saves last reported value.

Let me know if you find something interesting.


(Amauri Viguera) #7

Nothing outrageous… it seems to match the reports from WU, so maybe I’m the one underestimating the UV value :smile:

I did notice a typo where Extreme was incorrectly spelled Extreame though but that’s minor :smile:

The one thing that I was going to edit and figured I’d point out as a request instead is to have a customizable schedule, rather than a preset 60 minute interval for “announcements” of the UV index. That way you could set it as every 3-4 hours or once a day or something to that effect.


(Alex) #8

I updated the app to take settings for refresh interval, minimum UV threshold and change quantity.

This app even scores some WAF points from my wife :smile: who has fare skin. She is warming up to seeing notifications from ST.

I also created a UV Sensor device type that might be useful on a dashboard. It should be used with something like Pollster to refresh it periodically.