Condition is a Month

Thanks @Bry

That works. !!! :white_check_mark:

How would I separate August and September in my actual rule? Just a comma between? My rule will be looking for August and September. I’m assuming I don’t need different rules for each month.

Now… is there a way to do the same thing and get the forcasted high and low for the day?

I have Pistons that work based on both of those…

You’ll have to put the test for two months in an IF in the flow, because AFAIK you can’t have an ALL in the Trigger. So trigger on something arbitrary and then IF with an ALL.

(No idea on the forecast . . . )

1 Like

Thanks so much. This is taking me back to the days when I was learning WebCoRE… Some days were good, some, not so much!

1 Like

What platform are you using and how are you currently getting the highs and lows?

1 Like

I’m using WebCoRE. It has been bullet-proof.

Every night at 11:50 PM I set a variable for the high and low for “tomorrow” at TWC. {@twcHIGH} and {@twcLOW}. Then I use those variables to tell my other Pistons IF they should do stuff.

Picture2

Picture1

If you have a SmartWeather device which uses the same data source, you can pull the data off that device fairly easily.

…it’s not clear if the SmartWeather device will continue to exist after the Groovy shutdown though. It’s a cloud integration that uses the same TWC source, but the DTH itself is Groovy, so I’m not sure if they will handle it in a special way with the shutdown.

As an alternative, you can setup an Open Weather Map account and can query the data. It’s a few steps to get setup, but once you have the concept down, it provides a lot of functionality:

:link: Rules / Variables based on Date or Calendar - #14 by josh

Thanks Josh.

I’m pulling from The Weather Channel. I am going to try the steps that @Bry sent me for the Month and see if I can get the forecast for “Tomorrow”. It is not a SmartWeather device. Seems to be the same concept. There was a reason I had to pull at 11:50 PM, but I currently can’t recall why. I believe it may have been a time zone issue.

Do you think I can set a variable using data from The Weather Channel?

Not without an API call. WebCoRE was running as a Groovy SmartApp, so it could access the TWC data from the SmartThings Groovy API directly. Of course Groovy is on it’s way out…

The SmartWeather device is using the same data source – I can’t remember exactly what data it exposes, but if that device had the required attributes, you could use it. (Other hubs have a variety of different weather ‘devices’, but for whatever reason, there weren’t a lot of different weather devices created by the community in the SmartThings ecosystem)

Otherwise, if you don’t have a weather device available, making an API call as linked above would be the way to do it today.

Yup, exactly why I’m trying to learn SharpTools. I have 3 months to get everything transferred and WORKING!! It looks like some things I’ll have to do without. :tired_face:

If there’s something you feel is missing, feel free to post and we’ll help out!

With SmartThings killing off Groovy, sometimes it’s going to mean doing things slightly different than before. We’re listening to feedback though and where we see strong demand for things, we’ll build them in as first-class features where it’s reasonable. Of course, there’s lots of people coming over from WebCoRE, so we’re prioritizing based on which feature requests receive the most community interest!

1 Like

@josh

Using your example, I’ve set up an Open Weather Map account, received a key, and created the variable. Since I want Fahrenheit, I need to use “units=imperial” but have no idea where to put that.

Any idea?

You can add it onto the end of the URL:

https://api.openweathermap.org/data/2.5/weather?lat=-33&lon=96&appid={{API_KEY}}&units=imperial

That works. I test it in a Browser and it returns about a million data points. It does not set my variables though. I thought I set it correctly to have one set “tempMax” and one to set “tempLow”.

When I create the context variable I have 2 options.
Picture1
Which is correct?

How do I get just the "tempMax and tempMin from all of that data?

Which endpoint are you using from Open Weather?

You want the Response Data. Then depending on which endpoint you are using from Open Weather, that will determine which ‘property’ you want to grab from the response.

If you haven’t already, I would read through the other thread as it covers some of this in more details.

There’s also an example and description of how the object.property notation works in that thread.

http://api.openweathermap.org/data/3.0/onecall?lat=40.1681&lon=80.1987&units=imperial&appid=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Yeah, that is overwhelming since it has all the hourly and minutely forecast data in it. You can add an &exclude=hourly,minutely option to the URL to remove those items from the response and simplify it a bit.

https://api.openweathermap.org/data/3.0/onecall?lat=40.1681&lon=-80.1987&units=imperial&appid={{API_KEY}}&exclude=minutely,hourly

:warning: Also note that if you are in the US (rather the heart of China) you’ll want to make sure your longitude has the leading negative symbol in front of it.

It will still feel a bit cluttered, so you might want to put the response into a JSON Formatter to make it easier to read through:

In your case, I suspect you are looking for the forecasted daily min/max temperature. So you would want to use:

daily.0.temp.min

And:

daily.0.temp.max

This is basically getting the first entry of the daily forecast and then grabbing the ‘min’ value from under the ‘temp’ object. If you prefer to use the ‘feels_like’ temperature instead, you can do daily.0.feels_like.morn and daily.0.feels_like.day as an approximate morning and mid day value (eg. taking into account how hot it will feel like with humidity, etc).

Ummm, what is “end point”?

I’ve gone through the previous information and it has gotten me to this point. I guess I’m really hung up on the exact data that goes in the context variable at this point. Is this the API key for Open Weather or is this some version of “temp-max”?
Picture2

What you shared is what I was looking for. Basically just the URL. :slight_smile:

See my response above.

daily.0.temp.min

If that doesn’t help, feel free to share a screenshot of what you have working in your rule so far (make sure to blur out your API Key).

:smiley: EXCELLENT!!!

It works.

Thank you for the excellent help.

1 Like