DJAkbar / cloudy-a

A simple script for light animations for two LED strips according to the weather forecast
33 stars 9 forks source link

Dark Sky #5

Open wizzard419 opened 5 years ago

wizzard419 commented 5 years ago

Hi, sorry if I am going at this the wrong way, I am new to GitHub Dark Sky was the suggested new API over weather underground.

Should my call look like myweather = json.load(urllib2.urlopen('https://api.darksky.net/forecast/' + darksky_api + '/forecast/' + location))

Also, I have might controls set up, but want to use a single strip (smaller sized cloud) and wanted to also make use of the white light in my strip. Do you have any tips?

stubs commented 5 years ago

Hey @wizzard419. You can totally use the dark sky api, but you'd have to re-write the python code parsing out the weather conditions. The json schema from dark sky doesn't match what you'd get from weather underground.

Also with the dark sky api you need to provide both the latitude and longitude of the location you seeking weather data from. So you couldn't use a simple string for your location anymore (like on line 6. location = ""

wizzard419 commented 5 years ago

Thanks @stubs! By any chance do you have a way to make this work? I sadly do not have the exp but if you have working code I would gladly compensate. We can discuss this on another venue if needed.

stubs commented 5 years ago

@wizzard419

No compensation needed. I have a fork of @DJAkbar's repo over here. It is set up to use the dark sky api. https://github.com/stubs/cloudy-a

wizzard419 commented 5 years ago

That is awesome, thank you! I hit a wall when starting on this due to the API going away.

One last question, I have mine set up for single strip but using RGBW. Do I just need to update my entries for the pins and add values for the various scenarios, or is more involved?

stubs commented 5 years ago

I think you'd only need the RGB (not the W). The gpiozero python package doesn't seem to have support for the "W"....but i didn't even remotely do a deep dive into the docs.

From https://gpiozero.readthedocs.io/en/stable/api_output.html#rgbled

image

If white was still needed you could simply set the color param to (1,1,1)

wizzard419 commented 5 years ago

Oh interesting, I will toy around next weekend to see if I can find a way. Either way this is awesome, thank you again for resurrecting the project.