PiClock
PiClock copied to clipboard
Darksky API Replacement
After a bunch of research carried out by the great people helping with this project, a new provider has been selected, as pointed out in this issue comment:
https://github.com/n0bel/PiClock/issues/179#issuecomment-622951747
We'll have a new version soon.
Some of us are impatient. Any idea how soon, soon is? :-)
The climacell API is different, in that you have to add fields to the query. You also need to pass the cc api key as a http header. The JSON return is pretty easy to parse.
async function currentCcObs(){
var url = 'https://api.climacell.co/v3/weather/realtime?lat=' + settings.lat + '&lon=' + settings.lon + '&unit_system=us&fields=temp%2Cfeels_like%2Chumidity%2Cwind_speed%2Cmoon_phase%2Cweather_code%2Csunrise%2Csunset%2Cwind_direction%2Cbaro_pressure'
logger.info(url);
var { body } = await getPromise({
url: url,
json: true,
headers: {'User-Agent': 'piclockjs',
'apikey' : settings.ccAppId,
'accept' : 'application/json'
}
});
parseCC(body);
}
Did you take a look at https://openweathermap.org/?
Open weather is sadly unreliable, with data being up to 2 hrs stale, and sequential polls have regressive time stamps. I kept it in my code, but found that I had to protect from differing time stamps too much. Essentially, the lowest you can poll OW reliably is about once every 10 mins. Even without the timestamp issues, the data is laggy at best. Third column is behind now():
2020-06-18 08:12:38 PM -0400 info: openweather : 74.44 : 5 : Clouds 2020-06-18 08:12:38 PM -0400 info: darksky : 73.64 : 0 : Partly Cloudy 2020-06-18 08:12:38 PM -0400 info: climacell : 74.19 : 0 : cloudy
I did try to jump onto your fork but im a total amatuer and its melting my brain.
I guess I am waiting for this one to update :(
What about weather.gov? https://www.weather.gov/documentation/services-web-api?prevfmt=application%2Fcap%2Bxml&prevopt=id%3DNWS-IDP-PROD-3090928
root@HLAB-A17:/mnt/c/Users/adamo# curl -H "User-Agent: [email protected]" https://api.weather.gov/gridpoints/TOP/31,80/forecast
{
"@context": [
"https://geojson.org/geojson-ld/geojson-context.jsonld",
{
"@version": "1.1",
"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": "Polygon",
"coordinates": [
[
[
-97.1089731,
39.766826299999998
],
[
-97.108526900000001,
39.744778799999999
],
[
-97.079846700000004,
39.745119500000001
],
[
-97.08028680000001,
39.767167000000001
],
[
-97.1089731,
39.766826299999998
]
]
]
},
"properties": {
"updated": "2020-08-02T15:26:01+00:00",
"units": "us",
"forecastGenerator": "BaselineForecastGenerator",
"generatedAt": "2020-08-02T15:58:22+00:00",
"updateTime": "2020-08-02T15:26:01+00:00",
"validTimes": "2020-08-02T09:00:00+00:00/P7DT16H",
"elevation": {
"value": 441.95999999999998,
"unitCode": "unit:m"
},
"periods": [
{
"number": 1,
"name": "Today",
"startTime": "2020-08-02T10:00:00-05:00",
"endTime": "2020-08-02T18:00:00-05:00",
"isDaytime": true,
"temperature": 78,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "10 to 15 mph",
"windDirection": "N",
"icon": "https://api.weather.gov/icons/land/day/few?size=medium",
"shortForecast": "Sunny",
"detailedForecast": "Sunny, with a high near 78. North wind 10 to 15 mph, with gusts as high as 20 mph."
},
{
"number": 2,
"name": "Tonight",
"startTime": "2020-08-02T18:00:00-05:00",
"endTime": "2020-08-03T06:00:00-05:00",
"isDaytime": false,
"temperature": 56,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "5 to 10 mph",
"windDirection": "N",
"icon": "https://api.weather.gov/icons/land/night/few?size=medium",
"shortForecast": "Mostly Clear",
"detailedForecast": "Mostly clear, with a low around 56. North wind 5 to 10 mph."
},
{
"number": 3,
"name": "Monday",
"startTime": "2020-08-03T06:00:00-05:00",
"endTime": "2020-08-03T18:00:00-05:00",
"isDaytime": true,
"temperature": 77,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "5 mph",
"windDirection": "NE",
"icon": "https://api.weather.gov/icons/land/day/few?size=medium",
"shortForecast": "Sunny",
"detailedForecast": "Sunny, with a high near 77. Northeast wind around 5 mph."
},
{
"number": 4,
"name": "Monday Night",
"startTime": "2020-08-03T18:00:00-05:00",
"endTime": "2020-08-04T06:00:00-05:00",
"isDaytime": false,
"temperature": 54,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "0 to 5 mph",
"windDirection": "E",
"icon": "https://api.weather.gov/icons/land/night/few?size=medium",
"shortForecast": "Mostly Clear",
"detailedForecast": "Mostly clear, with a low around 54. East wind 0 to 5 mph."
},
{
"number": 5,
"name": "Tuesday",
"startTime": "2020-08-04T06:00:00-05:00",
"endTime": "2020-08-04T18:00:00-05:00",
"isDaytime": true,
"temperature": 76,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "0 to 5 mph",
"windDirection": "SE",
"icon": "https://api.weather.gov/icons/land/day/sct?size=medium",
"shortForecast": "Mostly Sunny",
"detailedForecast": "Mostly sunny, with a high near 76. Southeast wind 0 to 5 mph."
},
{
"number": 6,
"name": "Tuesday Night",
"startTime": "2020-08-04T18:00:00-05:00",
"endTime": "2020-08-05T06:00:00-05:00",
"isDaytime": false,
"temperature": 59,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "5 mph",
"windDirection": "SE",
"icon": "https://api.weather.gov/icons/land/night/bkn/tsra_hi,20?size=medium",
"shortForecast": "Mostly Cloudy then Slight Chance Showers And Thunderstorms",
"detailedForecast": "A slight chance of showers and thunderstorms after 1am. Mostly cloudy, with a low around 59. Southeast wind around 5 mph. Chance of precipitation is 20%."
},
{
"number": 7,
"name": "Wednesday",
"startTime": "2020-08-05T06:00:00-05:00",
"endTime": "2020-08-05T18:00:00-05:00",
"isDaytime": true,
"temperature": 78,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "5 to 10 mph",
"windDirection": "S",
"icon": "https://api.weather.gov/icons/land/day/tsra_hi,30?size=medium",
"shortForecast": "Chance Showers And Thunderstorms",
"detailedForecast": "A chance of showers and thunderstorms before 1pm. Partly sunny, with a high near 78. South wind 5 to 10 mph. Chance of precipitation is 30%."
},
{
"number": 8,
"name": "Wednesday Night",
"startTime": "2020-08-05T18:00:00-05:00",
"endTime": "2020-08-06T06:00:00-05:00",
"isDaytime": false,
"temperature": 62,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "5 mph",
"windDirection": "SE",
"icon": "https://api.weather.gov/icons/land/night/sct/tsra_hi,30?size=medium",
"shortForecast": "Partly Cloudy then Chance Showers And Thunderstorms",
"detailedForecast": "A chance of showers and thunderstorms after 1am. Partly cloudy, with a low around 62. Southeast wind around 5 mph. Chance of precipitation is 30%."
},
{
"number": 9,
"name": "Thursday",
"startTime": "2020-08-06T06:00:00-05:00",
"endTime": "2020-08-06T18:00:00-05:00",
"isDaytime": true,
"temperature": 84,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "5 mph",
"windDirection": "S",
"icon": "https://api.weather.gov/icons/land/day/tsra_hi,30/tsra_hi,20?size=medium",
"shortForecast": "Chance Showers And Thunderstorms",
"detailedForecast": "A chance of showers and thunderstorms before 1pm. Mostly sunny, with a high near 84. South wind around 5 mph. Chance of precipitation is 30%."
},
{
"number": 10,
"name": "Thursday Night",
"startTime": "2020-08-06T18:00:00-05:00",
"endTime": "2020-08-07T06:00:00-05:00",
"isDaytime": false,
"temperature": 68,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "5 mph",
"windDirection": "SE",
"icon": "https://api.weather.gov/icons/land/night/sct/tsra_hi,30?size=medium",
"shortForecast": "Partly Cloudy then Chance Showers And Thunderstorms",
"detailedForecast": "A chance of showers and thunderstorms after 1am. Partly cloudy, with a low around 68. Chance of precipitation is 30%."
},
{
"number": 11,
"name": "Friday",
"startTime": "2020-08-07T06:00:00-05:00",
"endTime": "2020-08-07T18:00:00-05:00",
"isDaytime": true,
"temperature": 85,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "5 to 10 mph",
"windDirection": "SE",
"icon": "https://api.weather.gov/icons/land/day/tsra_hi,30?size=medium",
"shortForecast": "Chance Showers And Thunderstorms",
"detailedForecast": "A chance of showers and thunderstorms. Mostly sunny, with a high near 85. Chance of precipitation is 30%."
},
{
"number": 12,
"name": "Friday Night",
"startTime": "2020-08-07T18:00:00-05:00",
"endTime": "2020-08-08T06:00:00-05:00",
"isDaytime": false,
"temperature": 70,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "5 to 10 mph",
"windDirection": "S",
"icon": "https://api.weather.gov/icons/land/night/tsra_hi,30/tsra_hi,40?size=medium",
"shortForecast": "Chance Showers And Thunderstorms",
"detailedForecast": "A chance of showers and thunderstorms. Partly cloudy, with a low around 70. Chance of precipitation is 40%."
},
{
"number": 13,
"name": "Saturday",
"startTime": "2020-08-08T06:00:00-05:00",
"endTime": "2020-08-08T18:00:00-05:00",
"isDaytime": true,
"temperature": 87,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "5 to 10 mph",
"windDirection": "S",
"icon": "https://api.weather.gov/icons/land/day/tsra_hi,40/tsra_hi,20?size=medium",
"shortForecast": "Chance Showers And Thunderstorms",
"detailedForecast": "A chance of showers and thunderstorms. Mostly sunny, with a high near 87. Chance of precipitation is 40%."
},
{
"number": 14,
"name": "Saturday Night",
"startTime": "2020-08-08T18:00:00-05:00",
"endTime": "2020-08-09T06:00:00-05:00",
"isDaytime": false,
"temperature": 70,
"temperatureUnit": "F",
"temperatureTrend": null,
"windSpeed": "5 mph",
"windDirection": "S",
"icon": "https://api.weather.gov/icons/land/night/tsra_hi,30?size=medium",
"shortForecast": "Chance Showers And Thunderstorms",
"detailedForecast": "A chance of showers and thunderstorms. Mostly clear, with a low around 70. Chance of precipitation is 30%."
}
]
}
}
OpenWeather API switching guide https://openweathermap.org/darksky-openweather#match
I did do a quick and dirty fix to switch to openweathermap.org in my fork. Steve
I switched to https://github.com/merky1/PiClock because of far more activity.
Keep in mind that my fork forgoes the python aspect, and is managed by a madman...
Has this project died?
If you need an immediate response, my fork is fully operational for the United States. It uses nodejs, so it’s a complete rebuild of the pi, and my forks manager has a bad habit of testing updates in the main branch. Also, my documentation is poor, so it’s really not ready for human use. I have not gotten around to doc‘ing the settings file. That and I’m tied to the US NOAA for forecasting and radar which makes things very US specific.
If your brave: https://github.com/merky1/PiClock
If you have the PiClock up and running today, I’d say stay until the darksky api turns off. Hopefully there’s enough smart people here to fix that issue.
I vouch for @merky1 repo. I switched and am using it just fine. The settings needs documentation. But everything works. Feel free to contribute, I did a bit.
If you prefer to stick with python my fork implements openweathermap. Just put your owm key on config and follow the standard install directions.
During a discussion in #179, the choice of a new provider was decided. Since then I've been testing that and a few others. That was 2 months ago. My available time has been limited. I've been busy with work, more so than ever before. While that's good news in one respect, my other projects suffer of course. I was also hoping that one of the great followers of this project might take on the changes. This hasn't happened either. Since I have many of these PiClocks running for my friends and family, I will be forced to update it before the API expires in 2021. So, no, its not dead, but progress has been slow.
Good morning Kevin, and the rest of the great peeps following. I wish I could do more, but alas, I am not a developer. I just wanted to state that I appreciate the time that you and others have taken to get the new solution going.
I fully agree. Thanks @n0bel for all your work.
Yes, the PiClock is a fixed asset in my LEGO room ;-)
@n0bel I am in no way a solid programmer (well solid al right, but . . . ) I am willing to contribute but it would be wise to hand me small parts at a time. If there are tasks like that, you can always ask and indicate me how/where! So I could create pull requset(s).
Thanks for the so flexible PiClock. EDIT: typo
If your brave: https://github.com/merky1/PiClock
If you have the PiClock up and running today, I’d say stay until the darksky api turns off. Hopefully there’s enough smart people here to fix that issue.
I Apparently got here a month too late, and didn't get a Dark Sky API key. What's the trick to getting yours running?
I like the look of your night mode!. That's basically what I want running 24/7, except using ISO8601 date and time formatting, with seconds, no AM/PM....
You don't.
On Sat, Sep 5, 2020, 17:46 captain [email protected] wrote:
If your brave: https://github.com/merky1/PiClock
If you have the PiClock up and running today, I’d say stay until the darksky api turns off. Hopefully there’s enough smart people here to fix that issue.
I Apparently got here a month too late, and didn't get a Dark Sky API key. What's the trick to getting yours running?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/n0bel/PiClock/issues/185#issuecomment-687667115, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGXRTMYVCRGJFWUETQZYEDSEKWR7ANCNFSM4NRYYIAQ .
Get the N4IK fork I created and get an openweathermap key until the main tree is updated correctly.SteveSent from my Verizon, Samsung Galaxy smartphone -------- Original message --------From: captain [email protected] Date: 9/5/20 5:46 PM (GMT-05:00) To: n0bel/PiClock [email protected] Cc: Steve West-Fisher [email protected], Comment [email protected] Subject: Re: [n0bel/PiClock] Darksky API Replacement (#185)
If your brave: https://github.com/merky1/PiClock
If you have the PiClock up and running today, I’d say stay until the darksky api turns off. Hopefully there’s enough smart people here to fix that issue.
I Apparently got here a month too late, and didn't get a Dark Sky API key. What's the trick to getting yours running?
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.
@captain The trick is my fork is not “compatible” with the original, and I have consistently failed to document the settings file, so it takes a higher level of thought right now, being a niche hobby type project. Being stuck at home hasn’t helped.
Essentially, wipe your pi with the latest raspian, and the follow the instructions in the install.md. The settings.json is pretty straightforward, but there is no documentation around it.
If you want to stay on the python path, then @N4IK is probably the way to go for now. My way leads to ; hades...
Thanks y’all! I got N4IK/PiClock running, figured out how to get weather reports from openweather, but somehow broke python’s ability to use w1thermsensor, which wouldn’tinstall via git but installed fine via apt-get (python -i “import w1thermsensor” claims there is no such file) and I still cannot get dates to display in ISO8601 International Standard format, even when setting locale in Config.py to lt-LT. 😝. I also seem to be missing moon phase information, which is kind of sad. Great work though! Thanks for the ride. I learned a lot. 😄
Openweathermap doesn't have all the same info as dark sky, I just got what I wanted working, hence my previous "quick and dirty" comment. Glad you got it working!SteveSent from my Verizon, Samsung Galaxy smartphone -------- Original message --------From: captain [email protected] Date: 9/7/20 1:02 AM (GMT-05:00) To: n0bel/PiClock [email protected] Cc: Steve West-Fisher [email protected], Mention [email protected] Subject: Re: [n0bel/PiClock] Darksky API Replacement (#185)
Thanks y’all! I got N4IK/PiClock running, figured out how to get weather reports from openweather, but somehow broke python’s ability to use w1thermsensor, which wouldn’tinstall via git but installed fine via apt-get (python -i “import w1thermsensor” claims there is no such file) and I still cannot get dates to display in ISO8601 International Standard format, even when setting locale in Config.py to lt-LT. 😝. I also seem to be missing moon phase information, which is kind of sad. Great work though! Thanks for the ride. I learned a lot. 😄
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.
Does the inside thermometer work on yours N4IK? I’ve determined that in TempServer.py, python3 executes “from w1thermsensor import W1ThermSensor” correctly, but then doesn’t work with some of the other calls, while python works with the other calls, but doesn’t parse “from w1thermsensor import W1ThermSensor” correctly. 🤪 (apparently python3 requires quotations around parentheticals statements to print)
I’m really not sure why we are even getting the temperature through this crazy convoluted method of running a Web server just to pass a single number from /sys/bus/w1/devices/[thermometer device number]/w1_slave I would just tail -1 that file, then pipe it through cut -c 30- and have a simple number representing degrees Celsius. I’m probably overlooking something here though.
I have an idea for a cool feature, but I’m barely a hacker, not much of a programmer, so it may take me a while. Here’s my idea, in case anyone else wants to tackle it with me: change the close-up weather window to display video from your front door camera! I was hoping to use the eufy api, but the bastards at Anker locked it down this summer with “privacy enhancements“. I’m Looking into finding a way to access the video stream from a Samsung V6431BN.
Sorry Captain, I just now happened to see this. I don't have an inside temperature sensor so I don't know if it would work or not.
Any new updates to the instructions for the installation of the new weather API provider? Thanks!
Any new updates to the instructions for the installation of the new weather API provider? Thanks!
short answer is there are several forks, but Nobel has IRL things taking priority:
https://github.com/n0bel/PiClock/issues/185#issuecomment-683778413
So the options are to dive into a fork, or wait it out.
Thanks for the heads up Merky1.
Hi - I did find this review: https://rapidapi.com/blog/access-global-weather-data-with-these-weather-apis/.
I have not checked it out in detail. My coding skills do not allow me to do anything more useful I am afraid!