Where does the weather come from?


#41

Yep.
One possible solution is to go back to accuweather or something. Or the weather.gov API, which provides the following. If I could extract just the windSpeed forecast from this and store it as a global variable, that would suffice for my purpose:

{
@context”: [
https://raw.githubusercontent.com/geojson/geojson-ld/master/contexts/geojson-base.jsonld”,
{
“wx”: “https://api.weather.gov/ontology#”,
“geo”: “http://www.opengis.net/ont/geosparql#”,
“unit”: “http://codes.wmo.int/common/unit/”,
@vocab”: “https://api.weather.gov/ontology#
}
],
“type”: “Feature”,
“geometry”: {
“type”: “GeometryCollection”,
“geometries”: [
{
“type”: “Point”,
“coordinates”: [
-97.094408400000006,
39.7559738
]
},
{
“type”: “Polygon”,
“coordinates”: [
[
[
-97.1089731,
39.766826299999998
],
[
-97.108526900000001,
39.744778799999999
],
[
-97.079846700000004,
39.745119500000001
],
[
-97.08028680000001,
39.767167000000001
],
[
-97.1089731,
39.766826299999998
]
]
]
}
]
},
“properties”: {
“updated”: “2018-12-07T02:10:07+00:00”,
“units”: “us”,
“forecastGenerator”: “HourlyForecastGenerator”,
“generatedAt”: “2018-12-07T03:54:25+00:00”,
“updateTime”: “2018-12-07T02:10:07+00:00”,
“validTimes”: “2018-12-06T20:00:00+00:00/P7DT5H”,
“elevation”: {
“value”: 441.96000000000004,
“unitCode”: “unit:m”
},
“periods”: [
{
“number”: 1,
“name”: “”,
“startTime”: “2018-12-06T21:00:00-06:00”,
“endTime”: “2018-12-06T22:00:00-06:00”,
“isDaytime”: false,
“temperature”: 23,
“temperatureUnit”: “F”,
“temperatureTrend”: null,
“windSpeed”: “5 mph”,
“windDirection”: “NE”,
“icon”: “https://api.weather.gov/icons/land/night/bkn?size=small”,
“shortForecast”: “Mostly Cloudy”,
“detailedForecast”: “”
},
{


#42

Can you post the URL request you’re using? I’ll give it a shot.


#43

https://api.weather.gov/gridpoints/TOP/31,80/forecast/hourly

There are hourly forecasts for the next many; I just want the wind speed from the first
Thanks in advance!


#44

that is a buttload of data.


#45

Should we assume that webCoRE will no longer have built-in code for simple data like sunrise and sunset times at the end of this month??

All the info I have seen states that everyone looses API access unless they agree to a contract of some kind.


#46

hang on… it works. Just tested in python:

[email protected]:~/nodejs/weather$ ./wc_weather.py 
5 mph
[email protected]:~/nodejs/weather$ 


#!/usr/bin/env python3
# 5/21/2018

import urllib.request, requests, json


url=("https://api.weather.gov/gridpoints/TOP/31,80/forecast/hourly")

response = urllib.request.urlopen(url)
data = json.loads(response.read().decode('utf-8'))

windspeed = (data['properties']['periods'][0]['windSpeed'])

print(windspeed)

#47

I give up… I can make it work in python, but not in WC… Tried it 50 different ways.


#48

What result are you getting in WC? Maybe post the piston that gives the best you’ve got so far, and I can have a look…


#49

I can pull the initial data into $response, but any attempt to drill-down into $response fails and errors out.

12/7/2018, 9:33:21 AM +324ms
+1ms ╔Received event [Home].test = 1544193201322 with a delay of 2ms
+120ms ║RunTime Analysis CS > 39ms > PS > 60ms > PE > 20ms > CE
+123ms ║Runtime (37166 bytes) successfully initialized in 60ms (v0.3.108.20180906) (120ms)
+125ms ║╔Execution stage started
+132ms ║║Cancelling statement #1's schedules...
+148ms ║║Sending external web request to: api.weather.gov/gridpoints/TOP/31,80/forecast/hourly
+270ms ║║Executed virtual command httpRequest (123ms)
+287ms ║║{
+287ms ║║ "@context":
+287ms ║║ "https://raw.githubusercontent.com/geojson/geojson-ld/master/contexts/geojson-base.jsonld",
+287ms ║║ {
+287ms ║║ "wx": "https://api.weather.gov/ontology#",
+287ms ║║ "geo": "http://www.opengis.net/ont/geosparql#",
+288ms ║║ "unit": "http://codes.wmo.int/common/unit/",
+288ms ║║ "@vocab": "https://api.weather.gov/ontology#"
+288ms ║║ }
+288ms ║║
+290ms ║║ "type": "Feature",
+290ms ║║ "geometry": {
+290ms ║║ "type": "GeometryCollection",
+291ms ║║ "geometries":
+291ms ║║ {
+291ms ║║ "type": "Point",
+291ms ║║ "coordinates":
+291ms ║║ -97.094408400000006,
+292ms ║║ 39.7559738
+292ms ║║
+292ms ║║ },
+292ms ║║ {
+292ms ║║ "type": "Polygon",
+293ms ║║ "coordinates":
+293ms ║║
+293ms ║║
+293ms ║║ -97.1089731,
+293ms ║║ 39.766826299999998
+294ms ║║
+294ms ║║
+294ms ║║ -97.108526900000001,
+294ms ║║ 39.74477879...[TRUNCATED]
+296ms ║║Executed virtual command log (17ms)
+302ms ║╚Execution stage complete. (177ms)
+304ms ╚Event processed successfully (304ms)

#50

So accuweather.com offers an API with 50 calls per day. I’m able to grab the daily forecasted windspeed using the following piston. I’m guessing it’s just an average windspeed for the day.

I blurred out my API key and location:

You can see in the logs it pulls “6.9” for the current forecast windspeed value.


#51

You can also pull the windspeed from the Accuweather device.


#52

If they change that forecast on a regular basis throughout the day, that would work.

My purpose here is to utilize this in conjunction with external temps plus one ecobee to determine the program running on another ecobee. My upstairs ecobee only runs an air conditioner zone in summer but the downstairs ecobee does whole-house heating. Of course being an old house the forced air does not come upstairs so well. So upstairs is always cooler than downstairs during winter.

Where does wind speed come in?
When it’s 25 degrees and the wind is blowing 20mph, the apprent temp on the upstairs ecobee is not exactly reflective of the comfort level in the upstairs rooms. If it says 66 on the thermostat, the radiant loss plus wind leakage makes those rooms feel far cooler than if it’s 45 degrees with light winds with the same thermostat reading.

I guess it would make sense for me to track that forecast hourly, to see if it does indeed change throughout the day. If it does then it will be useful.


#53

You could pull current conditions for wind forecast, which should change regularly

http://dataservice.accuweather.com/currentconditions/v1/{location_code}?apikey={api_key}&details=true

$response.Wind.Speed.Imperial.Value

You could take that and dump it to a fuel stream every hour to see if it’ll work for you.


#54

The accuweather app data does update multiple times throughout the day.
So it will suffice. Thanks for all the effort and ideas… this place is great.