Conky and wttr

Forum rules
Before you post please read how to get help
antcj
Level 3
Level 3
Posts: 108
Joined: Thu Jun 28, 2012 11:17 pm

Conky and wttr

Post by antcj » Mon Jul 08, 2019 5:40 pm

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?

ajgringo619
Level 6
Level 6
Posts: 1457
Joined: Thu Mar 01, 2018 8:36 pm
Location: San Diego, California

Re: Conky and wttr

Post by ajgringo619 » Mon Jul 08, 2019 7:03 pm

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
Mint 19.2 XFCE
kernel 4.15.0-70-generic
AMD FX-8350 Eight-Core w/16 GB RAM
Nvidia GeForce 960 w/2GB RAM (440.26)
Image

User avatar
BenTrabetere
Level 6
Level 6
Posts: 1016
Joined: Sat Jul 19, 2014 12:04 am
Location: Hattiesburg, MS USA

Re: Conky and wttr

Post by BenTrabetere » Mon Jul 08, 2019 10:55 pm

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:

ajgringo619
Level 6
Level 6
Posts: 1457
Joined: Thu Mar 01, 2018 8:36 pm
Location: San Diego, California

Re: Conky and wttr

Post by ajgringo619 » Mon Jul 08, 2019 10:58 pm

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.
Mint 19.2 XFCE
kernel 4.15.0-70-generic
AMD FX-8350 Eight-Core w/16 GB RAM
Nvidia GeForce 960 w/2GB RAM (440.26)
Image

User avatar
zcot
Level 5
Level 5
Posts: 551
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky and wttr

Post by zcot » Mon Jul 08, 2019 11:54 pm

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
Level 6
Level 6
Posts: 1457
Joined: Thu Mar 01, 2018 8:36 pm
Location: San Diego, California

Re: Conky and wttr

Post by ajgringo619 » Tue Jul 09, 2019 12:01 am

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
Mint 19.2 XFCE
kernel 4.15.0-70-generic
AMD FX-8350 Eight-Core w/16 GB RAM
Nvidia GeForce 960 w/2GB RAM (440.26)
Image

antcj
Level 3
Level 3
Posts: 108
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj » Tue Jul 09, 2019 11:55 pm

Thank you all,
ill have a little dig around when i get a moment

User avatar
zcot
Level 5
Level 5
Posts: 551
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky and wttr

Post by zcot » Wed Jul 10, 2019 9:41 am

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: 108
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj » Wed Jul 10, 2019 2:40 pm

my output from conky looks like this
Attachments
weather.resized.jpg
weather.resized.jpg (10.28 KiB) Viewed 533 times

User avatar
zcot
Level 5
Level 5
Posts: 551
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky and wttr

Post by zcot » Wed Jul 10, 2019 8:40 pm

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: 108
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj » Wed Jul 10, 2019 8:43 pm


User avatar
zcot
Level 5
Level 5
Posts: 551
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky and wttr

Post by zcot » Wed Jul 10, 2019 11:09 pm

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: 108
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj » 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..

User avatar
zcot
Level 5
Level 5
Posts: 551
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky and wttr

Post by zcot » Thu Jul 11, 2019 9:29 am

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 9
Level 9
Posts: 2640
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Conky and wttr

Post by AndyMH » 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
Homebrew i5-8400+GTX1080 Cinnamon 19.0, 3 x Thinkpad T430 Cinnamon 19.0, i7-3632 , i5-3320, i5-3210, Thinkpad T60 19.0 Mate

antcj
Level 3
Level 3
Posts: 108
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj » Thu Jul 11, 2019 2:28 pm

[/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: 108
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj » Thu Jul 11, 2019 2:31 pm

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
Level 6
Level 6
Posts: 1457
Joined: Thu Mar 01, 2018 8:36 pm
Location: San Diego, California

Re: Conky and wttr

Post by ajgringo619 » Thu Jul 11, 2019 2:32 pm

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:
Mint 19.2 XFCE
kernel 4.15.0-70-generic
AMD FX-8350 Eight-Core w/16 GB RAM
Nvidia GeForce 960 w/2GB RAM (440.26)
Image

antcj
Level 3
Level 3
Posts: 108
Joined: Thu Jun 28, 2012 11:17 pm

Re: Conky and wttr

Post by antcj » Thu Jul 11, 2019 3:24 pm

[/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 5
Level 5
Posts: 551
Joined: Wed Oct 19, 2016 6:08 pm

Re: Conky and wttr

Post by zcot » Thu Jul 11, 2019 6:05 pm

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}
]]

Post Reply

Return to “Compiz, Conky, Docks, & Widgets”