PINE64
add more weather locations - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: PinePhone Software (https://forum.pine64.org/forumdisplay.php?fid=121)
+---- Forum: Sxmo on PinePhone (https://forum.pine64.org/forumdisplay.php?fid=161)
+---- Thread: add more weather locations (/showthread.php?tid=13900)



add more weather locations - Uturn - 05-14-2021

sorry stupid question: How would I add more weather locations to the weather script, for example my home town Zurich, Switzerland? Thanks!


RE: add more weather locations - discogribbs - 06-18-2021

Greetings,

The shell script is "/usr/bin/sxmo_weather.sh" which points to the file "/usr/share/sxmo/appcfg/places_for_gps.tsv"


RE: add more weather locations - walter1950 - 06-20-2021

Hello,
Open your Browser and type "http://wttr.in" or "http://wttr.in/Paris" ;-)
SXMO Peoples working on this...

Ciao
Walter


RE: add more weather locations - Uturn - 06-20-2021

(06-20-2021, 07:31 AM)walter1950 Wrote: Hello,
Open your Browser and type "http://wttr.in" or "http://wttr.in/Paris" ;-)
SXMO Peoples working on this...

Ciao
Walter
thank you Wink  my plan is to learn about those shell scripts.. I am coming from MacOS, so it's quite unusual.


RE: add more weather locations - Uturn - 06-27-2021

(06-18-2021, 11:25 PM)discogribbs Wrote: Greetings,

The shell script is "/usr/bin/sxmo_weather.sh" which points to the file "/usr/share/sxmo/appcfg/places_for_gps.tsv"
true, but the script refers to a wheather service with U.S. Locations only. I don't think I can add simply my Europe address, as the weather service will not know it.


RE: add more weather locations - magdesign - 02-01-2024

(05-14-2021, 01:33 AM)Uturn Wrote: sorry stupid question: How would I add more weather locations to the weather script, for example my home town Zurich, Switzerland? Thanks!

Maybe a bit late, you can just create your own userscript:

Install dependency
Code:
sudo apk install ansiweather
Create the userscript:
Code:
nano ~/.config/sxmo/userscripts/weather.sh
With following content:

Code:
#!/bin/sh
#title="ansiweather"

# Edit to your town:
LOCATION=Qeshm

# This fetches the Weather info:
WEATHER="ansiweather -l $LOCATION -a false -d true | sed 's/-/\n-/g' | sed 's/^-//'"

# Open a new shell and execute the command
sxmo_terminal.sh -- bash -c "${WEATHER}; exec bash"


exit 0
make it executable:
 
Code:
sudo chmod +x ~/.config/sxmo/userscripts/weather.sh


Now you cen select from Scripts menu in sxmo Smile


RE: add more weather locations - Kevin Kofler - 02-01-2024

(06-20-2021, 11:31 PM)Uturn Wrote: my plan is to learn about those shell scripts.. I am coming from MacOS, so it's quite unusual.
Note that macOS actually also supports shell scripts. Most of its users just are not aware of that. But you can learn shell scripting on macOS if you wish. Or you can actually SSH from your Mac into the PinePhone and shell script your PinePhone from the Mac.

Or of course you could install GNU/Linux on the Mac. Smile But doing that is not necessary to be able to use a *nix (Unix-like) shell, because macOS is also a *nix (even a certified Unix™, though that is only of limited practical relevance, an uncertified GNU/Linux tends to be more compatible with the typical traditional Unix system than the Unix-certified macOS).

It is unfortunate that Apple tries really hard to hide the unixyness of macOS from most of its users and is successful at that. One of the many things I do not like about that company.