www.homeseer.com    
 

Go Back   HomeSeer Message Board > Weather Plug-ins > Weather Discussion

Reply
 
Thread Tools Display Modes
  #1  
Old December 8th, 2016, 10:50 AM
ScottRennie ScottRennie is offline
Seer Deluxe
 
Join Date: Apr 2012
Location: Aberdeen
Posts: 383
Dark Sky API

Are there any plugs ins using the Dark Sky API? (https://darksky.net/dev/)

Jeff - Could it be added to WeatherXML?

Cheers
Scott
Reply With Quote
  #2  
Old December 8th, 2016, 01:14 PM
mrhappy mrhappy is offline
OverSeer
 
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,029
If you don't get any luck then it would appear to be fairly easy to get going with just a script, one of the JSON scripts knocking around could probably be modified fairly easily.
Reply With Quote
  #3  
Old December 9th, 2016, 03:44 AM
ScottRennie ScottRennie is offline
Seer Deluxe
 
Join Date: Apr 2012
Location: Aberdeen
Posts: 383
Quote:
Originally Posted by mrhappy View Post
If you don't get any luck then it would appear to be fairly easy to get going with just a script, one of the JSON scripts knocking around could probably be modified fairly easily.
I'm going to have a crack at that this afternoon - I'm going to look at Jon00's scraper app first, faiiling that I'll knock up a script.
Reply With Quote
  #4  
Old December 9th, 2016, 03:29 PM
mrhappy mrhappy is offline
OverSeer
 
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,029
This is a start if you get stuck...unfortunately I have a number of other plugins on the go at the minute so I wouldn't be up for making it into a plugin myself. This will get the basic 'currently' data from the API and put it in the log, anything more complex would need the JSON structures expanding.

Code:
Imports System.Web.Script.Serialization

Dim secret_key As String = "af4f2bb899888d0db"
Dim json As New JavaScriptSerializer
Dim LT as string = "DarkSky Script"
Dim LatLong As String = "" 'leave blank to use HS lat/long data

Sub Main(ByVal Parms As Object)

    Try
        If LatLong = "" then LatLong = Convert.ToDecimal(hs.getinisetting("Settings","gLatitude","37.8267")) & "," & Convert.ToDecimal(hs.getinisetting("Settings","gLongitude","-122.4233") * -1)
        Dim DataRaw As String = hs.GetURL("https://api.darksky.net/", "forecast/" & secret_key & "/" & LatLong, true, 80)
        Dim DSData As rdata = json.Deserialize(Of rdata)(DataRaw)

        hs.writelog(LT, "Current Summary: " & DSData.currently.summary)
        hs.writelog(LT, "Current Temperature: " & DSData.currently.temperature)
        hs.writelog(LT, "Current Humidity: " & DSData.currently.humidity)
        hs.writelog(LT, "Current Visibility: " & DSData.currently.visibility)
		
    Catch ex As Exception
        hs.writelog(LT, "Exception: " & ex.message.tostring)
    End Try

End Sub

Public Class rdata
    Public Property latitude As double
    Public Property longitude As double

	Public Property currently As currentdata
End Class

Public Class currentdata
	Public Property time As String
    Public Property summary As String
    Public Property icon As String
    Public Property nearestStormDistance As integer
    Public Property nearestStormBearing As integer
    Public Property precipIntensity As integer
    Public Property precipProbability As integer
    Public Property temperature As decimal
    Public Property apparentTemperature As decimal
    Public Property dewPoint As decimal
    Public Property humidity As decimal
    Public Property windSpeed As decimal
    Public Property windBearing As decimal
    Public Property visibility As decimal
    Public Property cloudCover As decimal
    Public Property pressure As decimal
    Public Property ozone As decimal
End Class
You just need to change the API key to your own.
Reply With Quote
  #5  
Old January 29th, 2017, 05:50 PM
teladog01 teladog01 is offline
Seer Deluxe
 
Join Date: Feb 2010
Location: MO
Posts: 213
Was just wondering if anyone has done anything to expand on this? I'd definitely be interested in a full weather plugin that uses the Dark Sky API...
Reply With Quote
  #6  
Old January 29th, 2017, 06:49 PM
mrhappy mrhappy is offline
OverSeer
 
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,029
Quote:
Originally Posted by teladog01 View Post
Was just wondering if anyone has done anything to expand on this? I'd definitely be interested in a full weather plugin that uses the Dark Sky API...
Not me personally weather plugins ain't been really my thing (I can never be bothered to find the icons) I can't see a need for a plugin myself because it could be done all from a script just would need to write to a device rather than the log.
Reply With Quote
  #7  
Old February 5th, 2017, 01:06 PM
Ultrajones's Avatar
Ultrajones Ultrajones is online now
OverSeer
 
Join Date: Jan 2001
Location: Michigan, US
Posts: 5,523
Quote:
Originally Posted by teladog01 View Post
Was just wondering if anyone has done anything to expand on this? I'd definitely be interested in a full weather plugin that uses the Dark Sky API...
I created a plug-in a while ago to support the Dark Sky API. I never released it because the Dark Sky does not allow free use of their API. The only way I could have released it is to set an expire timeframe after activation (e.g. 5 years). I decided not to release it because there was no way for me to prevent abuse of the Dark Sky API using my API key.

Regards,
Ultrajones
__________________
Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR
Reply With Quote
  #8  
Old February 8th, 2017, 08:26 PM
teladog01 teladog01 is offline
Seer Deluxe
 
Join Date: Feb 2010
Location: MO
Posts: 213
Quote:
Originally Posted by mrhappy View Post
This is a start if you get stuck...unfortunately I have a number of other plugins on the go at the minute so I wouldn't be up for making it into a plugin myself. This will get the basic 'currently' data from the API and put it in the log, anything more complex would need the JSON structures expanding.
Just wanted to say thanks to mrhappy for posting the Dark Sky starter script. I've expanded upon it and made changes to suit my needs and it seems to be working great.

Thanks!
Reply With Quote
  #9  
Old November 2nd, 2017, 08:02 AM
frankc's Avatar
frankc frankc is offline
Seer Deluxe
 
Join Date: Jan 2009
Location: Kansas, USA
Posts: 301
Quote:
Originally Posted by teladog01 View Post
I've expanded upon it and made changes to suit my needs and it seems to be working great.
I'd like to see how you ended up deserializing the forecasted dark sky data in vb.net and assigning variables to the data.

I've been working on this and haven't got it working right yet.

Thanks!
__________________
HS3, CM15A, Win10, Sprinklers w /ET, Concord Security , CallerID, tenScripting3, TextSeer, tenHsServer, tenScriptAid, Jon00ImageBuilder, Jon00LogMonitor
Reply With Quote
  #10  
Old November 2nd, 2017, 10:28 PM
teladog01 teladog01 is offline
Seer Deluxe
 
Join Date: Feb 2010
Location: MO
Posts: 213
Quote:
Originally Posted by frankc View Post
I'd like to see how you ended up deserializing the forecasted dark sky data in vb.net and assigning variables to the data.

I've been working on this and haven't got it working right yet.

Thanks!
Here's my script. It's made to be able to fetch data for multiple locations by specifying some parameters when the script is run. The parameters are pretty well commented in the script, but I'll admit I haven't tested it with more than a single location, so use at your own risk.

The script does not automatically create any devices, so you will need to manually create the six devices per location as seen in the screenshot below. These are the only six devices I'm really interested in for my use, so that is the only ones implemented. But the framework is there to add many more devices that correspond to the data returned by the Dark Sky API.

You will need to edit the "secretKey" constant at top of the script, and there are four other constants right below it that you can edit as you see fit to suit your HS3 environment.

Many thanks to @mrhappy for posting the example earlier in this thread, which my script is heavily based upon.
Attached Images
 
Attached Files
File Type: zip neDarkSky-v1.1.zip (447.3 KB, 6 views)

Last edited by teladog01; November 2nd, 2017 at 10:57 PM.
Reply With Quote
  #11  
Old November 2nd, 2017, 10:34 PM
teladog01 teladog01 is offline
Seer Deluxe
 
Join Date: Feb 2010
Location: MO
Posts: 213
Here's some screenshots of the device configs...
Attached Images
     
Reply With Quote
  #12  
Old November 2nd, 2017, 10:35 PM
teladog01 teladog01 is offline
Seer Deluxe
 
Join Date: Feb 2010
Location: MO
Posts: 213
more screenshots...
Attached Images
   
Reply With Quote
  #13  
Old November 2nd, 2017, 10:46 PM
frankc's Avatar
frankc frankc is offline
Seer Deluxe
 
Join Date: Jan 2009
Location: Kansas, USA
Posts: 301
Quote:
Originally Posted by teladog01 View Post
Here's my script.
Nice!

Great looking icons too.

I'll go ahead and create the six devices and it'll be a done deal.

I'm also working on forecasted data. Not sure what I'll do with it yet. Maybe have to get that into HSTouch stuff.

Thank you!

Frank
Reply With Quote
  #14  
Old November 5th, 2017, 11:23 PM
frankc's Avatar
frankc frankc is offline
Seer Deluxe
 
Join Date: Jan 2009
Location: Kansas, USA
Posts: 301
Data Refresh

I seem to have this working now!

What do you do about refreshing the weather data on the screen?
Reply With Quote
  #15  
Old November 6th, 2017, 12:24 PM
teladog01 teladog01 is offline
Seer Deluxe
 
Join Date: Feb 2010
Location: MO
Posts: 213
Quote:
Originally Posted by frankc View Post
I seem to have this working now!
Awesome! Glad it's working for you. I've borrowed many scripts from this forum so it feels good to be on the other side and give one back

Quote:
What do you do about refreshing the weather data on the screen?
I just run the script periodically with a simple event with a recurring trigger set for every five minutes. That works out to 288 calls per day which is well under the 1000 free calls per day offered by the Dark Sky API.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Has x10.com gone dark? trcobb Lighting & Primary Technology Discussion 40 December 12th, 2013 05:11 PM
Pro-100 Has Gone Dark - Fixed! drpjack PRO-100™ 4 July 11th, 2010 06:04 PM
What determines DARK to HS Kyham HomeSeer General Discussion Area 9 March 29th, 2004 05:52 PM
Is it dark? johnquirk HomeSeer General Discussion Area 18 March 28th, 2004 05:48 PM
Getting Camera Feed in the Dark ralph_lauren General Home Automation Hardware Discussion 21 September 23rd, 2003 05:56 AM


All times are GMT -4. The time now is 05:17 PM.


Copyright HomeSeer Technologies, LLC