[RELEASE] DarkSky.net Weather Driver, no PWS Required

[RELEASE] DarkSky.net Weather Driver
V1.0.0 09/13/2019
IMPORTANT NOTICE:

DarkSky has been acquired by Apple (Apple Acquires Weather App Dark Sky - MacRumors). Before proceeding with this driver make sure you either already have your API Key, or can get one, before they stop issuing those. The API will continue through the end of 2021, then it will not be available and this driver will no longer function.

There has been a lot of requests for a Darksky.net weather driver, especially since the announcement that Weatherstack (formerly known as ApiXU.com) is making significant detrimental changes to the free api. I had driver for those who have their own Personal Weather Station PWS) and use Weather-Display software, so it was not hard to make a version of that driver that uses only DarkSky.net data .... and this driver is just that. No PWS required.

Many people contributed to the code within this driver. Significant contributors include:

In addition to all the cloned code from the Hubitat community, I have heavily modified/created new code myself @Matthew (Scottma61) with lots of help from the Hubitat community. If you believe you should have been acknowledged or received attribution for a code contribution, I will happily do so. While I compiled and orchestrated the driver, very little is actually original work of mine.

Some Notes:
Latitude and Longitude are pulled from the Hub. Make sure your Latitude and Longitude are set properly in your Hub settings. These are used both for the Sunrise/Sunset times and the DarkSky forecast location.

The driver exposes a default set of attributes for weather capabilities:

  • humidity

  • illuminance

  • pressure

  • temperature

  • ultravioletIndex
    Plus a small set of 'Required for Dashboard' attributes (used by SmartTiles/SharpTool.io, and maybe some others)

  • city

  • feelsLike

  • forecastIcon

  • localSunrise

  • localSunset

  • percentPrecip

  • weather

  • weatherIcon

  • weatherIcons

  • wind

  • WindDirection

  • windSpeed

There are many other 'optional' attributes that can be selected if you need those exposed. It is best to keep those off if you do not require them as they will increase the Hub database size if selected. You can turn 'on' the 'Display All Preferences' then hit 'Save Preferences' to expose the optional attributes. Turn on those you want, turn off those you no longer want, then 'Save Preferences' again. You can turn off 'Display All Preferences' then 'Save Preferences' to hide those options and reduce the clutter on the driver display. NOTE: You do NOT have to select the optional attribute to allow those specific attributes to show in either the 'myTile' or 'weatherSummary' attributes (e.g. 'alert' will show in myTile and weatherSummary even if it is not selected). Optional attributes include:

  • alert -- Display any weather alert?
  • betwixt -- Display the 'slice-of-day'?
  • cloud -- Display cloud coverage %?
  • condition_code -- Display 'condition_code'?
  • condition_icon_only -- Display 'condition_code_only'?
  • condition_icon_url -- Display 'condition_code_url'?
  • condition_icon -- Dislay 'condition_icon'?
  • condition_iconWithText -- Display 'condition_iconWithText'?
  • condition_text -- Display 'condition_text'?
  • dewpoint -- Display the dewpoint?
  • fcstHighLow -- Display forecast High/Low temperatures?
    forecast_code -- Displays 'forecast_code'?
    forecast_text -- Displays 'forecast_text'?
  • illuminated -- Display 'illuminated' (with 'lux' added for use on a Dashboard)?
  • is_day -- Display 'is_day'?
  • localSunrise -- Display the Group of 'Time of Local Sunrise and Sunset,' with and without Dashboard text?
  • myTile -- Display 'mytile'?
  • moonPhase -- Display 'moonPhase'?
  • nearestStorm -- Display the neastestStorm data?
    nearestStormBearing -- Display 'nearestStormBearing'?
    nearestStormCardinal -- Display 'nearestStormCardinal'?
    nearestStormDirection -- Display 'nearestStormDirection'?
    nearestStormDistance -- Display 'nearestStormDistance'?
  • ozone -- Display 'ozone'?
  • percentPrecip -- Display the Chance of Rain, in percent?
  • summarymessage -- Display the Weather Summary?
  • precipExtended -- Display precipitation forecast?
  • obspoll -- Display Observation and Poll times?
  • vis -- Display visibility distance?
  • wind_cardinal -- Display the Wind Direction (text initials)?
  • wind_degree -- Display the Wind Direction (number)?
  • wind_direction -- Display the Wind Direction (text words)?
  • wind_gust -- Display the Wind Gust?
  • wind_string -- Display the wind string?
24 Likes

Tried this out but got the following error, not sure if I did something wrong?

Thanks!

I just updated the code to allow for a null value (that didn't show in my testing). I did NOT increment the version for this. Re-copy the code and let me know if you still get errors.

Hi @Matthew
Just trying this driver and I'm getting some strange readings.
image
Do you need me to show the settings I'm using?

This time I get values for current states, but a different error:

I see the same if set to C but F appears good.

Thanks @Royski I was just about to try that. Saved me the job.
@Matthew any thoughts? (Besides use F of course. :smile: )

1 Like

I have a LaCrosse weather station here. It has it’s cloud accessible app. (La Crosse View)

Will this work with it ?7C5EC907-9F03-4A27-A56E-CF83636A21F7

I'm getting this on poll
java.lang.NullPointerException: Cannot invoke method toInteger() on null object on line 472 (pollDSHandler)

Thanks for your patience.

Posted V1.0.1 - Bug fixes:

  • Corrected the Metric <--> Imperial conversions.
  • Corrected/applied default values for the 'NearestStorm' attributes. These seem to be oddly populated and not consistent with one another. (e.g. Bearing will show, but there is no distance .... then distance will show but there is no bearing ???) I applied a default bearing of zero; a default cardinal direction of 'U' (for unknown); and a default distance of '9999'.

Let me know what else you find and I will correct as quicky as I can.

3 Likes

Trust me, you've no need to worry about our patience. (From me anyway).
You are doing us all a favour.
Thanks again.

EDIT: Sorted the conversion issue.
Thanks again.

3 Likes

No. This driver pulls all data from DarkSky.net. It will not interact with your weather station.

If you use Weather-Display software with your weather station you can use this:

Still getting the same error I posted here:

Ok, thank you so much for your reply.

I moved one line of code just now. Recopy and let me know if you still get the error. If you do, turn OFF the 'nearestStormBearing' selection and let me know if that prevents the error.

Thanks.

Error is still persisting regardless of "nearestStormBearing" setting.

I'm getting this each time I try to poll data:

groovy.lang.MissingMethodException: No signature of method: user_driver_Matthew_DarkSky_net_Weather_Driver_622.updateDataValue() is applicable for argument types: (java.lang.String, java.math.BigDecimal) values: [wind, 17.2] on line 234 (pollDSHandler)

GREAT driver BTW!

@Matthew
Thank you very much for creating this driver.
:blush:

1 Like

Bug on line 234 squashed. Recopy code and try again. Report back.

@halfrican.ak made another change to try to prevent this error. Try again. Report back.

Thanks.

One down, another one to go:
Getting this now:

groovy.lang.MissingMethodException: No signature of method: user_driver_Matthew_DarkSky_net_Weather_Driver_622.updateDataValue() is applicable for argument types: (java.lang.String, java.math.BigDecimal) values: [nearestStormDistance, 78.9] on line 315 (pollDSHandler)