Weather to set mode?

I would like to have two different “home” modes: one for bright sunny days and one for dark overcast days.

I have NO lux sensors. I do have IFTTT, which has weather triggers, but there’s no way to have IFTTT control modes. (Please change that!)

I notice that the IDE has some weather stuff, and the “When it’s going to rain” smart app also shows that there are hooks into weather in ST.

How can I do this? Right now, I have to manually choose what kind of day it is, which is much less than optimal.

There is a virtual weather tile you can add through the ide that does lux things. I don’t know how accurate it is, but that would be a good starting point.

From there, you would likely need to create an app that watches that lux value and changes the mode accordingly.

Can you be a little more specific about the tile? What’s its name and what category is it in?

OK, I think I found it. “Dark Weather”?

Now I’m just plodding along trying to get it to appear in my apps. That process seems like magic–sometimes it’s instant, other times it never happens.

@differentcomputers - Install a On/Off Button tile (it’s like a virtual switch), then have IFTTT toggle that on or off based on the weather, then use a simple app to switch the mode based on whether that switch is on or off.

Install On/Off button tile: From IDE, go to My Devices, then click New Device, Enter a name and make up a network ID (use 1000 or something to make sure it’s unique), select “On/Off Button Tile” for Device Type… that’s it.

Then make a smart app something like this (I didn’t test this):

preferences {
	section("Mode Follows This Switch") {
		input "switch", "capability.switch", title: "Choose Switch"
    }
    section("Modes"){
		input "onMode", "mode", title: "Mode when On"
		input "offMode", "mode", title: "Mode when Off"
		}
}

def subscribeToEvents()
{
	subscribe(switch, "switch.on" onHandler)
    subscribe(switch, "switch.off", offHandler)
}

def installed()
{
	subscribeToEvents()
}

def updated()
{
	unsubscribe()
	subscribeToEvents()
}

def onHandler(event) {
	setLocationMode(onMode)
}

def offHandler(event) {
	setLocationMode(offMode)
}

@Steve28, I appreciate the help!

But when I try to save your code, I get this:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: script1395613080897373091895.groovy: 19: unexpected token: switch @ line 19, column 12. subscribe(switch, "switch.on" onHandler) ^

1 error

line 19: subscribe(switch, "switch.on" onHandler)

Oops! Sorry, @differentcomputers - cut-n-pasted the wrong version!

try this:

preferences {
	section("Mode Follows This Switch") {
		input "theSwitch", "capability.switch", title: "Choose Switch"
    }
    section("Modes"){
		input "onMode", "mode", title: "Mode when On", required: true
		input "offMode", "mode", title: "Mode when Off", required: true
		}
}

def subscribeToEvents()
{
	subscribe(theSwitch, "switch.on", onHandler)
    subscribe(theSwitch, "switch.off", offHandler)
}

def installed()
{
	subscribeToEvents()
}

def updated()
{
	unsubscribe()
	subscribeToEvents()
}

def onHandler(event) {
	setLocationMode(onMode)
}

def offHandler(event) {
	setLocationMode(offMode)
}

That “compiled” no problem. Now to find out if it works!

First off, this Virtual Switch trick with IFTTT to set modes should be broadly publicized. Because it’s a HUGE lever for doing all sorts of things! Many thanks to @Steve28!!

But here’s my problem now: The Sunrise/Sunset App currently sets my daytime mode to Dark Weather, my default daytime mode. IFTTT seems to only send commands when the weather changes, it doesn’t constantly barrage with statuses. So in the morning, Dark Weather kicks off. And unless or until the weather changes and IFTTT tells ST about it, it will stay Dark Weather until Night.

Which is fine, you know, if it’s actually overcast or raining. But mostly, it’s sunny. Now, I could point the morning mode change to It’s a Lovely Day mode instead of Dark Weather mode, but that doesn’t get rid of the problem.

Any ideas? I feel like I’m always one more “IF x” away from solving my problem. If IFTTT allowed nested ifs, I could make it go “If time = NN:NN AND Weather = Clear, then…” but no.

I’m also playing with the Weather Tile, but it doesn’t have any outputs for some reason, and I can’t use it as a sensor.

No help here on this? I sure would love to figure out how to use the outputs of the Weather Tile to trigger actions!

I think if you stop changing the modes in your sunrise/sunset app and modify the dark weather app to specifically set only to the two modes you want, you’ll get exactly what you want. Dark weather checks the weather every minute between sunrise and sunset.

Dark weather checks the weather every minute between sunrise and sunset.

Except, as far as I can tell, Dark Weather looks at moisture sensors, rather than at any sort of weather report.

Did you try it?

Ummm… Try what? I’ve got Dark Weather installed, but it’s impossible to configure without defining which sensor it should look at.

Try installing the weather device too. Then point to that as a sensor (water) in your dark weather app. Might just work… :slight_smile:

Twack

I’ve already got the weather tile installed. The Dark Weather app doesn’t see it. :confused:

Hello
Novice question here but… how do I install a virtual switches? Should it be done via web? (can’t find anything on app interface)
Thanks.

Yes, you have to create virtual switches in your account at http://ide.smartthings.com

I’ve made some progress with using the Weather Tile as a sensor. However, it seems like the Weather tile only updates manually, or maybe twice a day? Randomly? I can’t tell.

Is there any way to set the Weather tile to update more often? At the very least, I need it to be able to tell ST that it has gotten dark out at sunset! (I know there’s a sunset app, but I’m trying to sense dark weather AND sunset/sunrise, just like a Lux sensor would.)

Bug confirmed.

I just chatted online with Tyler, who spoke with a dev, and they confirm there’s a bug in the Smartstation Weather Tile code that prevents it from updating regularly. It’s supposed to update every 5 minutes, but mine is doing it at most 2x per day.

I also suggested changing the tile’s logging to only log changes to the weather, rather than logging everything, since that will quickly fill the activity feed in the iOS app otherwise.

If you’re trying to do anything with your setup that involves weather, this tile is really powerful, or at least it will be once it’s fixed! So check it out in the IDE.