SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#101 2012-01-01 05:01:11

handy
Member
Registered: 2011-12-31
Posts: 34

Re: weather in conky (LUA scripts) updated 12/26/13!

I been doing reboots with no conky & I'm getting failures to connect to the net sometimes as well.

I installed a new kernel today, it really wouldn't surprise me if it is responsible for this internet problem.

I'll downgrade & see what that brings.

Offline

Help fund CrunchBang, donate to the project!

#102 2012-01-01 05:30:06

handy
Member
Registered: 2011-12-31
Posts: 34

Re: weather in conky (LUA scripts) updated 12/26/13!

I downgraded to the 64bit kernel 3.1.5-1-ARCH & now the rebooting problems are gone & the previous version of forecast.7.lua is working fine.

Todays version is not though.

It can't connect to the internet & bring in the intelli-weather.txt it tries for a short while & then dissapears leaving some white speckles across the bottom of the screen for the same width as its display.

The .lua file is very hard to kill.

My brain if tired & fried, I'll stay away from this until tomorrow.

Last edited by handy (2012-01-01 06:24:47)

Offline

#103 2012-01-01 06:31:15

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

@ handy

i think i need to work on making the curl command a little more forgiving
when i have a bad wireless connection and the curl command fires it can hang for a long time
i have to then go kill conky and curl manually via system monitor

have to look into curls options

doesnt sound like youve been having much fun of late
and it sounds as if curl isnt playing well with your system!

might see if wget does any better

anyway, as sector11 said elsewhere (or at least in a similar vein), these days with conky (and associated files and scripts) its hard to tell sometimes if its a conky thing, a script thing or a system thing

Offline

#104 2012-01-01 08:41:39

handy
Member
Registered: 2011-12-31
Posts: 34

Re: weather in conky (LUA scripts) updated 12/26/13!

@ mr.P: I read that guys were having trouble with curl, weather & conky on the Arch forum:

Can I suggest using --connect-timeout 30 ?

Every now and then the curl connection will hang, which results in conky not updating. If I kill the curl process, conky updates right away.

I don't know if that will be of any use to you or not?

& thanks for your last paragraph above. I was starting to feel pretty useless the way things had been going today.

Tomorrow will hopefully be a better one. wink

Offline

#105 2012-01-02 01:15:22

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

more changes for version 9000 smile

screenshot8cde7f0ea72580a9e5cae67e6550ede9.png

now the lua script reads a template text file like this one

template.txt

${font mono:size=16}Weather Forecast
${font mono:size=14}#{forecast_day[1]}, #{forecast_date[1]}${font} Conditions: #{conditions[1]} High: #{high_temp[1]}°F,  Low: #{low_temp[1]}°F
Sun Rise: #{sun_rise[1]}, Sun Set: #{sun_set[1]}  Moon Rise: #{moon_rise[1]}, Moon Set: #{moon_set[1]} UV Index: #{uv_index[1]} Relative Humidity: #{humidity[1]}
Precipitation: #{precipitation[1]} Snow Probability: #{snow[1]} Cloud Coverage: #{cloud_cover[1]} Moon Phase: #{moon_phase[1]} Wind Speed: #{wind_speed[1]} Wind Direction: #{wind_direction[1]}
${image #{weather_icon[1]} -p 0,80 -s 50x50}${goto 80}${font ConkyWeather:size=22}#{weather_font[1]}${goto 140}${font ConkyWindNESW:size=22}#{wind_font[1]}${goto 200}${font Moon Phases:size=22}#{moon_font[1]}
${font mono:size=14}#{forecast_day[2]}, #{forecast_date[2]}${font} Conditions: #{conditions[2]} High: #{high_temp[2]}°F,  Low: #{low_temp[2]}°F
Sun Rise: #{sun_rise[2]}, Sun Set: #{sun_set[2]}  Moon Rise: #{moon_rise[2]}, Moon Set: #{moon_set[2]} UV Index: #{uv_index[2]} Relative Humidity: #{humidity[2]}
Precipitation: #{precipitation[2]} Snow Probability: #{snow[2]} Cloud Coverage: #{cloud_cover[2]} Moon Phase: #{moon_phase[2]} Wind Speed: #{wind_speed[2]} Wind Direction: #{wind_direction[2]}
${image #{weather_icon[2]} -p 0,175 -s 50x50}${goto 80}${font ConkyWeather:size=22}#{weather_font[2]}${goto 140}${font ConkyWindNESW:size=22}#{wind_font[2]}${goto 200}${font Moon Phases:size=22}#{moon_font[2]}
${font mono:size=14}#{forecast_day[3]}, #{forecast_date[3]}${font} Conditions: #{conditions[3]} High: #{high_temp[3]}°F,  Low: #{low_temp[3]}°F
Sun Rise: #{sun_rise[3]}, Sun Set: #{sun_set[3]}  Moon Rise: #{moon_rise[3]}, Moon Set: #{moon_set[3]} UV Index: #{uv_index[3]} Relative Humidity: #{humidity[3]}
Precipitation: #{precipitation[3]} Snow Probability: #{snow[3]} Cloud Coverage: #{cloud_cover[3]} Moon Phase: #{moon_phase[3]} Wind Speed: #{wind_speed[3]} Wind Direction: #{wind_direction[3]}
${image #{weather_icon[3]} -p 0,270 -s 50x50}${goto 80}${font ConkyWeather:size=22}#{weather_font[3]}${goto 140}${font ConkyWindNESW:size=22}#{wind_font[3]}${goto 200}${font Moon Phases:size=22}#{moon_font[3]}
${font mono:size=14}#{forecast_day[4]}, #{forecast_date[4]}${font} Conditions: #{conditions[4]} High: #{high_temp[4]}°F,  Low: #{low_temp[4]}°F
Sun Rise: #{sun_rise[4]}, Sun Set: #{sun_set[4]}  Moon Rise: #{moon_rise[4]}, Moon Set: #{moon_set[4]} UV Index: #{uv_index[4]} Relative Humidity: #{humidity[4]}
Precipitation: #{precipitation[4]} Snow Probability: #{snow[4]} Cloud Coverage: #{cloud_cover[4]} Moon Phase: #{moon_phase[4]} Wind Speed: #{wind_speed[4]} Wind Direction: #{wind_direction[4]}
${image #{weather_icon[4]} -p 0,365 -s 50x50}${goto 80}${font ConkyWeather:size=22}#{weather_font[4]}${goto 140}${font ConkyWindNESW:size=22}#{wind_font[4]}${goto 200}${font Moon Phases:size=22}#{moon_font[4]}
${font mono:size=14}#{forecast_day[5]}, #{forecast_date[5]}${font} Conditions: #{conditions[5]} High: #{high_temp[5]}°F,  Low: #{low_temp[5]}°F
Sun Rise: #{sun_rise[5]}, Sun Set: #{sun_set[5]}  Moon Rise: #{moon_rise[5]}, Moon Set: #{moon_set[5]} UV Index: #{uv_index[5]} Relative Humidity: #{humidity[5]}
Precipitation: #{precipitation[5]} Snow Probability: #{snow[5]} Cloud Coverage: #{cloud_cover[5]} Moon Phase: #{moon_phase[5]} Wind Speed: #{wind_speed[5]} Wind Direction: #{wind_direction[5]}
${image #{weather_icon[5]} -p 0,460 -s 50x50}${goto 80}${font ConkyWeather:size=22}#{weather_font[5]}${goto 140}${font ConkyWindNESW:size=22}#{wind_font[5]}${goto 200}${font Moon Phases:size=22}#{moon_font[5]}

its a mixture of conky objects, text to be shown and "lua objects" to be interpreted by the lua script:
which look like this

#{weather_option[day]}

the weather options are
weather_icon
weather_font
moon_font
wind_font
forecast_day
forecast_day_short
forecast_date
high_temp
low_temp
conditions
sun_rise
sun_set
moon_rise
moon_set
humidity
precipitation
snow
cloud_cover
wind_speed
wind_direction
uv_index

Offline

#106 2012-01-02 01:26:19

handy
Member
Registered: 2011-12-31
Posts: 34

Re: weather in conky (LUA scripts) updated 12/26/13!

I'll give it a go later on today & see how far I get this time... lol

At a glance with my slow mind, it looks like it will be easy to customise fonts/size & which possibilities you want to use out of all the options, including the weather fonts.

It looks like it will be fun to play with mrpeachy. smile


[edit:]
Can you post a link to the code please mrpeachy?

Or tell me how I should search it out?

Thanks.

Oops, I just thought that perhaps it isn't ready yet... smile

Last edited by handy (2012-01-02 01:33:59)

Offline

#107 2012-01-02 01:37:25

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

handy wrote:

I'll give it a go later on today & see how far I get this time... lol

At a glance with my slow mind, it looks like it will be easy to customise fonts/size & which possibilities you want to use out of all the options, including the weather fonts.

It looks like it will be fun to play with mrpeachy. smile

i still have some things i want to do with the script, which is why i didn't post the lua script

actually as this particular script isnt drawing anything onto the conky window and it isnt being called otherwise in the conkyrc anywhere below TEXT, it might be a good idea to turn the script into an executable script called via execi rather than through lua load above TEXT

just like a bash/python or any other script is

thought i would do a test
commented out the lines than load and run the lua script from conkyrc so now it is just using execpi to read the weather text file
screenshot-1299.png
seems that the lua, which is on its own timer, doesn't make a whole lot of difference to cpu use in this case

Last edited by mrpeachy (2012-01-02 01:48:19)

Offline

#108 2012-01-03 21:21:59

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

more changes for version 9000 smile

screenshot8cde7f0ea72580a9e5cae67e6550ede9.png

now the lua script reads a template text file like this one

template.txt
   {snip snip}
its a mixture of conky objects, text to be shown and "lua objects" to be interpreted by the lua script:

Where is the actual LUA code for this tempalte?
Is it "version 7" ----- version 9000???????????What did I miss

Last edited by Sector11 (2012-01-03 21:23:37)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#109 2012-01-04 01:00:23

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

@ Sector11 the code needed some work, so i didnt post it
as for the version numbering... i forgot where i was so went with 9000, seemed like a reasonable number to restart at big_smile

anyway
you can try this

OLD VERSION, NO GOOD
http://crunchbanglinux.org/pastebin/1413

UPDATED VERSION
http://crunchbanglinux.org/pastebin/1415

in conky in addition to regular settings

lua_load ~/lua/weatheragain2.lua
lua_draw_hook_pre weather

template1 /home/benjamin/Desktop/weather.txt
TEXT
cpu: ${cpu}
${execpi 10 cat ${template1}}

you can set the execpi interval higher, its low so that updates in the template are seen quickly

at the top of the lua script

secs=1800--set update interval
web="http://www.intellicast.com/Local/Forecast.aspx?location=USMO9688"--insert unit=C& after? for C
--get web address by going to the intellicast site and entering your location in the box
--for version 3 you must get click on "Extended Forecast" to get the necessary address
units="F"
--set location of template
template_location="/home/benjamin/Desktop/template2.txt"
--set location where output weather data txt will be saved
location="/home/benjamin/Desktop/weather.txt"
--set location of weather images
weathericons="/home/benjamin/Desktop/scripts/images/weathericons/"

location where output weather data txt will be saves is the same as in the conkyrc

here is a test template (template2.txt)

Forecast day, regular, upper, lower - #{forecast_day[1]}, #{forecast_day_caps[1]}, #{forecast_day_lc[1]}
Forecast day short, regular, upper, lower - #{forecast_day_short[1]}, #{forecast_day_short_caps[1]}, #{forecast_day_short_lc[1]}
Forecast month, regular, upper, lower- #{forecast_month[1]}, #{forecast_month_caps[1]}, #{forecast_month_lc[1]}
Forecast month short, regular, upper, lower - #{forecast_month_short[1]}, #{forecast_month_short_caps[1]}, #{forecast_month_short_lc[1]}
Forecast date - #{forecast_date[1]}
Weather icon - #{weather_icon[1]}${image #{weather_icon[1]} -p 200,190 -s 50x50}
Weather font -     ${font ConkyWeather:size=20}#{weather_font[1]}${font}
${voffset -12}High temp - #{high_temp[1]}
Low temp - #{low_temp[1]}
Conditions, regular, uppercase, lowercase - #{conditions[1]}, #{conditions_caps[1]}, #{conditions_lc[1]}
Sun rise, upper, lower - #{sun_rise[1]}, #{sun_rise_lc[1]}
Moon rise, upper, lower - #{moon_rise[1]}, #{moon_rise_lc[1]}
Sun set, upper, lower - #{sun_set[1]}, #{sun_set_lc[1]}
Moon set, upper, lower - #{moon_set[1]}, #{moon_set_lc[1]}
Humidity - #{humidity[1]}
Precipitation - #{precipitation[1]}
Snow - #{snow[1]}
Cloud cover - #{cloud_cover[1]}
Moon phase, regular, upper, lower - #{moon_phase[1]},#{moon_phase_caps[1]},#{moon_phase_lc[1]}
Moon phase font -     ${font Moon Phases:size=20}#{moon_font[1]}${font}
${voffset -12}Wind speed mph - #{wind_mph[1]}
Wind speed km - #{wind_km[1]}
Wind speed knots - #{wind_kts[1]}
Wind direction degrees - #{wind_deg[1]}
Wind direction NEWS - #{wind_nesw[1]}
Wind direction font - ${font ConkyWindNESW:size=20}#{wind_font[1]}${font}
UV index number - #{uv_index_num[1]}
UV index description, regular, uppercase, lowercase - #{uv_index_txt[1]}, #{uv_index_txt_caps[1]}, #{uv_index_txt_lc[1]}

screenshot2c8d48cd63751dba9834cb8caa86073a.png

these are the options you can use, they should be self explanatory
enclose them in #{option} in the template
forecast_day[day_number]
forecast_day_caps[day_number]
forecast_day_lc[day_number]
forecast_day_short[day_number]
forecast_day_short_caps[day_number]
forecast_day_short_lc[day_number]
forecast_month[day_number]
forecast_month_caps[day_number]
forecast_month_lc[day_number]
forecast_month_short[day_number]
forecast_month_short_caps[day_number]
forecast_month_short_lc[day_number]
forecast_date[day_number]
weather_icon[day_number]
weather_font[day_number]
high_temp[day_number]
low_temp[day_number]
conditions[day_number]
conditions_caps[day_number]
conditions_lc[day_number]
sun_rise[day_number]
sun_rise_lc[day_number]
moon_rise[day_number]
moon_rise_lc[day_number]
sun_set[day_number]
sun_set_lc[day_number]
moon_set[day_number]
moon_set_lc[day_number]
humidity[day_number]
precipitation[day_number]
snow[day_number]
cloud_cover[day_number]
moon_phase[day_number]
moon_phase_caps[day_number]
moon_phase_lc[day_number]
moon_font[day_number]
wind_mph[day_number]
wind_km[day_number]
wind_kts[day_number]
wind_direction[day_number]
wind_font[day_number]
wind_deg[day_number]
wind_nesw[day_number]
uv_index_num[day_number]
uv_index_txt[day_number]
uv_index_txt_caps[day_number]
uv_index_txt_lc[day_number]

you can also use any conky objects ${object} typed into the template, and plain text also

Last edited by mrpeachy (2012-01-04 03:56:57)

Offline

#110 2012-01-04 02:45:29

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

@ Sector11 the code needed some work, so i didnt post it
as for the version numbering... i forgot where i was so went with 9000, seemed like a reasonable number to restart at big_smile

I called it: mrpweather_2012-1-3.lua  big_smile

Minor error:
0fcd98167907982.jpg

Would that be line 320?

319 table.insert(uv_index_txt,t)
320 table.insert(uv_index_txt_caps,string.upper(t))
321 table.insert(uv_index_txt_lc,string.lower(t))
--#####################################################################
--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP
secs=1800--set update interval
web="http://www.intellicast.com/Local/Forecast.aspx?unit=C&location=ARBA0009"--insert unit=C& after? for C
--get web address by going to the intellicast site and entering your location in the box
--for version 3 you must get click on "Extended Forecast" to get the necessary address
units="C"
--set location of template
template_location="/home/sector11/mrpweather/template1.txt"
--set location where output weather data txt will be saved
location="/home/sector11/mrpweather/weather.txt"
--set location of weather images
weathericons="/home/sector11/mrpweather/weathericons/"
--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP
--###########################################################################

Other than that - looks good!!!!!!!!!

Last edited by Sector11 (2012-01-04 02:46:02)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#111 2012-01-04 03:14:59

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

best not to use the latest version yet, ive been testing it more extensively and it isnt working as expected

time to track down the bugs!

Offline

#112 2012-01-04 03:39:18

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

best not to use the latest version yet, ive been testing it more extensively and it isnt working as expected

time to track down the bugs!

You Tarzan, me Bug Finder!


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#113 2012-01-04 03:54:57

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

i have it fixed now
have updated the code in my post above http://crunchbanglinux.org/forums/post/176233/#p176233

screenshotc01205f1672a13155d3e8d00c63965ff.png

here is the template for the above

Weather Forecast for 63125
#{forecast_day_lc[1]}, #{forecast_month_lc[1]} #{forecast_date[1]}    ${goto 200}#{forecast_day_lc[2]}, #{forecast_month_lc[2]} #{forecast_date[2]}        ${goto 400}#{forecast_day_lc[3]}, #{forecast_month_lc[3]} #{forecast_date[3]}        ${goto 600}
#{conditions_lc[1]}${image #{weather_icon[1]} -p 0,50 -s 50x50}        ${goto 200}#{conditions_lc[2]}${image #{weather_icon[2]} -p 200,50 -s 50x50}        ${goto 400}#{conditions_lc[3]}${image #{weather_icon[3]} -p 400,50 -s 50x50}        ${goto 600}
${font}${goto 70} sun rise: #{sun_rise_lc[1]}                ${goto 200}${font}${goto 270} sun rise: #{sun_rise_lc[2]}                ${goto 400}${font}${goto 470} sun rise: #{sun_rise_lc[3]}                ${goto 600}
${goto 70}  sun set: #{sun_set_lc[1]}                    ${goto 200}${goto 270}  sun set: #{sun_set_lc[2]}                    ${goto 400}${goto 470}  sun set: #{sun_set_lc[3]}                    ${goto 600}
${goto 70}moon rise: #{moon_rise_lc[1]}                    ${goto 200}${goto 270}moon rise: #{moon_rise_lc[2]}                    ${goto 400}${goto 470}moon rise: #{moon_rise_lc[3]}                    ${goto 600}
${goto 70} moon set: #{moon_set_lc[1]}                    ${goto 200}${goto 270} moon set: #{moon_set_lc[2]}                    ${goto 400}${goto 470} moon set: #{moon_set_lc[3]}                    ${goto 600}
high: #{low_temp[1]}°F                            ${goto 200}high: #{low_temp[2]}°F                            ${goto 400}high: #{low_temp[3]}°F                            ${goto 600}
low: #{low_temp[1]}°F                            ${goto 200}low: #{low_temp[2]}°F                            ${goto 400}low: #{low_temp[3]}°F                            ${goto 600}
cloud: #{cloud_cover[1]}%   ${font ConkyWindNESW:size=32}#{wind_font[1]} ${voffset -2}${font Moon Phases:size=28}#{moon_font[1]}${font}${goto 200}${voffset -26}cloud: #{cloud_cover[2]}%   ${font ConkyWindNESW:size=32}#{wind_font[2]} ${voffset -2}${font Moon Phases:size=28}#{moon_font[2]}${font}${goto 400}${voffset -26}cloud: #{cloud_cover[3]}%   ${font ConkyWindNESW:size=32}#{wind_font[3]} ${voffset -2}${font Moon Phases:size=28}#{moon_font[3]}${font}${goto 600} 
${voffset -26}rain: #{precipitation[1]}                    ${goto 200}rain: #{precipitation[2]}                            ${goto 400}rain: #{precipitation[3]}                    ${goto 600}
snow: #{snow[1]}%                             ${goto 200}snow: #{snow[2]}%                                 ${goto 400}snow: #{snow[3]}%                                 ${goto 600}
humidity: #{humidity[1]}%                        ${goto 200}humidity: #{humidity[2]}%                            ${goto 400}humidity: #{humidity[3]}%                            ${goto 600}
uv index: #{uv_index_num[1]} (#{uv_index_txt_lc[1]})                    ${goto 200}uv index: #{uv_index_num[2]} (#{uv_index_txt_lc[2]})                    ${goto 400}uv index: #{uv_index_num[1]} (#{uv_index_txt_lc[3]})                    ${goto 600}
wind speed: #{wind_mph[1]} mph                      ${goto 200}wind speed: #{wind_mph[2]} mph                          ${goto 400}wind speed: #{wind_mph[3]} mph                          ${goto 600}
wind direction: #{wind_deg[1]} (#{wind_nesw[1]})            ${goto 200}wind direction: #{wind_deg[2]} (#{wind_nesw[2]})                ${goto 400}wind direction: #{wind_deg[3]} (#{wind_nesw[3]})                ${goto 600}
moon phase: #{moon_phase_lc[1]}                       ${goto 200}moon phase: #{moon_phase_lc[2]}                           ${goto 400}moon phase: #{moon_phase_lc[3]}                           ${goto 600}

i still think i can refine the way the code works, but it is functioning as i would expect now

in the current version 1415 (named for pastebin number) i think i have the template method finalised
so that further revisions will only be to how the code processes the data rather than changing the way the information is used.  that way, any templates written using the current methodology (ie #{} to get lua weather data in amongst conky objects and text) should plug straight into any updated scripts smile

Last edited by mrpeachy (2012-01-04 04:08:17)

Offline

#114 2012-01-04 12:11:12

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

i still think i can refine the way the code works, but it is functioning as i would expect now

This like everything is always an option.  big_smile

mrpeachy wrote:

in the current version 1415 (named for pastebin number) i think i have the template method finalised
so that further revisions will only be to how the code processes the data rather than changing the way the information is used.  that way, any templates written using the current methodology (ie #{} to get lua weather data in amongst conky objects and text) should plug straight into any updated scripts smile

And this standard template for future versions is a real important feature for continuity.
Well done mrpeachy - I gotta go out but will try it on my return.  Nice to know once I get a layout or six they will be around for a bit.  big_smile


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#115 2012-01-05 01:43:56

handy
Member
Registered: 2011-12-31
Posts: 34

Re: weather in conky (LUA scripts) updated 12/26/13!

I'm going to be away for the next 4 days, I look forward to trying out the new version then mrpeachy.

By then Sector11 will have meticulously uncovered any bugs that he can... smile

I think you are just picky Sector11! wink

Offline

#116 2012-01-05 02:10:23

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

handy wrote:

I'm going to be away for the next 4 days, I look forward to trying out the new version then mrpeachy.

By then Sector11 will have meticulously uncovered any bugs that he can... smile

I think you are just picky Sector11! wink

Moi!  Describe picky!  have a nice 4 days ....


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#117 2012-01-05 02:27:25

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

i have it fixed now
have updated the code in my post above http://crunchbanglinux.org/forums/post/176233/#p176233

Ummm a few things...

Why are spaces needed before the ${goto} commands and why does a line require a ${goto 600} at the end of each line?

I tried changing the layout and it was a real brain twister to get the spacing right.

Am I missing something or is there no "Current" or "Feels Like" temperature?

I after trying "v9000" with the template I revamped my "mrpeachy LUA_v6" conky:
a426e2168066228.jpg


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#118 2012-01-05 05:33:52

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

Sector11 wrote:
mrpeachy wrote:

i have it fixed now
have updated the code in my post above http://crunchbanglinux.org/forums/post/176233/#p176233

Ummm a few things...

Why are spaces needed before the ${goto} commands and why does a line require a ${goto 600} at the end of each line?

I tried changing the layout and it was a real brain twister to get the spacing right.

Am I missing something or is there no "Current" or "Feels Like" temperature?

I after trying "v9000" with the template I revamped my "mrpeachy LUA_v6" conky:
a426e2168066228.jpg

Thanks for testing Sector11

...those things arent needed, i was going to add another day on, so i ended the lines with the goto 600 but never did (and forgot to delete them before posting!)

spaces arent needed before the ${goto} commands, its just the way i was writing the template, so that i had the next day along starting at the same point (sorry if my odd code threw you off)

you can write the code any way any way you want, there was nothing special about how i wrote that template in terms of having it work smile

you really should be able to put anything you like into the template file, any way you like, and it will be interpreted

and yes, there is only forecast data available, not current info that has the current or feels like temps.  Those are next on the list to get working!

Last edited by mrpeachy (2012-01-05 05:36:03)

Offline

#119 2012-01-05 15:41:11

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

...those things arent needed, i was going to add another day on, so i ended the lines with the goto 600 but never did (and forgot to delete them before posting!)

Funny, if I took them out the lat goto on the line would react for the first command on the next line.
If I use just "spaces" there is no problem but one can guarantee the "output" of a command being a certain length.

I'll make a test and show you exactly what I mean.

mrpeachy wrote:

spaces arent needed before the ${goto} commands, its just the way i was writing the template, so that i had the next day along starting at the same point (sorry if my odd code threw you off)

Then I think there may be a conky "version;desktop;window manager" kink in here like seen with other problems. Because closing those spaces definitely made a change in the output ${goto} or not.


mrpeachy wrote:

you can write the code any way any way you want, there was nothing special about how i wrote that template in terms of having it work smile

you really should be able to put anything you like into the template file, any way you like, and it will be interpreted

Like I said above ... I'll continue with a test

mrpeachy wrote:

and yes, there is only forecast data available, not current info that has the current or feels like temps.  Those are next on the list to get working!

Oh OK!  big_smile

Sorry for being picky as handy put it.  big_smile
{should make hand feel good}  hahahahaha


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#120 2012-01-05 21:32:02

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

I was asked to make a "look-a-like" or something similar to an old conkyForecast conky with mrpeachy's weather LUA.  I chose my v6 version as I can't seem to get the images working in v7 and v9000 is still under development.  Apparently it died just after this image was taken.

The 40°/34° is: Current Temp / Feels Like Temp ie: Wind Chill in the winter and Heat Index in the summer.
In the winter the second would normally be a little less and in the summer a little more than the first temp.

4ae332168194829.jpg
conkyForecast on the right LUA v6 on the left.
wea_conky.tar.gz
Extract to ~/ it will extract to ~/wea_conky ... the files that need to be executable will be and the README.txt is simple:

There are two ways to start the conky:

SSC.sh - Start/Stop Conky

- Use this in a "menu or on your panel"

- IF CONKY IS RUNNING
- - the first click will KILLALL conkys
- - the second click will start all conkys in the list

startme.sh

- this script simply starts conky if not running - OR -
- kills all conkys and restarts conky if it is running.

This weather conky is set up for °F at: USOH1015

If you use something other than USOH1015 I suggest you rename the file ~/wea_conky/weather.txt to something else until you KNOW it works.

It is setup using xcompmgr running.

Thank you mrpeachy.

Last edited by Sector11 (2012-01-05 21:38:10)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#121 2012-01-06 04:17:25

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

thank you Sector11

re being picky... not in the least!
i would say weather displays in conky are your speciality smile

and i want to make something usable
ill have to go remind myself what version 6 looked like big_smile

i think the extraction code in version 9000 is much more elegant and efficient than the previous incarnations
(i found a fun way to use string.find, which is the basis for the new code)
and im almost there with finalising the available data

your time in testing and writing code for my scripts is much appreciated

Offline

#122 2012-01-06 04:25:45

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

your time in testing and writing code for my scripts is much appreciated

You're welcome.

Your work on the code is appreciated and your patience with me too, it finally sunk in, VastOne would be proud of me.  hahahahahahaha

I also have to get back to TEO's new scripts and play with those as well.

So many scripts so little time.

Hey you made a Mayan Calendar, can you change it to have 30 hours a day, 8 days a week and 58 weeks in a year?  big_smile


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#123 2012-01-06 22:47:50

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

ok, ive been working on the latest version
i have implemented the current data from the intellicast site

i have set the script up to take 2 kinds of input, it can read a template and interpret the weather data objects ie #{} then output a text file that is called in the conkyrc via execpi cat

the second method is to input data into the lua file directly
i used the second method to make the following
screenshot3156e8f2860f2ca0fe18d091c4129ed0.png

i found this method used considerable less processing power than method 1 (see cpu in screenshot)
the other benefit it, as handy suggested in a previous post, you can set up a single forecast day and have that format repeated for as many days as you want without having to enter additional code

the downside to the lua input method is that it is a little more complex to type

here is the lua input section from the script

if input_method==2 then
--write lines here to show in conky
--write settings, c=color,a=alpha,f=font,fs=font size,x=x position, y=y position, txt=text or data to show
--eg out({c=0xffff00,a=1,f="Sans",fs=14,x=100,y=100,txt="hello world"})
--image settings, x=top left x position, y=top left y position, w=width of image(0=full size), h=height(0=full size),file=file location
--eg image({x=0,y=35,w=60,h=60,file=now[weather_icon]})
--write current weather
out({fs=16,x=0,y=30,txt=now["day_lc"]..", "..now["date"].." "..now["month_lc"]})
image({x=-20,y=15,w=50,h=50,file=now["weather_icon"]})
out({x=65,y=50,fs=14,txt="conditions: "..now["conditions_lc"]})
out({x=80,y=68,fs=14,txt="temp: "..now["temp"].."°f"})
out({x=80,y=86,fs=14,txt="feels like: "..now["feels_like"].."°f"})
out({x=0,y=104,c=0x3ed9e7,txt="wind chill: "});out({x=80,y=104,txt=now["wind_chill"].."°f"});out({x=140,y=104,c=0x3ed9e7,txt="ceiling: "});out({x=220,y=104,txt=now["ceiling_lc"]})
out({x=0,y=118,c=0x3ed9e7,txt="heat index: "});out({x=80,y=118,txt=now["heat_index"].."°f"});out({x=140,y=118,c=0x3ed9e7,txt="visibility: "});out({x=220,y=118,txt=now["visibility"]})
out({x=0,y=132,c=0x3ed9e7,txt="dew point: "});out({x=80,y=132,txt=now["dew_point"].."°f"});out({x=140,y=132,c=0x3ed9e7,txt="wind: "});out({x=220,y=132,txt=now["wind_mph"]})
out({x=0,y=146,c=0x3ed9e7,txt="humidity: "});out({x=80,y=146,txt=now["humidity"].."%"});out({x=140,y=146,c=0x3ed9e7,txt="direction: "});out({x=220,y=146,txt=now["wind_deg"].."° ("..now["wind_nesw"]..")"})
out({x=0,y=160,c=0x3ed9e7,txt="pressure: "});out({x=80,y=160,txt=now["pressure"].."\""});out({x=140,y=160,c=0x3ed9e7,txt="gusts: "});out({x=220,y=160,txt=now["wind_gusts"]})
--write forecast weather and repeat
--these tables hold the top left coordinates for each repeat as set lower, do not edit
top_left_x_coordinate={}
top_left_y_coordinate={}
--enter number of forecast days to show
number_of_days=4
--enter coordinates of top left corner for each day
top_left_x_coordinate[1],top_left_y_coordinate[1]=0,150
top_left_x_coordinate[2],top_left_y_coordinate[2]=320,150
top_left_x_coordinate[3],top_left_y_coordinate[3]=0,350
top_left_x_coordinate[4],top_left_y_coordinate[4]=320,350
------------------------
for i=1,number_of_days do--start of day repeat, do not edit
tlx=top_left_x_coordinate[i]--sets top left position for each repeat
tly=top_left_y_coordinate[i]--sets top left position for each repeat
--write day format below, write x and y relative to top left coordinates as in the example
--write i to call day as this will be replaced with the day number for each repeat
out({fs=16,x=tlx+0,y=tly+30,txt=forecast_day_lc[i]..", "..forecast_date[i].." "..forecast_month_lc[i]})
image({x=tlx-20,y=tly+15,w=50,h=50,file=weather_icon[i]})
out({x=tlx+65,y=tly+50,fs=14,txt="conditions: "..conditions_lc[i]})
out({x=tlx+80,y=tly+68,fs=14,txt="high: "..high_temp[i].."°f"})
out({x=tlx+80,y=tly+86,fs=14,txt="low: "..low_temp[1].."°f"})
out({x=tlx+0,y=tly+104,c=0x3ed9e7,txt="sun rise: "});out({x=tlx+80,y=tly+104,txt=sun_rise_lc[i]});out({x=tlx+140,y=tly+104,c=0x3ed9e7,txt="sun set: "});out({x=tlx+220,y=tly+104,txt=sun_set_lc[i]})
out({x=tlx+0,y=tly+118,c=0x3ed9e7,txt="sun set: "});out({x=tlx+80,y=tly+118,txt=sun_set[i]});out({x=tlx+140,y=tly+118,c=0x3ed9e7,txt="moon set: "});out({x=tlx+220,y=tly+118,txt=moon_set_lc[i]})
out({x=tlx+0,y=tly+138,c=0x3ed9e7,txt="moon phase: "});out({x=tlx+80,y=tly+138,txt=moon_phase_lc[i]});out({f="Moon Phases",fs=20,x=tlx+190,y=tly+143,txt=moon_font[i]})

out({x=tlx+0,y=tly+156,c=0x3ed9e7,txt="cloud: "});out({x=tlx+80,y=tly+156,txt=cloud_cover[i].." %"});out({x=tlx+140,y=tly+156,c=0x3ed9e7,txt="uv index: "});out({x=tlx+220,y=tly+156,txt=uv_index_num[i].." ("..uv_index_txt[i]..")"})
out({x=tlx+0,y=tly+170,c=0x3ed9e7,txt="rain: "});out({x=tlx+80,y=tly+170,txt=precipitation[i].." %"});out({x=tlx+140,y=tly+170,c=0x3ed9e7,txt="humidity: "});out({x=tlx+220,y=tly+170,txt=humidity[i].." %"})
out({x=tlx+0,y=tly+184,c=0x3ed9e7,txt="snow: "});out({x=tlx+80,y=tly+184,txt=snow[i].." %"});out({x=tlx+140,y=tly+184,c=0x3ed9e7,txt="wind speed: "});out({x=tlx+220,y=tly+184,txt=wind_mph[i].." mph"})
out({x=tlx+0,y=tly+204,c=0x3ed9e7,txt="wind direction: "})out({x=tlx+120,y=tly+204,txt=wind_deg[i].." ("..wind_nesw[i]..")"});out({f="ConkyWindNESW",fs=28,x=tlx+190,y=tly+212,txt=wind_font[i]})
end--of day repeat, do not edit
end--of method 2, do not edit
--#########################################################################################################

there are 2 functions being used above
out, which diplays all the text based things
and
image, which displays the images

out is formatted
out({settings,text})

image is formatted
image({setings,file})

an important point to note is the use of ; (semi colon)
this allows the use of multiple calls to the functions on the same line

the most problematic feature is having to specify x and y coordinates
as if you want to change the format, for example add a line at the top, you will need to edit the x and y coordinates for everything else to move them down

i do have an idea to make this easier (i'll test that in a bit)

current information in the lua entry method is called like so

now["option"]

in the lua options must be put in double quotes, in the template you dont need the quotes
options are:
day
day_caps
day_lc
day_short
day_short_caps
day_short_lc
month
month_caps
month_lc
month_short
month_short_caps
month_short_lc
date
year
time
time_lc
temp
feels_like
conditions
conditions_lc
conditions_caps
weather_icon
wind_chill
humidity
wind_mph
wind_gusts
wind_gusts_caps
ceiling
ceiling_lc
ceiling_caps
dew_point
heat_index
pressure
visibility
visibility_caps
weather_font
wind_deg
wind_nesw
wind_font

forecast is set up like
option[day]
with options the same as posted previously

entire lua script
http://crunchbanglinux.org/pastebin/1422

Last edited by mrpeachy (2012-01-06 22:55:07)

Offline

#124 2012-01-06 23:27:54

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: weather in conky (LUA scripts) updated 12/26/13!

continuing on how to use the lua entry method
look at this line

out({x=0,y=104,c=0x3ed9e7,txt="wind chill: "});out({x=80,y=104,txt=now["wind_chill"].."°f"});out({x=140,y=104,c=0x3ed9e7,txt="ceiling: "});out({x=220,y=104,txt=now["ceiling_lc"]})

it is using 4 calls to the out function but could also be types line by line like this

out({x=0,y=104,c=0x3ed9e7,txt="wind chill: "});
out({x=80,y=104,txt=now["wind_chill"].."°f"});
out({x=140,y=104,c=0x3ed9e7,txt="ceiling: "});
out({x=220,y=104,txt=now["ceiling_lc"]})

to use the out function you dont need to send all the variables, just the ones you need
in the out function, below the main i have set defaults

function out(tx)
color=nil
color=tx.c
if color==nil then color=0xffffff end
alpha=nil
alpha=tx.a
if alpha==nil then alpha=1 end
font=nil
font=tx.f
if font==nil then font="mono" end
fsize=nil
fsize=tx.fs
if fsize==nil then fsize=12 end
xpos=nil
xpos=tx.x
if xpos==nil then xpos=100 end
ypos=nil
ypos=tx.y
if ypos==nil then ypos=100 end
text=nil
text=tx.txt
if text==nil then text="hello world" end

i think i will make these defualts easier to access, and put them in the settings section

the other thing to know about using code in the lua script is the use of ..
.. is how lua puts things together
so

out({x=80,y=104,txt=now["wind_chill"].."°f"})

the txt part is saying to show the output of the weather data associated with now["wind_chill"] followed by °f
plain text has to be in quotes in the script
conditions today (friday) the below text
"today: "..now[day].." "..now[date]
today: Friday 6
you have to add in things like spaces within quotes between calling variables (if you want them)

Offline

Be excellent to each other!

#125 2012-01-07 00:22:03

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

Yup, now I'm convinced that mrpeachy speaks Martian and  here on earth they have disguised the language as LUA.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo