Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Darksky API Replacement #185

Closed
n0bel opened this issue Jun 3, 2020 · 176 comments
Closed

Darksky API Replacement #185

n0bel opened this issue Jun 3, 2020 · 176 comments

Comments

@n0bel
Copy link
Owner

n0bel commented Jun 3, 2020

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:

#179 (comment)

We'll have a new version soon.

@lhloftin47
Copy link

Some of us are impatient. Any idea how soon, soon is? :-)

@merky1
Copy link

merky1 commented Jun 20, 2020

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.

Climacell.co

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);
}

@jeder73
Copy link

jeder73 commented Jul 18, 2020

Did you take a look at https://openweathermap.org/?

@merky1
Copy link

merky1 commented Jul 18, 2020

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

@Crowlord
Copy link

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 :(

@adamoutler
Copy link

adamoutler commented Aug 2, 2020

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: aadfasdfasdfasdf@adamoutler.com" 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%."
            }
        ]
    }
}

@adamoutler
Copy link

OpenWeather API switching guide https://openweathermap.org/darksky-openweather#match

@N4IK
Copy link

N4IK commented Aug 5, 2020

I did do a quick and dirty fix to switch to openweathermap.org in my fork.
Steve

@adamoutler
Copy link

I switched to https://github.com/merky1/PiClock because of far more activity.

@merky1
Copy link

merky1 commented Aug 6, 2020

Keep in mind that my fork forgoes the python aspect, and is managed by a madman...

@indymx
Copy link

indymx commented Aug 30, 2020

Has this project died?

@merky1
Copy link

merky1 commented Aug 30, 2020

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.

@adamoutler
Copy link

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.

@N4IK
Copy link

N4IK commented Aug 30, 2020

If you prefer to stick with python my fork implements openweathermap. Just put your owm key on config and follow the standard install directions.

@n0bel
Copy link
Owner Author

n0bel commented Aug 31, 2020

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.

@Knackster
Copy link

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.

@feh123
Copy link

feh123 commented Aug 31, 2020

I fully agree. Thanks @n0bel for all your work.

@BertLindeman
Copy link
Contributor

BertLindeman commented Aug 31, 2020

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

@captain
Copy link

captain commented Sep 5, 2020

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....

@indymx
Copy link

indymx commented Sep 5, 2020 via email

@N4IK
Copy link

N4IK commented Sep 5, 2020 via email

@merky1
Copy link

merky1 commented Sep 7, 2020

@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...

@captain
Copy link

captain commented Sep 7, 2020

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. 😄

@N4IK
Copy link

N4IK commented Sep 7, 2020 via email

@captain
Copy link

captain commented Sep 9, 2020

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.

@n0bel
Copy link
Owner Author

n0bel commented Apr 2, 2023

I've added some additional info on updating very old Raspbian versions to include dateutil and tzlocal. I have one PiClock that's very old (2015?) that gave me a bit of trouble, so I needed to install those packages somewhat manually. pip was unable to download them from the repository because of old SSL issues. Refer to https://github.com/n0bel/PiClock/blob/master/Documentation/Install.md#updating-on-very-old-raspbian-versions as needed. @GrampDamnpus not sure if you'll need this or not.

@n0bel
Copy link
Owner Author

n0bel commented Apr 2, 2023

I've corrected a problem with Tomorrow.io (wind feels like)

@GrampDamnpus
Copy link

I

Thank you so much. Using your and some other help I've been able to get two of my three clocks up and running. The third is much much older, my first one, so this is likely going to help immensely. I'm going to try and get that one going tomorrow.

@feh123
Copy link

feh123 commented Apr 2, 2023

Hi @SerBrynden you are right - I did not copy the basemap to the radars. In visual studio code I did a config.py file comparison and copied over all the missing code from your dark map config.py and it works! All dark clock with great contrast between map and radar. Thanks for all your help.

@ScottChapman
Copy link

ScottChapman commented Apr 2, 2023

Ok ok ok. little slow to the party... So, I updated to latest (ran update script), looked at the code a little and realized that I need a tomorrow.io key, so got one, and created a tioapi entry in my apikeys file.
I noticed that during the upgrade it asked for owm key as well, so I entered mine again.
Still not getting weather, looking at the logs it looks like mine is still trying OWM.

Going to try some more debugging, but is there anything material I might have missed?

I do see this in the logs:
OWM one call failed, switching to weather and forecast

@ScottChapman
Copy link

OK, I think I figured it out. My old OWM account only had the version 2.5 service. I added the new 3.0 subscription and it appears to be working now.

@n0bel
Copy link
Owner Author

n0bel commented Apr 2, 2023

@ScottChapman If you saw tio, your version is a couple days old. The latest code has tmapi not tioapi. Similarly it would have handled your old key for owm as well without going to 3.0.

@ScottChapman
Copy link

OK, so what do I need exactly? is it either tmapi (tomorrow.io) or owmapi (openweathermap.org)? Or do I need both?

And my old key was definately not working until I added the "One Call by Call" base plan to my subscription. I already had the free plan under professional collections

@n0bel
Copy link
Owner Author

n0bel commented Apr 2, 2023

@ScottChapman You need to pull again. Your version is a day or two older. Other than that you can then choose tmapi or owmapi.

@SerBrynden
Copy link
Contributor

@ScottChapman either API should work.

I think the update.py could be updated to ask for either API, as well as updating the API example and Config example files.

@ScottChapman
Copy link

I actually pulled this morning, after reading some of the commits (which is where I saw the key name, but now see the right name).
Yea, the update basically said that it required the OWM key which I think is what got me confused.

All set! And thanks!

@n0bel
Copy link
Owner Author

n0bel commented Apr 2, 2023

Cleaned up ApiKeys-example.py to be up to date with the supported keys and key names. Removed 'Sunny' from code 1000 on tomorrow.io code words (its not sunny at night). Removed the entire DarkSky api.

@n0bel
Copy link
Owner Author

n0bel commented Apr 2, 2023

I think at this point I'd better update the main branch PiClock for python3. I'll have to redo install also for newer OS's, as well as add python3 install and dependencies for older OSs in update instructions.

@SerBrynden
Copy link
Contributor

I think at this point I'd better update the main branch PiClock for python3. I'll have to redo install also for newer OS's, as well as add python3 install and dependencies for older OSs in update instructions.

@n0bel What do you use for code development? For PiClock, I've been using VMware with Ubuntu 22.05 LTS (since it's similar to Raspberry Pi OS Bullseye) and the PyCharm Community IDE. If you've never used PyCharm before, I'd be happy to discuss more.

@n0bel
Copy link
Owner Author

n0bel commented Apr 2, 2023

@SerBrynden For PiClock my dev environment is windows. All my dev tools are set up in a portable fashion, so everything is self contained. I don't usually use the supplied installers for my IDEs and Toolchains, so that I can control where they reside. I have python2 and python3 and many other multiple versions of IDEs and Toolchains residing side by side

I use a very very old launcher named PStart, which i use to choose proper environment (paths, sets, etc) I use Notepad++ for everything (with a bunch of handy plugins)

This portable style also allows me to have multiple computers syncing my dev environment (I use syncthing for that) so all updates to one simply appear on the other.

For final testing I move the code to the target device. With python, it rarely fails on the target device.

I have various WSL version 1 environments set up if I really need linux. There of course I use the venerable vi editor. I grew up in unix then windows then linux, so I switch between them easily.

@n0bel
Copy link
Owner Author

n0bel commented Apr 2, 2023

@BertLindeman Pull again. I've just committed changes to correct several function name issues. Config-Example-Berlin works now.

@BertLindeman
Copy link
Contributor

On OpenWeatherMap most of it, but not the day/time in the right forecast squares, but not on tomorrow.io:

A small picture on OWM (see left top weather "scattered Cloulds"):
image

On tomorrow.io same as on OWM, but also weather and day/time in the forcast squares is not translated:
image

@n0bel
Copy link
Owner Author

n0bel commented Apr 2, 2023

working on it.

@n0bel
Copy link
Owner Author

n0bel commented Apr 2, 2023

Commit 8c460ef fixes condition language issue. The change is in Config-Example-Berlin.py which has the language specific table. Still looking at why regional settings aren't working for day names.

@BertLindeman
Copy link
Contributor

Progress.

Both OMW and TI weather texts are German.
Only the top left weather text is now missing (both accounts)
And the forcast day/time is English.
See screenshot:

image

Thank you, Kevin

@n0bel
Copy link
Owner Author

n0bel commented Apr 2, 2023

I've removed METAR from Config-Berlin-Example. Metar does not currently handle language differences. Current conditions now come from the chosen weather API in that example. I've also corrected two more metric conversion function names.

@BertLindeman
Copy link
Contributor

I've also corrected two more metric conversion function names.

So you already fixed:

  File "PyQtPiClock.py", line 965, in wxfinished_tm
    press.setText(Config.LPressure + '%.1f' % inhg2mmhg(f['values']['pressureSurfaceLevel']) + 'mm')
NameError: global name 'inhg2mmhg' is not defined

Re pull-ed and all weather texts are OK now for both API's.

Just the date/time in the forecasts.

(If you want me to open a separate issue . . . )

@n0bel
Copy link
Owner Author

n0bel commented Apr 2, 2023

@BertLindeman I have no solution for the Day Names being wrong on your PiClock. I've tested two different PiClocks here Raspbian GNU/Linux 8 (jessie), and Raspbian GNU/Linux 7 (wheezy). I had to add de_DE.UTF-8 in raspi-config in each case (It would not work at all if I hadn't) My tests have correct day names in the chosen language. I can only assume its some sort of bug in the particular version of python locale or the OS.

@BertLindeman
Copy link
Contributor

Running on

to Raspbian GNU/Linux 10 (buster) GNU/Linux
        Kernel:         5.10.103-v7+ armv7l
        RPI Firmware:   2021-12-01 15:07
                        version 71bd3109023a0c8575585ba87cbb374d2eeb038f (clean) (release) (start)

The locales we use needs to be installed, correct.
locale -a shows here:

C
C.UTF-8
de_DE.utf8
en_US.utf8
nl_NL.utf8
POSIX
ru_RU.utf8

But the date on the top line is translated....

Maybe further tomorrow.

Thank you for all the fun you created!

@SerBrynden
Copy link
Contributor

SerBrynden commented Apr 3, 2023

@SerBrynden For PiClock my dev environment is windows. All my dev tools are set up in a portable fashion, so everything is self contained. I don't usually use the supplied installers for my IDEs and Toolchains, so that I can control where they reside. I have python2 and python3 and many other multiple versions of IDEs and Toolchains residing side by side

I use a very very old launcher named PStart, which i use to choose proper environment (paths, sets, etc) I use Notepad++ for everything (with a bunch of handy plugins)

This portable style also allows me to have multiple computers syncing my dev environment (I use syncthing for that) so all updates to one simply appear on the other.

For final testing I move the code to the target device. With python, it rarely fails on the target device.

I have various WSL version 1 environments set up if I really need linux. There of course I use the venerable vi editor. I grew up in unix then windows then linux, so I switch between them easily.

@n0bel Very nice! You've definitely been doing this longer than I have. ;-) I used PyCharm in an Ubuntu virtual machine when I made the updates to Python 3 and PyQt5. PyCharm would identify all the problems and warnings before running, and suggest fixes. You can also clone repos from GitHub, review changes, and commit them from PyCharm (even sign the commits with a GPG key). It'll also create separate virtual environments for each project. I liked working in Ubuntu because it's close enough to Raspberry Pi OS that I hardly had to install any additional packages other than what's listed in the PiClock install instructions. You can get PyCharm for Windows too. ;-)

@n0bel
Copy link
Owner Author

n0bel commented Apr 3, 2023

This thread has served its purpose. Closing it. I've created a new issue for people arriving here to tell them what to do, and refer to this for background review. #251

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests