[RELEASE] Weather-Display With External Forecast Driver

It is not isInteger(), it is toInteger(). That command converts a text value to it's numeric integer equivalent. (e.q "9" --> 9 ) If the value is null the toInteger() may error out (I don't know)? Maybe try to test the raw data value (without the .toInteger()) and if that is null, set it to 99. Like this:

switch(!wd.everything.forecast.icon.code ? 99 : wd.everything.forecast.icon.code.toInteger()) {

I am not using Weather-Display at all. Meteobridge supports outputting the weather-display "clientraw.txt" file, but obviously not complete. Some of the values end up being "null".

I likely will need to find another option, or write another option based on realtime.txt or something that isn't full of null data. Really, I just want to display current outdoor temp, humidity, etc from my PWS... I don't need a lot of the other data. I should stop trying to shoehorn things to work. =/

That line resulted in the next hiccup:

java.lang.ArrayIndexOutOfBoundsException: 1 on line 452 (updated)

Guessing I'm just going to keep hitting these if we keep on this. =/

Don't worry about it. I'll start hunting for other option, or work on writing my own.

Thanks so much for your help and trying.

Best of luck to you.

@Matthew
thanks but I could not get it to work
maybe I miss-understood but I am just trying to use this driver to only pull weather data from DarkSky
not sure what the purpose for the setting Station Data File Location: *
When we already select the external source and the api key and the location in the preferences.
I suspect this is where I am misunderstanding
Is this only to be used in conjunction with an external weather station?

The old Apixu driver works fine I just wanted to try darksky out.

Do you output to Weewx currently? There’s another driver that might fit what you’re looking for.

So if are your saying you do not have Weather-Display software and that software is not creating a clientraw.txt file that this driver uses as the primary weather data source, then this driver is not for you. The APIXU or DarkSky is only intended to provide supplemental weather forecast information to the current weather conditions supplied by your weather station through Weather-Display. All the basic current weather conditions come from your Weather-Display provided data source, not the external weather forecast source.

Given that, The **Station Data File Location: *** is the location (webserver url) of where the clientraw.txt file resides that Weather-Display creates and updates with the current weather data. The external source and the api key and the location in the preferences refer to your External Forecast source and the forecast location for which you are seeking the weather forecast. I will try to improve the descriptions to make these points clearer.

1 Like

yes I understand now
I thought that it was an option and if we didn't have Weather-Display software as the primary weather data source then it would simply use the data from DarkSky/Apixu
but that is not the case we must have local Weather-Display software running.
and the "Station Data File Location: *" refers to the location of the local Weather-Display software data not the DarkSky/Apixu data.

thank you

Matt,
When I switch back to DarkSky I still get a failure when saving preferences. Then when I select Poll and Forecast, I get a Apixu failure.

Thank you for your time and assistance..

Are you updating your API key each time you switch the forecast source? They each have their own and you must update the API key when switching.

Yes.

And you updated the code to V3.0.1? Toggle the extended logging on and share the errors and I'll see what I can do.

DarkSky is used..

Here is when I save Preferences:

Here is Poll & Forecast:

I can delete and start over.

I'm using V3.0.1

?? It is not receiving the data from either forecast source? When you manually type in (copy & paste) the URLs do you get a JSON return?

in the URLs below replace $apiKey with the appropriate API key for each source and $pollLocationForecast with your latitude,longitude in the URLs below.

https://api.apixu.com/v1/forecast.json?key=$apiKey&q=$pollLocationForecast&days=3

https://api.darksky.net/forecast/$apiKey/$pollLocationForecast?units=us&exclude=minutely,hourly,flags

Both work just fine.

Anixu:

{"location":{"name":"Zumbrota","region":"Minnesota","country":"United States of America","lat":44.3,"lon":-92.68,"tz_id":"America/Chicago","localtime_epoch":1552872155,"localtime":"2019-03-17 20:22"},"current":{"last_updated_epoch":1552871710,"last_updated":"2019-03-17 20:15","temp_c":1.0,"temp_f":33.8,"is_day":0,"condition":{"text":"Overcast","icon":"//cdn.apixu.com/weather/64x64/night/122.png","code":1009},"wind_mph":5.6,"wind_kph":9.0,"wind_degree":250,"wind_dir":"WSW","pressure_mb":1025.0,"pressure_in":30.8,"precip_mm":0.0,"precip_in":0.0,"humidity":80,"cloud":100,"feelslike_c":-1.9,"feelslike_f":28.7,"vis_km":16.0,"vis_miles":9.0,"uv":0.0,"gust_mph":10.7,"gust_kph":17.3},"forecast":{"forecastday":[{"date":"2019-03-17","date_epoch":1552780800,"day":{"maxtemp_c":0.9,"maxtemp_f":33.6,"mintemp_c":-9.1,"mintemp_f":15.6,"avgtemp_c":-4.1,"avgtemp_f":24.7,"maxwind_mph":8.3,"maxwind_kph":13.3,"totalprecip_mm":0.1,"totalprecip_in":0.0,"avgvis_km":19.0,"avgvis_miles":11.0,"avghumidity":93.0,"condition":{"text":"Light snow","icon":"//cdn.apixu.com/weather/64x64/day/326.png","code":1213},"uv":3.2},"astro":{"sunrise":"07:20 AM","sunset":"07:19 PM","moonrise":"03:13 PM","moonset":"05:27 AM"}},{"date":"2019-03-18","date_epoch":1552867200,"day":{"maxtemp_c":1.1,"maxtemp_f":34.0,"mintemp_c":-5.1,"mintemp_f":22.8,"avgtemp_c":-2.3,"avgtemp_f":27.8,"maxwind_mph":8.9,"maxwind_kph":14.4,"totalprecip_mm":0.3,"totalprecip_in":0.01,"avgvis_km":19.3,"avgvis_miles":12.0,"avghumidity":87.0,"condition":{"text":"Mist","icon":"//cdn.apixu.com/weather/64x64/day/143.png","code":1030},"uv":3.8},"astro":{"sunrise":"07:18 AM","sunset":"07:21 PM","moonrise":"04:29 PM","moonset":"06:11 AM"}},{"date":"2019-03-19","date_epoch":1552953600,"day":{"maxtemp_c":7.3,"maxtemp_f":45.1,"mintemp_c":-3.3,"mintemp_f":26.1,"avgtemp_c":0.8,"avgtemp_f":33.5,"maxwind_mph":9.2,"maxwind_kph":14.8,"totalprecip_mm":0.0,"totalprecip_in":0.0,"avgvis_km":20.0,"avgvis_miles":12.0,"avghumidity":77.0,"condition":{"text":"Partly cloudy","icon":"//cdn.apixu.com/weather/64x64/day/116.png","code":1003},"uv":3.4},"astro":{"sunrise":"07:16 AM","sunset":"07:22 PM","moonrise":"05:47 PM","moonset":"06:50 AM"}}]}}

DarkSky:

{"latitude":44.3021,"longitude":-92.6751,"timezone":"America/Chicago","currently":{"time":1552872058,"summary":"Mostly Cloudy","icon":"partly-cloudy-night","nearestStormDistance":275,"nearestStormBearing":111,"precipIntensity":0,"precipProbability":0,"temperature":34.57,"apparentTemperature":29.23,"dewPoint":27,"humidity":0.74,"pressure":1027.54,"windSpeed":6.09,"windGust":11.17,"windBearing":258,"cloudCover":0.6,"uvIndex":0,"visibility":9.43,"ozone":419.55},"daily":{"summary":"No precipitation throughout the week, with high temperatures rising to 58°F on Saturday.","icon":"clear-day","data":[{"time":1552798800,"summary":"Mostly cloudy throughout the day.","icon":"partly-cloudy-day","sunriseTime":1552825237,"sunsetTime":1552868402,"moonPhase":0.38,"precipIntensity":0.0001,"precipIntensityMax":0.0009,"precipIntensityMaxTime":1552867200,"precipProbability":0.42,"precipAccumulation":0.018,"precipType":"snow","temperatureHigh":38.14,"temperatureHighTime":1552863600,"temperatureLow":23.63,"temperatureLowTime":1552914000,"apparentTemperatureHigh":32.1,"apparentTemperatureHighTime":1552867200,"apparentTemperatureLow":15.22,"apparentTemperatureLowTime":1552910400,"dewPoint":23.66,"humidity":0.83,"pressure":1026.73,"windSpeed":6.88,"windGust":15.41,"windGustTime":1552856400,"windBearing":267,"cloudCover":0.66,"uvIndex":2,"uvIndexTime":1552838400,"visibility":8.81,"ozone":407.2,"temperatureMin":18.84,"temperatureMinTime":1552816800,"temperatureMax":38.14,"temperatureMaxTime":1552863600,"apparentTemperatureMin":10.7,"apparentTemperatureMinTime":1552813200,"apparentTemperatureMax":32.1,"apparentTemperatureMaxTime":1552867200},{"time":1552885200,"summary":"Mostly cloudy throughout the day.","icon":"partly-cloudy-day","sunriseTime":1552911526,"sunsetTime":1552954876,"moonPhase":0.41,"precipIntensity":0.0004,"precipIntensityMax":0.0016,"precipIntensityMaxTime":1552896000,"precipProbability":0.22,"precipAccumulation":0.097,"precipType":"snow","temperatureHigh":35.79,"temperatureHighTime":1552946400,"temperatureLow":24.7,"temperatureLowTime":1552993200,"apparentTemperatureHigh":28.99,"apparentTemperatureHighTime":1552946400,"apparentTemperatureLow":16.61,"apparentTemperatureLowTime":1552996800,"dewPoint":24.1,"humidity":0.81,"pressure":1029.8,"windSpeed":6.42,"windGust":13.79,"windGustTime":1552903200,"windBearing":266,"cloudCover":0.78,"uvIndex":3,"uvIndexTime":1552932000,"visibility":8.73,"ozone":379.3,"temperatureMin":23.63,"temperatureMinTime":1552914000,"temperatureMax":35.79,"temperatureMaxTime":1552946400,"apparentTemperatureMin":15.22,"apparentTemperatureMinTime":1552910400,"apparentTemperatureMax":28.99,"apparentTemperatureMaxTime":1552946400},{"time":1552971600,"summary":"Mostly cloudy throughout the day.","icon":"partly-cloudy-day","sunriseTime":1552997815,"sunsetTime":1553041350,"moonPhase":0.45,"precipIntensity":0.0001,"precipIntensityMax":0.0003,"precipIntensityMaxTime":1553050800,"precipProbability":0.12,"precipAccumulation":0.015,"precipType":"snow","temperatureHigh":45.24,"temperatureHighTime":1553029200,"temperatureLow":30.36,"temperatureLowTime":1553079600,"apparentTemperatureHigh":40.12,"apparentTemperatureHighTime":1553029200,"apparentTemperatureLow":21.16,"apparentTemperatureLowTime":1553079600,"dewPoint":28.22,"humidity":0.78,"pressure":1027.91,"windSpeed":6.82,"windGust":16.08,"windGustTime":1553054400,"windBearing":216,"cloudCover":0.64,"uvIndex":3,"uvIndexTime":1553014800,"visibility":9.76,"ozone":400.94,"temperatureMin":24.7,"temperatureMinTime":1552993200,"temperatureMax":45.24,"temperatureMaxTime":1553029200,"apparentTemperatureMin":16.61,"apparentTemperatureMinTime":1552996800,"apparentTemperatureMax":40.12,"apparentTemperatureMaxTime":1553029200},{"time":1553058000,"summary":"Mostly cloudy throughout the day.","icon":"partly-cloudy-day","sunriseTime":1553084104,"sunsetTime":1553127824,"moonPhase":0.48,"precipIntensity":0.0002,"precipIntensityMax":0.0004,"precipIntensityMaxTime":1553115600,"precipProbability":0.18,"precipAccumulation":0.016,"precipType":"snow","temperatureHigh":41.82,"temperatureHighTime":1553115600,"temperatureLow":29.22,"temperatureLowTime":1553169600,"apparentTemperatureHigh":34.45,"apparentTemperatureHighTime":1553115600,"apparentTemperatureLow":21.96,"apparentTemperatureLowTime":1553169600,"dewPoint":29.78,"humidity":0.8,"pressure":1023.25,"windSpeed":9.15,"windGust":22.89,"windGustTime":1553094000,"windBearing":282,"cloudCover":0.77,"uvIndex":3,"uvIndexTime":1553101200,"visibility":10,"ozone":387.3,"temperatureMin":30.36,"temperatureMinTime":1553079600,"temperatureMax":41.82,"temperatureMaxTime":1553115600,"apparentTemperatureMin":21.16,"apparentTemperatureMinTime":1553079600,"apparentTemperatureMax":34.45,"apparentTemperatureMaxTime":1553115600},{"time":1553144400,"summary":"Partly cloudy in the morning.","icon":"partly-cloudy-night","sunriseTime":1553170393,"sunsetTime":1553214298,"moonPhase":0.53,"precipIntensity":0,"precipIntensityMax":0.0002,"precipIntensityMaxTime":1553148000,"precipProbability":0,"temperatureHigh":46.13,"temperatureHighTime":1553202000,"temperatureLow":28.18,"temperatureLowTime":1553245200,"apparentTemperatureHigh":41.37,"apparentTemperatureHighTime":1553202000,"apparentTemperatureLow":24.29,"apparentTemperatureLowTime":1553241600,"dewPoint":30.67,"humidity":0.79,"pressure":1023.44,"windSpeed":7.44,"windGust":17.97,"windGustTime":1553202000,"windBearing":290,"cloudCover":0.39,"uvIndex":4,"uvIndexTime":1553191200,"visibility":10,"ozone":375.38,"temperatureMin":29.22,"temperatureMinTime":1553169600,"temperatureMax":46.13,"temperatureMaxTime":1553202000,"apparentTemperatureMin":21.96,"apparentTemperatureMinTime":1553169600,"apparentTemperatureMax":41.37,"apparentTemperatureMaxTime":1553202000},{"time":1553230800,"summary":"Mostly cloudy starting in the afternoon.","icon":"partly-cloudy-night","sunriseTime":1553256682,"sunsetTime":1553300772,"moonPhase":0.57,"precipIntensity":0.0001,"precipIntensityMax":0.0002,"precipIntensityMaxTime":1553259600,"precipProbability":0.14,"precipType":"rain","temperatureHigh":54.39,"temperatureHighTime":1553288400,"temperatureLow":35.83,"temperatureLowTime":1553328000,"apparentTemperatureHigh":54.39,"apparentTemperatureHighTime":1553288400,"apparentTemperatureLow":29.25,"apparentTemperatureLowTime":1553328000,"dewPoint":31.32,"humidity":0.74,"pressure":1026.89,"windSpeed":3.15,"windGust":9.82,"windGustTime":1553313600,"windBearing":173,"cloudCover":0.23,"uvIndex":4,"uvIndexTime":1553274000,"visibility":10,"ozone":366.22,"temperatureMin":28.18,"temperatureMinTime":1553245200,"temperatureMax":54.39,"temperatureMaxTime":1553288400,"apparentTemperatureMin":24.29,"apparentTemperatureMinTime":1553241600,"apparentTemperatureMax":54.39,"apparentTemperatureMaxTime":1553288400},{"time":1553317200,"summary":"Overcast throughout the day.","icon":"cloudy","sunriseTime":1553342970,"sunsetTime":1553387246,"moonPhase":0.6,"precipIntensity":0.0007,"precipIntensityMax":0.0053,"precipIntensityMaxTime":1553396400,"precipProbability":0.21,"precipType":"rain","temperatureHigh":57.78,"temperatureHighTime":1553371200,"temperatureLow":45.29,"temperatureLowTime":1553428800,"apparentTemperatureHigh":57.78,"apparentTemperatureHighTime":1553371200,"apparentTemperatureLow":40.6,"apparentTemperatureLowTime":1553428800,"dewPoint":37.2,"humidity":0.7,"pressure":1022.06,"windSpeed":10.37,"windGust":27.54,"windGustTime":1553396400,"windBearing":171,"cloudCover":0.92,"uvIndex":3,"uvIndexTime":1553360400,"visibility":9.85,"ozone":348.65,"temperatureMin":35.83,"temperatureMinTime":1553328000,"temperatureMax":57.78,"temperatureMaxTime":1553371200,"apparentTemperatureMin":29.25,"apparentTemperatureMinTime":1553328000,"apparentTemperatureMax":57.78,"apparentTemperatureMaxTime":1553371200},{"time":1553403600,"summary":"Overcast throughout the day.","icon":"cloudy","sunriseTime":1553429259,"sunsetTime":1553473719,"moonPhase":0.63,"precipIntensity":0.0045,"precipIntensityMax":0.025,"precipIntensityMaxTime":1553486400,"precipProbability":0.4,"precipType":"rain","temperatureHigh":54.36,"temperatureHighTime":1553464800,"temperatureLow":43.88,"temperatureLowTime":1553515200,"apparentTemperatureHigh":54.36,"apparentTemperatureHighTime":1553464800,"apparentTemperatureLow":40.91,"apparentTemperatureLowTime":1553515200,"dewPoint":43.55,"humidity":0.8,"pressure":1015.51,"windSpeed":8.31,"windGust":24.94,"windGustTime":1553403600,"windBearing":161,"cloudCover":0.96,"uvIndex":3,"uvIndexTime":1553446800,"visibility":9.97,"ozone":366.43,"temperatureMin":45.29,"temperatureMinTime":1553428800,"temperatureMax":54.36,"temperatureMaxTime":1553464800,"apparentTemperatureMin":40.6,"apparentTemperatureMinTime":1553428800,"apparentTemperatureMax":54.36,"apparentTemperatureMaxTime":1553464800}]},"alerts":[{"title":"Flood Watch","regions":["Goodhue"],"severity":"watch","time":1552837680,"expires":1553010420,"description":"...The National Weather Service in Chanhassen has issued a flood watch for the following rivers in Minnesota... Middle Fork Zumbro River at Pine Island affecting Goodhue County .This flood watch is for potential flooding due to an ice jam that is currently affecting the Middle Fork Zumbro River above Pine Island. If the ice jam breaks, water could rise above flood stage at Pine Island. The National Weather Service will monitor this developing situation and issue follow up statements. The National Weather Service in Chanhassen has issued a * Flood Watch for The Middle Fork Zumbro River at Pine Island * until further notice. * At 10:00 AM Sunday the stage was 15.8 feet. * Minor flooding is possible if the ice jam upstream breaks free. * Forecast...The river will fluctuate near flood stage.\n","uri":"https://alerts.weather.gov/cap/wwacapget.php?x=MN125CECAE91F0.FloodWatch.125CECCD160CMN.MPXFFAMPX.ddef81cf8f6fb02f4a17adbf6056ce7f"}],"offset":-5}

I am still stumped. In the errors you sent earlier the DarkSky is returning a 'Bad Request' error and the APIXU is returning an 'Unauthorized' error. That tells me the APIXU is probably a bad API key (typo?). When you go to the direct URL you are getting a properly formatted JSON return so we have to figure out why you are not getting the same returns in the automated pull.

I just copy and paste.

Download the Hubitat app