Conky and wttr

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
antcj
Level 3
Level 3
Posts: 148
Joined: Thu Jun 28, 2012 11:17 pm

Conky and wttr

Post by antcj »

Using mint 19 mate.
I used to have GIS as a weather app on my desktop.
This no longer seems to work. Ive prob done something wrong...
Moving on,
I have looked at wttr and have it going in conky but the output is not useable, compared to the terminal.
${curl wttr.in/city}


Does anyone know how to set this up properly in conky?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
ajgringo619

Re: Conky and wttr

Post by ajgringo619 »

I gave up on getting weather via Conky; not Conky's fault, just couldn't get a reliable source. Everyone that I tried would randomly time-out, or refuse connection because I was supposedly running queries too much (once per hour was what I was told, but it wasn't consistent).

I tried your wttr.in service, and got this:

Code: Select all

$ curl wttr.in/SanDiego

Sorry, we are running out of queries to the weather service at the moment.
Here is the weather report for the default city (just to show you, how it looks like).
We will get new queries as soon as possible.
You can follow https://twitter.com/igor_chubin for the updates.
This looks like what happened to me. Another text-based source for weather is inxi. Here's a sample:

Code: Select all

$ inxi -wxxx
Weather:   Temperature: 22.2 C (72 F) Conditions: Clear sky Wind: from WNW at 2.7 m/s (10 km/h, 6 mph) Cloud Cover: 45% 
           Humidity: 54% Dew Point: 12.5 C (55 F) Pressure: 939.2 mb (31 in) Location: My City, CA, USA 
           Current Time: Mon 08 Jul 2019 04:02:13 PM PDT (America/Los_Angeles) 
           Observation Time: Mon 08 Jul 2019 03:40:00 PM PDT Source: WeatherBit.io
User avatar
BenTrabetere
Level 7
Level 7
Posts: 1890
Joined: Sat Jul 19, 2014 12:04 am
Location: Hattiesburg, MS USA

Re: Conky and wttr

Post by BenTrabetere »

ajgringo619 wrote: Mon Jul 08, 2019 7:03 pm I tried your wttr.in service, and got this:

Code: Select all

$ curl wttr.in/SanDiego
Try

Code: Select all

curl wttr.in/"san diego"
The results should be more informative. As if San Diego needs a weather service to forecast the weather. My extended 30-day forecast is temperatures from the mid-60s to the mid-70s with a possibility of the low 80s, slight breeze from the WSW, sunny with no chance of rain. No charge. :wink:

Compare that to the next 7 days in my corner of paradise.

Code: Select all

curl wttr.in/hattiesburg
Hot and humid, a barely noticeable breeze from somewhere equally hot and humid, few clouds and a very slight chance of clouds, and bugs.

The extended 30-day forecast is exactly the same except on July 28 and August 12/13, when it will be hot and overcast, with a chance for severe weather - this is to coincide with the peak days for the Delta Aquariid and Perseids meteor showers. :evil:
Patreon sponsor since August 2022
Image
ajgringo619

Re: Conky and wttr

Post by ajgringo619 »

BenTrabetere wrote: Mon Jul 08, 2019 10:55 pm The results should be more informative. As if San Diego needs a weather service to forecast the weather. My extended 30-day forecast is temperatures from the mid-60s to the mid-70s with a possibility of the low 80s, slight breeze from the WSW, sunny with no chance of rain. No charge. :wink:

Compare that to the next 7 days in my corner of paradise.

Code: Select all

curl wttr.in/hattiesburg
Hot and humid, a barely noticeable breeze from somewhere equally hot and humid, few clouds and a very slight chance of clouds, and bugs.

The extended 30-day forecast is exactly the same except on July 28 and August 12/13, when it will be hot and overcast, with a chance for severe weather - this is to coincide with the peak days for the Delta Aquariid and Perseids meteor showers. :evil:
It's amazing how many days in downtown SD have the same high and low temperature. When it rains, the weather people completely freak out.
User avatar
zcot
Level 9
Level 9
Posts: 2832
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky and wttr

Post by zcot »

check here to formulate a good format of weather options and/or formatting you are looking for: https://wttr.in/:help

you might want some view options.

maybe you decide to use some png option?

if you write it directly in a global conky config, and for example if the config is using the update_interval for every 1 second then that's not good. You can use an ${execi ...} line instead. or maybe texeci? Or make a specific separate config strictly for weather and just use a large value for update_interval and no need for exec'ing using an interval. But 1secx60x60 is an hour.

even with inxi or any other service if you are pulling every second then those servers are going to be irritated about that and it actually doesn't even make sense at all really. :wink:

check your variables as the conky wiki shows: man -P "less -p 'OBJECTS/VARIABLES'" conky from: https://github.com/brndnmtthws/conky/wi ... igurations obviously you can just man conky for the whole thing and dig around or man conky > bigassed-conky-text-file to write it all into a file if you want to use a text viewer with it instead.

is that any closer yet? :D
ajgringo619

Re: Conky and wttr

Post by ajgringo619 »

When I was playing with Conky, trying to make a weather ticker, I would pull info once per hour with inxi into an .xml files, then used xmlstarlet to parse the info I wanted into Conky (used execpi 3600 command_name). Eventually I would get a warning about calling the service too much, even though they claimed once per hour was OK.

As for Conky man pages, try these local links:
Config settings: file:///usr/share/doc/conky-all/html/config_settings.html
Documentation: file:///usr/share/doc/conky-all/html/docs.html
Variables: file:///usr/share/doc/conky-all/html/variables.html
antcj
Level 3
Level 3
Posts: 148
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj »

Thank you all,
ill have a little dig around when i get a moment
User avatar
zcot
Level 9
Level 9
Posts: 2832
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky and wttr

Post by zcot »

ajgringo619 wrote: Mon Jul 08, 2019 10:58 pm curl wttr.in/SanDiego
same output as: curl wttr.in/syntaxerror
but: curl wttr.in/San+Diego

I don't know how exact a particular service works but if it monitors for 24 queries per day, then on a day with reboot or restart would probably issue more than 24 queries, using 3600 timing anyway. Or 1 per hour, a reboot would likely trigger it.

I tend to think I only want an update once or twice a day, -otherwise I'm manually pulling up a radar map. :P

antcj wrote: Tue Jul 09, 2019 11:55 pm Thank you all,
ill have a little dig around when i get a moment
let us know. we can share some results.

Also, for wttr, some better help info: https://github.com/chubin/wttr.in
antcj
Level 3
Level 3
Posts: 148
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj »

my output from conky looks like this
Attachments
weather.resized.jpg
weather.resized.jpg (10.28 KiB) Viewed 6543 times
User avatar
zcot
Level 9
Level 9
Posts: 2832
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky and wttr

Post by zcot »

I can't see that, but of course you want to use a monospace font so the formatting looks correct.

and I think curl -s or curl --silent might be needed when called from another process so it's not showing some request info.
antcj
Level 3
Level 3
Posts: 148
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj »

User avatar
zcot
Level 9
Level 9
Posts: 2832
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky and wttr

Post by zcot »

antcj wrote: Wed Jul 10, 2019 8:43 pm my apologies for the pic
http://pix.toile-libre.org/upload/origi ... 807092.jpg
those are terminal escape codes, so turn them off in that output.

see the "View Options:" and use the T option "# switch terminal sequences off (no colors)". https://wttr.in/:help

There's an example further down. add the ? after the city and use T and/or other options as shown.
antcj
Level 3
Level 3
Posts: 148
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj »

Thank you
I put in this
${curl wttr.in/Paris ?/t}

but have the same result.
Maybe if you have a working example i could play and go forward with, may get me on the right track
Im not a coder as you may have guessed by now..
User avatar
zcot
Level 9
Level 9
Posts: 2832
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky and wttr

Post by zcot »

antcj wrote: Wed Jul 10, 2019 11:51 pm Thank you
I put in this
${curl wttr.in/Paris ?/t}

but have the same result.
Maybe if you have a working example i could play and go forward with, may get me on the right track
Im not a coder as you may have guessed by now..
${curl wttr.in/Paris ?/t}original
${curl wttr.in/Paris?/t}remove space
${curl wttr.in/Paris?t}remove extra slash
${curl wttr.in/Paris?T}use T parameter not t which is not a parameter

I'll post something after work today.
User avatar
AndyMH
Level 21
Level 21
Posts: 13716
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Conky and wttr

Post by AndyMH »

You could always write your own :) my weather conky parsing data from the UK met office in python:
Workspace 1_014.png
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
antcj
Level 3
Level 3
Posts: 148
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj »

[/quote]
${curl wttr.in/Paris ?/t}original
${curl wttr.in/Paris?/t}remove space
${curl wttr.in/Paris?t}remove extra slash
${curl wttr.in/Paris?T}use T parameter not t which is not a parameter

I'll post something after work today.
[/quote]
And that works wow.
http://pix.toile-libre.org/upload/origi ... 870857.jpg

Im keeping a look out for your post later

Really appreciative
antcj
Level 3
Level 3
Posts: 148
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj »

AndyMH wrote: Thu Jul 11, 2019 11:30 am You could always write your own :) my weather conky parsing data from the UK met office in python:
Workspace 1_014.png
sadly ,im not smart enough to do that kind of coding.
The conkys i use are all cobbled together from others, for which i am very grateful.
ajgringo619

Re: Conky and wttr

Post by ajgringo619 »

AndyMH wrote: Thu Jul 11, 2019 11:30 am You could always write your own :) my weather conky parsing data from the UK met office in python:
Workspace 1_014.png
Don't get distracted from your backup program! :wink:
antcj
Level 3
Level 3
Posts: 148
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj »

[/quote]
${curl wttr.in/Paris ?/t}original
${curl wttr.in/Paris?/t}remove space
${curl wttr.in/Paris?t}remove extra slash
${curl wttr.in/Paris?T}use T parameter not t which is not a parameter

I'll post something after work today.
[/quote]

Any pointers on getting the colours up?
User avatar
zcot
Level 9
Level 9
Posts: 2832
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky and wttr

Post by zcot »

AndyMH wrote: Thu Jul 11, 2019 11:30 am You could always write your own :) my weather conky parsing data from the UK met office in python:
Workspace 1_014.png
nice!
antcj wrote: Thu Jul 11, 2019 3:24 pm
Any pointers on getting the colours up?
Yes, do something like AndyMH. :P

Specifically in this case you could parse the terminal style color codes and convert them to conky color references (then use ${execp command} , or do the stuff from a lua script).


I like a minimal approach so I use a minimal single day query: curl wttr.in/Orlando?0QT
(actually I have that in a script file in ~/bin as from the example given here: https://wttr.in/:bash.function )

then, inside the conky config:

Code: Select all

conky.config = {
    ...some configuration variables
    use_xft = true,
    font = 'Liberation Mono:bold:size=10',
    ...other configuration variables
};

conky.text = [[
${execi 9001 wttr}
]]

or:

Code: Select all

conky.config = {
    ...some configuration variables
    use_xft = true,
    font = 'Liberation Mono:bold:size=10',
    update_interval = 7200.0,
    ...other configuration variables
};

conky.text = [[
${exec wttr}
]]
Locked

Return to “Compiz, Conky, Docks & Widgets”