[RELEASE] Smart Weather Station Tile Updater - Fix Broken Modes

weather
smartapp_weather
smartweather
dth_weather
rboyapps

(www.rboyapps.com - Make your home your butler!) #1

This is a bugfixed version of the SmartWeather Station Controller that is currently published. This one adds supports for modes, e.g. you can set it to update the SmartWeather Station Tile while only in a specific mode (e.g. Home, Away, Night etc).

This app is available on the RBoy ST SmartApps Server, http://smartthings.rboyapps.com. Refer to our facebook page below to get access to the server.
If you like the Apps consider supporting our development efforts. Visit our Facebook page for updates on new apps and to get Access to all our Premium ST Apps Server. http://www.facebook.com/RBoySTApps

The latest version of these apps with udpates are available on the RBoy server.

/* **DISCLAIMER**
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * Without limitation of the foregoing, Contributors/Regents expressly does not warrant that:
 * 1. the software will meet your requirements or expectations;
 * 2. the software or the software content will be free of bugs, errors, viruses or other defects;
 * 3. any results, output, or data provided through or generated by the software will be accurate, up-to-date, complete or reliable;
 * 4. the software will be compatible with third party software;
 * 5. any errors in the software will be corrected.
 * The user assumes all responsibility for selecting the software and for the results obtained from the use of the software. The user shall bear the entire risk as to the quality and the performance of the software.
 */ 
 
 /**
 *  Weather Station Controller
 *
 *  Copyright 2014 SmartThings
 *	Bugfixed by RBoy
 *  Version 1.5
 *  2016-2-12 - Changed scheduling API's (hopefully more resilient), added an option for users to specify update interval
 *  2016-1-20 - Kick start timers on sunrise and sunset also
 *  2015-10-4 - Kick start timers on each mode change to prevent them from dying
 *  2015-7-12 - Simplified app, udpates every 5 minutes now (hopefully more reliable)
 *  2015-7-17 - Improved reliability when mode changes
 *	2015-6-6 - Bugfix for timers not scheduling, keep only one timer
 *			 Added support to update multiple devices
 *			 Added support for frequency of updates            
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 */

definition(
    name: "SmartWeather Station Controller",
    namespace: "rboy",
    author: "RBoy",
    description: "Updates SmartWeather Station Tile devices every hour. This contains a bug fix for the updates stops when user select custom modes and it updates every 5 minutes",
    category: "Convenience",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/SafetyAndSecurity/App-MindYourHome.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/SafetyAndSecurity/App-MindYourHome@2x.png"
)

preferences {
    section ("Weather Devices") {
        input name: "weatherDevices", type: "device.smartweatherStationTile", title: "Select Weather Device(s)", description: "Select the Weather Tiles to update", required: true, multiple: true
        input name: "updateInterval", type: "number", title: "Enter update frequency (minutes)", description: "How often do you want to update the weather information", required: true, defaultValue: 5
    }
}

def installed() {
    log.debug "Installed with settings: ${settings}"
    if (updateInterval <= 0) {
    	log.error "Invalid weather update interval $updateInterval minutes. Minimum update interval should be 1 minute"
        sendNotification "Invalid weather update interval $updateInterval minutes. Minimum update interval should be 1 minute"
    }

    initialize()
}

def updated() {
    log.debug "Updated with settings: ${settings}"

    unsubscribe()
    unschedule()
    initialize()
}

def initialize() {
    subscribe(location, modeChangeHandler)
    subscribe(location, "sunset", modeChangeHandler)
    subscribe(location, "sunrise", modeChangeHandler)
    scheduledEvent()
}

def modeChangeHandler(evt) {
    log.debug "Reinitializing refresh timers on mode change notification, new mode $evt.value"
    scheduledEvent()
}

def scheduledEvent() {
    log.trace "Refresh weather, update frequency $updateInterval minutes"
    runIn(updateInterval*60, scheduledEvent)
    weatherDevices.refresh()
}

For more details on SmartWeather Station Tile and Controller see this thread:

To Install the SmartWeather Station Tile and Controller, there are 2 steps:
1.

Install the Smart Weather Tile Device from the WebIde (kinda silly but that’s the way it is)
Login to https://ide.smartthings.com
Go to devices tab (https://graph.api.smartthings.com/device/list)
Click new device button in top right corner (https://graph.api.smartthings.com/device/create)
Choose whatever you want for name and network id. Change type to SmartWeather Station Tile. Choose your location. Leave everything else alone.
Click create.

Create and install the SmartApp given above.
If you need installation instructions on how to install a SmartApp you can refer to them here: http://smartthings.rboyapps.com/#a5


Weather Station Information Integration
Smart Weather Station Tile Device (add using IDE)
What's Going On?
Smart Weather Station Tile Device (add using IDE)
Outside temperature from Yahoo Weather or some other service
Smart Weather station tile update
[RELEASE] Attic Fan Smart Ventiation
CoRE - Get peer assistance here with setting up Pistons
runPeriodically(), runEvery1Hour() scheduler questions
Pollster and Smart Weather Station Tile App
Pollster and Smart Weather Station Tile App
Smart Weather Station Tile Device (add using IDE)
Smart Weather Station Tile Device (add using IDE)
Control lights with motion only when it's dark?
(www.rboyapps.com - Make your home your butler!) #2

Fixed an issue with updates stopped working after a few months, added support to select multiple weather tiles to udpate and also added an option to configure the update frequency


(www.rboyapps.com - Make your home your butler!) #3

Improved scheduler reliability after a mode change


(www.rboyapps.com - Make your home your butler!) #4

Simplified it further, so some reason SmartThings platform keeps dying on the timers. Now using a different and more reliable method to avoid timer failures. Now it updates every 5 minutes.


(www.rboyapps.com - Make your home your butler!) #5

Updated to kick start refresh timers on mode change, to workaround the dying timers issues.
Make sure you re initialize the settings after updating the code for it to take effect.


(www.rboyapps.com - Make your home your butler!) #6

Version 1.4 added kick start based on sunrise and sunset to make it more reliable


(Steve Jackson) #7

Thanks for the update…I’ll take a look at your Facebook page.

Steve


#8

Anywhere in the code where I can change update interval?


(Steve Jackson) #9

I would be interested that option too. Unfortunately, I don’t know how to program in groovy to make the change. I’ve tried to modify the code a couple times but it still updates at 5 minutes or sooner.


(www.rboyapps.com - Make your home your butler!) #10

Instead of

runEvery5Minutes(scheduledEvent)

use

runIn(60, scheduledEvent)

60 represents the number of seconds. Don’t use less than 60.

And dont forget to open and reinitialize your app once the code has been updated.


(Steve Jackson) #11

Thank you. I know you do this for profit so I GREATLY appreciate these freebies. I’m learning a bit too!


(www.rboyapps.com - Make your home your butler!) #12

Version 1.5
Added options for users to configure update period in minutes and use new scheduling API’s, hopefully more stable


(J-F) #13

Could you tell me where to find your SmartWeather Tile Controller app?
In the mobile app, the “+>More>Convenience” does not seem to exist anymore…
Am I missing the obvious?

I went to “Connect New Device” --> SmartApps --> More… and I didn’t find your app.


(Steve Jackson) #14

It’s in the first post of this thread. You will need to install it through the IDE interface.


(John Fisher) #15

First off, THANK YOU for all of your input, tools and advice! I am a member of your site and rely on your devices a things regularly.

I have researched everything I can find on the weather tile and controller from 2014 to now and cannot seem to find concise instructions for connecting the weather tile to a specific WU PWS.

Thanks again


(www.rboyapps.com - Make your home your butler!) #16

Thanks for your support.

I did some research on this some time ago. The only way to do that is to write a custom device handler for the weather stations. You can refer to the WU API’s to get started.

https://www.wunderground.com/weather/api/d/docs


(John Fisher) #17

Thanks for the info. Keep it up.


(Paul) #18

Hi… before i spend the $20 i want to make sure i understand what the weather handler does. It will update automatically.without having to be open… correct? Does that include the lux info? Is anyone else using this weather decive as a lux sensor?

Thanks


(www.rboyapps.com - Make your home your butler!) #19

This app just updates the weather station tile regularly without intervention.

Your question is about if the tile itself reports lux and that depends up on what tile you’re using. The stock tile does report lux but not the real lux, it has a proxy based on weather (see the ST code). There are other custom tiles floating around the forum you can check out, however this app won’t work those tiles as the device type smartWeatherStationTile isn’t natively supported by ST.

In short, if you’re using the stock ST weather station tile this app will keep it updated.


(George) #20

How reliable is the latest v1.5 of the updater? I’ve recently installed it, set to 5min updates - but find it misses updates frequently. It does appear to restart at sunrise, but then stops for hours at a time. I’m running on a v2 hub if that matters any.
thanks!