You are not logged in.

#926 2018-03-08 22:20:42

unklar
Member
Registered: 2015-10-31
Posts: 1,026

Re: Show us your conky

^thanks manuel-909 for sharing your files.  smile

Switching to "metric" results in the same error.
plasma53.th.png

Offline

#927 2018-03-09 15:01:00

manuel-909
Member
Registered: 2017-10-09
Posts: 81

Re: Show us your conky

unklar what are you using for? place="4787519" i change to metric seems working i can not change gust give me mph....
2018-03-09-09-41-49_scrot.th.png

Offline

#928 2018-03-09 15:30:30

manuel-909
Member
Registered: 2017-10-09
Posts: 81

Re: Show us your conky

i find it place="6548487"
2018-03-09-10-26-57_scrot.th.png

Offline

#929 2018-03-09 16:28:19

unklar
Member
Registered: 2015-10-31
Posts: 1,026

Re: Show us your conky

@manuel-909

Thank you for your time  smile

Then I have to do something wrong
These are my entries:
conkyrc

conky.text = [[
${execi 600 $HOME/dmanuel-weather/lua-weather.sh 6548487}

lua-weather.sh

#place="$1"              # Get $place from script parameter.
place="6548487"   # Uncomment and add name or id. NB If the name has spaces, then you must use the id.

# Choose fahrenheit/Imperial or Celcius/metric:
#metric='imperial'
metric='metric'

# data file
datafile="/home/unklarer/weather.txt"

error message

conky: desktop window (2200012) is subwindow of root window (4d5)
conky: window type - normal
conky: drawing to created window (0x5800002)
conky: drawing to double buffer
conky: forked to background, pid is 15057

/home/unklarer/dmanuel-weather/lua-weather.sh: Zeile 99: printf: 12.92: Ungültige Zahl.
/home/unklarer/dmanuel-weather/lua-weather.sh: Zeile 100: printf: 50.84: Ungültige Zahl.
/home/unklarer/dmanuel-weather/lua-weather.sh: Zeile 115: printf: 4.1: Ungültige Zahl.
conky: received SIGINT or SIGTERM to terminate. bye!

Show me your entries.

Last edited by unklar (2018-03-09 21:36:57)

Offline

#930 2018-03-09 16:43:31

unklar
Member
Registered: 2015-10-31
Posts: 1,026

Re: Show us your conky

Yours

plasma54.th.png

/home/unklarer/dmanuel-weather/lua-weather.sh: Zeile 99: printf: -78.22: Ungültige Zahl.
/home/unklarer/dmanuel-weather/lua-weather.sh: Zeile 100: printf: 39.08: Ungültige Zahl.
/home/unklarer/dmanuel-weather/lua-weather.sh: Zeile 102: printf: 38.88: Ungültige Zahl.
/home/unklarer/dmanuel-weather/lua-weather.sh: Zeile 104: printf: 35.6: Ungültige Zahl.
/home/unklarer/dmanuel-weather/lua-weather.sh: Zeile 105: printf: 42.8: Ungültige Zahl.
/home/unklarer/dmanuel-weather/lua-weather.sh: Zeile 115: printf: 19.46: Ungültige Zahl.
/home/unklarer/dmanuel-weather/lua-weather.sh: Zeile 119: printf: 38.88: Ungültige Zahl.
conky: received SIGINT or SIGTERM to terminate. bye!

Offline

#931 2018-03-09 18:08:06

manuel-909
Member
Registered: 2017-10-09
Posts: 81

Re: Show us your conky

did you install sudo apt-get install jq
can you show the output of datafile="/home/unklarer/weather.txt"

Last edited by manuel-909 (2018-03-09 18:13:05)

Offline

#932 2018-03-09 19:04:32

unklar
Member
Registered: 2015-10-31
Posts: 1,026

Re: Show us your conky

apt-cache policy jq
jq:
  Installiert:           1.5+dfsg-2
  Installationskandidat: 1.5+dfsg-2
  Versionstabelle:
 *** 1.5+dfsg-2 500
        500 http://deb.debian.org/debian unstable/main amd64 Packages
        100 /var/lib/dpkg/status
300
0,0 mph
1232
0014
0,0
Stephens City
overcast clouds
200
0,0 kn
0634
1804
5,0
Chemnitz, Stadt
clear sky

Offline

#933 2018-03-09 22:14:50

manuel-909
Member
Registered: 2017-10-09
Posts: 81

Re: Show us your conky

unklar seems that you are not getting the data correctly.
are you using the scripts that i post? or different ones....

Offline

#934 2018-03-09 23:03:21

manuel-909
Member
Registered: 2017-10-09
Posts: 81

Re: Show us your conky

let's do a little test run this change path's:
i forgot to fix icons sorry.....
conkyWeather

#!/bin/bash
# adapted from conkycolors by quakeguy
# --- http://weather.yahoo.com/ ---
# http://weather.yahooapis.com/forecastrss?w=WOEID&u=UNIT
# WOEID: Halle - 656853
# UNIT: c - Celsius, f - Fahrenheit
# (old id: Halle - GMXX0048)

# changed to weather.com
# since  03/2016 yahoo requires oauth2

#--- Cities: BEGIN
#GMXX0048 - Halle (Saale)
#GMXX0072 - Leipzig
#GMXX0007 - Berlin
#UKXX0085 - London
#ITXX0067 - Rom
#SPXX0050 - Madrid
#RSXX0063 - Moskau
#SFXX0010 - Kapstadt
#USNY0996 - New York
#USCA0638 - Los Angeles
#BRXX0201 - Rio de Janeiro
#CAXX0301 - Montreal
#EGXX0004 - Kairo
#CHXX0008 - Peking
#KSXX0037 - Seoul
#JAXX0085 - Tokio
#VMXX0006 - Hanoi
#ASXX0112 - Sydney
#--- Cities: END

# set location
LOCATION="GMXX0016"

# unit: m - metric, * - non metric
UNIT="m"

# weekdays in short form (german)
function getWeekDay() {
	case "$1" in
		Monday) echo "Mo." ;;
		Tuesday) echo "Tu." ;;
		Wednesday) echo "We." ;;
		Thursday) echo "Th." ;;
		Friday) echo "Fr." ;;
		Saturday) echo "Sa." ;;
		Sunday) echo "Su." ;;
	esac
}

#MAP_OLD=(1 2 3 n m x x y s h t h i p p 8 q u w 7 0 9 4 6 6 - f D d C c A a B b v 5 k k g j o r r - G 0 K)
MAP_CODE=(1 2 3 n m x x y s h t i i p p 8 q u w 7 0 9 4 6 8 - f e e C c A a B b v 5 k k k j o r r - G 0 K)
#change__(- - -                 c     x   x           - - c   / c c x x x x / x   -     c                )
#________(0                   1                   2                   3                   4              )

if   [ "$1" = "GET" ]; then
  curl -s 'http://wxdata.weather.com/wxdata/weather/local/'$LOCATION'?cc=*&dayf=5&unit='$UNIT -o ~/conky-conf/testing/weather-g/cache/weather.xml
elif [ "$1" = "unit_temperature" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<ut>/,1!d' | sed 's/.*<ut>\(.*\)<\/ut>.*/\1/'
elif [ "$1" = "unit_speed" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<us>/,1!d' | sed 's/.*<us>\(.*\)<\/us>.*/\1/'
elif [ "$1" = "location_city" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<dnam>/,1!d' | sed 's/.*<dnam>\(.*\)<\/dnam>.*/\1/' | sed 's/\(.*\),\(.*\),\(.*\)/\1/'
elif [ "$1" = "location_time" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<tm>/,1!d' | sed 's/.*<tm>\(.*\)<\/tm>.*/\1/'
elif [ "$1" = "condition_day" ]; then
	grep -oPm1 "(?<=<t>)[^<]+" ~/conky-conf/testing/weather-g/cache/weather.xml
elif [ "$1" = "Feels_Like" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<flik>/,1!d' | sed 's/.*<flik>\(.*\)<\/flik>.*/\1/'
elif [ "$1" = "wind_gust" ]; then
	grep -oPm1 "(?<=<gust>)[^<]+" ~/conky-conf/testing/weather-g/cache/weather.xml
elif [ "$1" = "wind_d" ]; then
	grep -oPm2 "(?<=<t>)[^<]+" ~/conky-conf/testing/weather-g/cache/weather.xml | sed -n '2p'
elif [ "$1" = "wind_chill" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<flik>/,1!d' | sed 's/.*<flik>\(.*\)<\/flik>.*/\1/'
elif [ "$1" = "wind_direction" ]; then
	WIND_DIRECTION=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<d>/,1!d' | sed -n '2p' | sed 's/.*<d>\(.*\)<\/d>.*/\1/')
	if [ "$WIND_DIRECTION" -lt "12" ]; then
		DR="N"
	elif [ "$WIND_DIRECTION" -lt "34" ]; then
		DR="NNE"
	elif [ "$WIND_DIRECTION" -lt "57" ]; then
		DR="NE"
	elif [ "$WIND_DIRECTION" -lt "79" ]; then
		DR="NEE"
	elif [ "$WIND_DIRECTION" -lt "102" ]; then
		DR="E"
	elif [ "$WIND_DIRECTION" -lt "124" ]; then
		DR="SEE"
	elif [ "$WIND_DIRECTION" -lt "147" ]; then
		DR="SE"
	elif [ "$WIND_DIRECTION" -lt "169" ]; then
		DR="SSE"
	elif [ "$WIND_DIRECTION" -lt "192" ]; then
		DR="S"
	elif [ "$WIND_DIRECTION" -lt "214" ]; then
		DR="SSW"
	elif [ "$WIND_DIRECTION" -lt "237" ]; then
		DR="SW"
	elif [ "$WIND_DIRECTION" -lt "259" ]; then
		DR="SWW"
	elif [ "$WIND_DIRECTION" -lt "282" ]; then
		DR="W"
	elif [ "$WIND_DIRECTION" -lt "304" ]; then
		DR="NWW"
	elif [ "$WIND_DIRECTION" -lt "327" ]; then
		DR="NW"
	elif [ "$WIND_DIRECTION" -lt "349" ]; then
		DR="NNW"
	else
		DR="N"
	fi
	WIND_SPEED=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<s>/,1!d' | sed -n '1p' | sed 's/.*<s>\(.*\)<\/s>.*/\1/')
	WS=${WIND_SPEED/.*}
# unit kmh or mph
  UNIT=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<us>/,1!d' | sed 's/.*<us>\(.*\)<\/us>.*/\1/')
# calcualte wind speed in kmh as integer
  if [ "$UNIT" == "mph" ]; then
    WS=$(echo $WS'*1.60934' | bc | sed 's/[.].*//')
  fi
### speed 'calm' = 0
  if [ "$WS" == "calm" ]; then
    WS=0
  fi
# 0: calm (0 kmh), light air (1-5 kmh)
	if [ "$WS" -lt "6" ]; then
		echo "%"
# 1: light breeze (6-11 kmh), gentle breeze (12-19 kmh)
	elif [ "$WS" -lt "20" ]; then
		case "$DR" in
			N)   echo "9" ;;
			NNE) echo ":" ;;
			NE)  echo ";" ;;
			NEE) echo "<" ;;
			E)   echo "=" ;;
			SEE) echo ">" ;;
			SE)  echo "?" ;;
			SSE) echo "@" ;;
			S)   echo "1" ;;
			SSW) echo "2" ;;
			SW)  echo "3" ;;
			SWW) echo "4" ;;
			W)   echo "5" ;;
			NWW) echo "6" ;;
			NW)  echo "7" ;;
			NNW) echo "8" ;;
		esac
# 2: moderate breeze (20-28 kmh), fresh breeze (29-38 kmh)
	elif [ "$WS" -lt "39" ]; then
		case "$DR" in
			N)   echo "I" ;;
			NNE) echo "J" ;;
			NE)  echo "K" ;;
			NEE) echo "L" ;;
			E)   echo "M" ;;
			SEE) echo "N" ;;
			SE)  echo "O" ;;
			SSE) echo "P" ;;
			S)   echo "A" ;;
			SSW) echo "B" ;;
			SW)  echo "C" ;;
			SWW) echo "D" ;;
			W)   echo "E" ;;
			NWW) echo "F" ;;
			NW)  echo "G" ;;
			NNW) echo "H" ;;
		esac
# 3: strong breeze (39-49 kmh), moderate gale (50-61 kmh)
	elif [ "$WS" -lt "62" ]; then
		case "$DR" in
			N)   echo "Y" ;;
			NNE) echo "Z" ;;
			NE)  echo "[" ;;
			NEE) echo "\\" ;;
			E)   echo "]" ;;
			SEE) echo "^" ;;
			SE)  echo "_" ;;
			SSE) echo "\`" ;;
			S)   echo "Q" ;;
			SSW) echo "R" ;;
			SW)  echo "S" ;;
			SWW) echo "T" ;;
			W)   echo "U" ;;
			NWW) echo "V" ;;
			NW)  echo "W" ;;
			NNW) echo "X" ;;
		esac
# 4: fresh gale (62-74 kmh), strong gale (75-88 kmh), whole gale (89-102 kmh), storm (103-117 kmh), hurricane (>117 kmh)
	else
		case "$DR" in
			N)   echo "i" ;;
			NNE) echo "j" ;;
			NE)  echo "k" ;;
			NEE) echo "l" ;;
			E)   echo "m" ;;
			SEE) echo "n" ;;
			SE)  echo "o" ;;
			SSE) echo "p" ;;
			S)   echo "a" ;;
			SSW) echo "b" ;;
			SW)  echo "c" ;;
			SWW) echo "d" ;;
			W)   echo "e" ;;
			NWW) echo "f" ;;
			NW)  echo "g" ;;
			NNW) echo "h" ;;
		esac
	fi
elif [ "$1" = "wind_speed" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<s>/,1!d' | sed -n '1p' | sed 's/.*<s>\(.*\)<\/s>.*/\1/'
elif [ "$1" = "atmosphere_humidity" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<hmid>/,1!d' | sed -n '1p' | sed 's/.*<hmid>\(.*\)<\/hmid>.*/\1/'
elif [ "$1" = "dew_point" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<dewp>/,1!d' | sed -n '1p' | sed 's/.*<dewp>\(.*\)<\/dewp>.*/\1/'
elif [ "$1" = "uv_index" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<i>/,1!d' | sed -n '1p' | sed 's/.*<i>\(.*\)<\/i>.*/\1/'
elif [ "$1" = "atmosphere_visibility" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<vis>/,1!d' | sed 's/.*<vis>\(.*\)<\/vis>.*/\1/'
elif [ "$1" = "astronomy_sunrise" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<sunr>/,1!d' | sed -n '1p' | sed 's/.*<sunr>\(.*\)<\/sunr>.*/\1/'
elif [ "$1" = "astronomy_sunset" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<suns>/,1!d' | sed -n '1p' | sed 's/.*<suns>\(.*\)<\/suns>.*/\1/'
elif [ "$1" = "condition_temp" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<tmp>/,1!d' | sed 's/.*<tmp>\(.*\)<\/tmp>.*/\1/'
elif [ "$1" = "wind_d" ]; then
	grep -oPm2 "(?<=<t>)[^<]+" ~/conky-conf/testing/weather-g/cache/weather.xml | sed -n '2p'
elif [ "$1" = "condition_temp" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<flik>/,1!d' | sed 's/.*<flik>\(.*\)<\/tmp>.*/\1/'
elif [ "$1" = "pressure" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<r>/,1!d' | sed 's/.*<r>\(.*\)<\/r>.*/\1/'
elif [ "$1" = "pressure_d" ]; then
	grep -oPm1 "(?<=<d>)[^<]+" ~/conky-conf/testing/weather-g/cache/weather.xml
elif [ "$1" = "condition_day" ]; then
	grep -oPm1 "(?<=<t>)[^<]+" ~/conky-conf/testing/weather-g/cache/weather.xml 
elif [ "$1" = "condition_code" ]; then
	CONDITION_CODE=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<icon>/,1!d' | sed -n '1p' | sed 's/.*<icon>\(.*\)<\/icon>.*/\1/')
  echo ${MAP_CODE[$CONDITION_CODE]}
elif [ "$1" = "condition_date" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<lsup>/,1!d' | sed -n '1p' | sed 's/.*<lsup>\(.*\)<\/lsup>.*/\1/'
elif [ "$1" = "forecast1_day" ]; then
	DAY1=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<day d="0"/,1!d' | sed 's/.* t="\(.*\)" .*/\1/')
	getWeekDay $DAY1
elif [ "$1" = "forecast1_low" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<low>/,1!d' | sed -n '1p' | sed 's/.*<low>\(.*\)<\/low>.*/\1/'
elif [ "$1" = "forecast1_high" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<hi>/,1!d' | sed -n '1p' | sed 's/.*<hi>\(.*\)<\/hi>.*/\1/'
elif [ "$1" = "forecast1_code" ]; then
	FORECAST1_CODE=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<icon>/,1!d' | sed -n '4p' | sed 's/.*<icon>\(.*\)<\/icon>.*/\1/')
  echo ${MAP_CODE[$FORECAST1_CODE]}
elif [ "$1" = "forecast1_rain" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<ppcp>/,1!d' | sed -n '2p' | sed 's/.*<ppcp>\(.*\)<\/ppcp>.*/\1/'
elif [ "$1" = "forecast2_day" ]; then
	DAY2=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<day d="1"/,1!d' | sed 's/.* t="\(.*\)" .*/\1/')
	getWeekDay $DAY2
elif [ "$1" = "forecast2_low" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<low>/,1!d' | sed -n '2p' | sed 's/.*<low>\(.*\)<\/low>.*/\1/'
elif [ "$1" = "forecast2_high" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<hi>/,1!d' | sed -n '2p' | sed 's/.*<hi>\(.*\)<\/hi>.*/\1/'
elif [ "$1" = "forecast2_code" ]; then
	FORECAST2_CODE=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<icon>/,1!d' | sed -n '5p' | sed 's/.*<icon>\(.*\)<\/icon>.*/\1/')
  echo ${MAP_CODE[$FORECAST2_CODE]}
elif [ "$1" = "forecast2_rain" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<ppcp>/,1!d' | sed -n '3p' | sed 's/.*<ppcp>\(.*\)<\/ppcp>.*/\1/'
elif [ "$1" = "forecast3_day" ]; then
	DAY3=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<day d="2"/,1!d' | sed 's/.* t="\(.*\)" .*/\1/')
	getWeekDay $DAY3
elif [ "$1" = "forecast3_low" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<low>/,1!d' | sed -n '3p' | sed 's/.*<low>\(.*\)<\/low>.*/\1/'
elif [ "$1" = "forecast3_high" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<hi>/,1!d' | sed -n '3p' | sed 's/.*<hi>\(.*\)<\/hi>.*/\1/'
elif [ "$1" = "forecast3_code" ]; then
	FORECAST3_CODE=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<icon>/,1!d' | sed -n '7p' | sed 's/.*<icon>\(.*\)<\/icon>.*/\1/')
  echo ${MAP_CODE[$FORECAST3_CODE]}
elif [ "$1" = "forecast3_rain" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<ppcp>/,1!d' | sed -n '5p' | sed 's/.*<ppcp>\(.*\)<\/ppcp>.*/\1/'
elif [ "$1" = "forecast4_day" ]; then
	DAY4=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<day d="3"/,1!d' | sed 's/.* t="\(.*\)" .*/\1/')
	getWeekDay $DAY4
elif [ "$1" = "forecast4_low" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<low>/,1!d' | sed -n '4p' | sed 's/.*<low>\(.*\)<\/low>.*/\1/'
elif [ "$1" = "forecast4_high" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<hi>/,1!d' | sed -n '4p' | sed 's/.*<hi>\(.*\)<\/hi>.*/\1/'
elif [ "$1" = "forecast4_code" ]; then
	FORECAST4_CODE=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<icon>/,1!d' | sed -n '9p' | sed 's/.*<icon>\(.*\)<\/icon>.*/\1/')
  echo ${MAP_CODE[$FORECAST4_CODE]}
elif [ "$1" = "forecast4_rain" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<ppcp>/,1!d' | sed -n '7p' | sed 's/.*<ppcp>\(.*\)<\/ppcp>.*/\1/'
elif [ "$1" = "forecast5_day" ]; then
	DAY5=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<day d="4"/,1!d' | sed 's/.* t="\(.*\)" .*/\1/')
	getWeekDay $DAY5
elif [ "$1" = "forecast5_low" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<low>/,1!d' | sed -n '5p' | sed 's/.*<low>\(.*\)<\/low>.*/\1/'
elif [ "$1" = "forecast5_high" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<hi>/,1!d' | sed -n '5p' | sed 's/.*<hi>\(.*\)<\/hi>.*/\1/'
elif [ "$1" = "forecast5_code" ]; then
	FORECAST5_CODE=$(cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<icon>/,1!d' | sed -n '11p' | sed 's/.*<icon>\(.*\)<\/icon>.*/\1/')
  echo ${MAP_CODE[$FORECAST5_CODE]}
elif [ "$1" = "forecast5_rain" ]; then
	cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<ppcp>/,1!d' | sed -n '9p' | sed 's/.*<ppcp>\(.*\)<\/ppcp>.*/\1/'
else
	echo "Error: undefined option"
fi

conkyrc:

conky.config = {
--Use XFT?
	use_xft = true,
	font = 'zekton:size=10',
	xftalpha = 0.8,
	text_buffer_size = 2048,
	max_text_width = 0,
	override_utf8_locale = true,
	uppercase = false,
	no_buffers = true,
	short_units = true,
	format_human_readable = true,

-- Like it says, ot pads the decimals on % values
-- doesn't seem to work since v1.7.1
	pad_percents = 2,

-- Update interval in seconds
	update_interval = 1,

-- This is the number of times Conky will update before quitting.
-- Set to zero to run forever.
	total_run_times = 0,

-- Create own window instead of using desktop (required in nautilus)
	own_window = true,
	own_window_transparent = true,
	own_window_type = 'desktop',
	own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
 own_window_argb_visual = true,
 own_window_argb_value = 255,
	background = true,
	use_spacer = 'none',

-- Use double buffering (reduces flicker, may not work for everyone)
	double_buffer = true,

-- Minimum size of text area -adjust if you would like to user smaller fonts etc.
	minimum_width = 305, minimum_height = 0,
	--maximum_width = 300,
	--max_specials = '1024',
	max_user_text = 16384,
--default_bar_size 215 5

-- Desired output unit of all objects displaying a temperature. Parameters are
-- either "fahrenheit" or "celsius". The default unit is degree Celsius.
	temperature_unit = 'fahrenheit',

-- Draw shades?
	draw_shades = false,
	default_shade_color = '#000000',

-- Draw outlines?
	draw_outline = false,
	default_outline_color = '#000000',

--##  Color Settings
	default_color = 'b2b2b2', 
color0 = '555555',         
color1 = '483D8B',         -- Dark Slate Blue
color2 = 'B8860B',         -- Dark goldenrod
color3 = '#7FFF00',--127 255   0	Chartreuse
color4 = '8B0000',         -- Dark red
color5 = '008080',         -- Teal
color6 = '#778899',--119 136 153	LightSlateGray
color7 = 'C8C8FF',         -- (COOL)
color8 = 'FFFFCC',         -- (WARM)
color9 = 'FCCCCC',         -- (HOT) 

-- Draw borders around text
	draw_borders = false,

-- Stippled borders?
	stippled_borders = 0,

-- border margins
	border_inner_margin = 10,
	border_outer_margin = 0,

-- border width
	border_width = 1,

-- graph borders
	draw_graph_borders = false,--no
--default_graph_size 15 40
--show_graph_range = false,
--show_graph_scale = false,

-- Text alignment, other possible values are commented
alignment = 'top_left',
--alignment = 'top_right',
--alignment = 'top_middle',
--alignment = 'bottom_left',
--alignment = 'bottom_right',
--alignment = 'bottom_middle',
--alignment = 'middle_left',

-- Gap between borders of screen and text
-- same thing as passing -x at command line
	gap_x = 10,
	gap_y = 300,


-- -- Lua Load -- #
--lua_load = '~/.draw-bg.lua',
-- ${lua conky_draw_bg 20 0 0 0 0 0x000000 0.2}
--lua_draw_hook_pre = 'draw_bg 20 0 0 0 0 0x000000 0.2'
--lua_draw_hook_post = 'draw_bg 20 0 0 0 0 0x000000 0.2',

-- -- Album art fix -- #
	imlib_cache_size = 0,

-- ASCII Characters
-- │ ─ ┌ ┬ ┐ └ ┴ ┘ ├ ┼ ┤
-- ║ ═ ╔ ╦ ╗ ╚ ╩ ╝ ╠ ╬ ╣

-- ↑ ↓ → ← ↔ ► ◄ ▲ ▼ « »
-- ░  ▒  ▓ ☺ ☻ ♥ ♦ ♣ ♠
-- • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼
-- ¼ ½ ¾ ® ©

 
--loadall--
lua_load = 'settings.lua ./scripts/loadall.lua' ,
lua_draw_hook_post = 'main',
lua_startup_hook = 'vars',


};

conky.text = [[
${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather GET}
${voffset -15}${color7}Weather ${hr 1}
${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather location_city}${font}     ${time %a %b %Y}      ${color9}${time %I} ${blink :} ${time %M} ${time %P}
${color3}Now: ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather condition_day}${font}
${color3}Temp: ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather condition_temp} °${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather unit_temperature}${alignr}${color3}Feels Like: ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather Feels_Like}${font} °${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather unit_temperature}
${color3}Wind: ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather wind_speed} ${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather unit_speed} ${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather wind_d} | Gust: ${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather wind_gust} ${execi 600 ~/conky-conf/testing/weather-d/bin/conkyWeather unit_speed} \
${alignr}${color3}Humidity: ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather atmosphere_humidity}%
${color3}H/L: ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather forecast1_high} | ${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather forecast1_low} °${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather unit_temperature}${alignr}${color3} Pressure: ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather pressure} ${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather pressure_d}
${color3}Sunup: ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather astronomy_sunrise}${alignr}${color3}SunDownd: ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather astronomy_sunset}
${color3}Dew point: ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather dew_point} °${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather unit_temperature}${alignr 8}${color3}UV Index: ${color}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather uv_index}
${color3}${execi 600 (cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<day d="1"/,1!d' | sed 's/.* t="\(.*\)" .*/\1/')}: ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather forecast2_high} | ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather forecast2_low} °${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather unit_temperature}
${goto 10}${execi 600 grep -A 2 -Pm2 '(?<=<part p="d")[^<]+' ~/conky-conf/testing/weather-g/cache/weather.xml | sed -n '7p' | grep -oPm2 '(?<=<t>)[^<]+'}  |  \
wind ${execi 600 grep -oPm4 "(?<=<s>)[^<]+" ~/conky-conf/testing/weather-g/cache/weather.xml | sed -n '4p'} ${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather unit_speed} \
${execi 600 grep -A 8 -Pm2 '(?<=<part p="d")[^<]+' ~/conky-conf/testing/weather-g/cache/weather.xml | sed -n '18p' | grep -oPm1 '(?<=<t>)[^<]+'}
${color3}${execi 600 (cat ~/conky-conf/testing/weather-g/cache/weather.xml | sed '/<day d="2"/,1!d' | sed 's/.* t="\(.*\)" .*/\1/')}: ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather forecast3_high} | ${color7}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather forecast3_low} °${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather unit_temperature}
${goto 10}${execi 600 grep -A 8 -Pm3 '(?<=<day d="2")[^<]+' ~/conky-conf/testing/weather-g/cache/weather.xml | sed -n '9p' | grep -oPm3 '(?<=<t>)[^<]+'}  |  wind \
${execi 600 grep -A 10 -Pm3 '(?<=<day d="2")[^<]+' ~/conky-conf/testing/weather-g/cache/weather.xml | sed -n '11p' | grep -oPm3 '(?<=<s>)[^<]+'} ${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather unit_speed} \
${execi 600 grep -A 13 -Pm3 '(?<=<day d="2")[^<]+' ~/conky-conf/testing/weather-g/cache/weather.xml | sed -n '14p' | grep -oPm3 '(?<=<t>)[^<]+'}
${goto 115}${voffset -100}${if_gw}${color8}${font ConkyColorsWeather:size=35}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather condition_code}${font}
${goto 162}${voffset -50}${color8}${font ConkyWindNESW:size=30}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather wind_direction}${font}${color}
${goto 260}${voffset}${color8}${font ConkyColorsWeather:size=24}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather forecast2_code}${font}
${goto 260}${voffset -10}${color8}${font ConkyColorsWeather:size=24}${execi 600 ~/conky-conf/testing/weather-g/bin/conkyWeather forecast3_code}${font}
${voffset -5}${alignc}Last:${color}${execi 600 grep -oPm1 "(?<=<lsup>)[^<]+" ~/conky-conf/testing/weather-g/cache/weather.xml}
${voffset -160}
]];

2018-03-09-18-51-33_scrot.th.png

Last edited by manuel-909 (2018-03-09 23:53:15)

Offline

#935 2018-03-10 11:06:27

unklar
Member
Registered: 2015-10-31
Posts: 1,026

Re: Show us your conky

manuel-909 wrote:

unklar seems that you are not getting the data correctly.
are you using the scripts that i post? or different ones....

I use your conkyrc and lua-weather.sh   wink

let's do a little test run this change path's:

why you want to do a test run with another weather data provider (intellicast) now. This is not the problem, see
v9000_1.th.jpg

I can also use v9000 from @mrpeachy and @Sector11 from the year 2012, because this still works (which incidentally also applies to @TeoBigusGeekus' weather scripts without Lua)!  big_smile


It's about the fact that openweathermap, as I found out in the meantime, at least changed the API version. If you are able to integrate the changes in damo's script call, devil  I cannot.

Thank you very much for your time invested.  smile

Last edited by unklar (2018-03-10 11:08:50)

Offline

#936 2018-03-10 14:00:15

manuel-909
Member
Registered: 2017-10-09
Posts: 81

Re: Show us your conky

your welcome  smile
Do you mind to share the files for v9000 cannot make it work?  smile

Last edited by manuel-909 (2018-03-10 14:50:20)

Offline

#937 2018-03-10 18:32:57

unklar
Member
Registered: 2015-10-31
Posts: 1,026

Re: Show us your conky

manual-909, also easy to share  wink

The v9000 is the predecessor of WUN-Weather's mrpeachy. Unfortunately, the links to the former chrunchbang forum often don't work anymore.
But I took precautions two years ago....       You should get ahead with the archive.   wink

Offline

#938 2018-03-10 19:57:00

manuel-909
Member
Registered: 2017-10-09
Posts: 81

Re: Show us your conky

thank you is the one i have but i cannot make it work.
lua load problem.
2018-03-10-14-55-19_scrot.th.png

Offline

#939 2018-03-10 20:14:31

unklar
Member
Registered: 2015-10-31
Posts: 1,026

Re: Show us your conky

^^ the conkyrc is written in version 1.9    big_smile

Offline

#940 2018-03-10 22:12:04

manuel-909
Member
Registered: 2017-10-09
Posts: 81

Re: Show us your conky

thank you nothing to do then.     yikes

Offline

#941 2018-03-11 09:12:35

unklar
Member
Registered: 2015-10-31
Posts: 1,026

Re: Show us your conky

I don't understand now, should I convert the syntax to version 1.10?
You work so much with Lua, I assumed it was no problem for you.  tongue

OK
I myself have never tested this under version 1.10. You're the first.
copy my conky-weather to the directory "v9000" and execute the command:

lua convert.lua conky_weather conky_weather10

(of course, the script from /usr/share/doc/conky-xx/convert.lua must also be there!)

It comes out
conky_weather10

conky.config = {
-- pkill -xf "conky -q -c ~/v9000/conky_weather" &
--#############################################
--  Settings
--#############################################
--max_specials 10000
--max_user_text 1500000
	background = true,
	use_xft = true,
--xftfont Sans:size=12
--xftalpha 1
	font = 'Mono:size=8',
	total_run_times = 0,
	own_window = true,
	own_window_transparent = true,
	own_window_type = 'normal',
	own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
	own_window_colour = '#000000',
	own_window_class = 'Conky',
	own_window_argb_visual = true,
	own_window_argb_value = 80,
	double_buffer = true,
	minimum_width = 400, minimum_height = 400,
	maximum_width = 400,
	draw_shades = true,
	draw_outline = false,

	draw_borders = false,
-- Stippled borders?
	stippled_borders = 5,
-- border margins
	border_inner_margin = 5,
	border_outer_margin = 0,
-- border width
	border_width = 2,
-- graph borders
--default_graph_size 15 40

	draw_graph_borders = true,
	default_color = 'white',
	default_shade_color = 'black',
	default_outline_color = 'white',
--alignment middle_right
--alignment top_left
	alignment = 'bottom_right',
	gap_x = 30,
	gap_y = 30,
	no_buffers = true,
	uppercase = false,
	cpu_avg_samples = 2,
	override_utf8_locale = true,
	color1 = '#86acad',--darker blue
	color2 = '#b1c9c9',--lighter blue
	text_buffer_size = 100000,
	top_name_width = 10,
	update_interval = 10,

	lua_load = '~/v9000/v9000.lua',
	lua_draw_hook_pre = 'weather',

	lua_load = '~/v9000/s11template.lua',
	lua_load = '~/LUA/draw-bg.lua',

};

conky.text = [[
${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}



















${membar 0}
]];

I prophesy, it doesn't work because conky10 is actually crap.   monkey

Offline

#942 2018-03-11 13:04:37

manuel-909
Member
Registered: 2017-10-09
Posts: 81

Re: Show us your conky

tank's unklar dosen't work got the same error (function conky_weather execution failed)
i guess v9000 dosent work on 1.106.1  neutral

Offline

#943 2018-03-15 22:16:26

manuel-909
Member
Registered: 2017-10-09
Posts: 81

Re: Show us your conky

Ok unklar try this if this don't work maybe you need to generate other key from openwather
not sure:

lua-weather.sh

#!/bin/bash
#
#   bunsenweather.sh: a conky weather script
#   Copyright (C) 2013 Ryan Fantus
#   Copyright (C) 2016 damo  <damo@bunsenlabs.org>
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

## Requires:
##          'jq' (sudo apt-get install jq);
##          API Key from http://openweathermap.org/api
##
## USAGE: Call this script from Conky with ( replace "<t>" with the update interval)
##          ${execpi <t> /path/to/bunsenweather.sh [location]}


#### User configurables:  ##############################################

# Get API KEY by registering for one at http://openweathermap.org/api
#api="your very long api number"
api="xxxxxxxxxxxxxxxxxxxxxxxxx"

# Either set the location manually here, or by passing it as a script parameter in the Conky.
# "yourlocation" must be a name (which doesn't have spaces), or a numeric id.
#
# id's can be obtained from http://bulk.openweathermap.org/sample/city.list.json.gz
# Download and extract the json file, then simply search for an id with grep.
#   For example:   grep "New York" city.list.json
#
# If $place is not set, then the script attempts to get a geolocation from the IP address.

place="6548487"              # Get $place from script parameter.
#place="yourlocation"   # Uncomment and add name or id. NB If the name has spaces, then you must use the id.

# Choose fahrenheit/Imperial or Celcius/metric:
#metric='imperial'
metric='metric'

#########################################################################
connectiontest() {
    local -i i attempts=${1-0}
    for (( i=0; i < attempts || attempts == 0; i++ )); do
        if wget -O - 'http://ftp.debian.org/debian/README' &> /dev/null; then
            return 0
        fi
        if (( i == attempts - 1 )); then # if last attempt
            return 1
        fi
    done
}

placeholder() {
    if (( $1 == 1 )) &>/dev/null;then
        echo "No internet connection"
        echo "Weather information unavailable"
    else
        echo "No API key"
        echo "Weather information unavailable"
    fi
}

if [[ $metric == metric ]] &>/dev/null;then
    scaleT="°C"
    scaleV="k/s"
else
    scaleT="°F"
    scaleV="mph"
fi

if [[ -z "$api" ]] &>/dev/null;then
    placeholder 0 && exit 1
else
    connectiontest 10

    # If latlong is preferred then don't set a value for $place
    if (( $? == 0 )) &>/dev/null;then
        if [[ -z $place ]] &>/dev/null;then
            # Geolocate IP:
            ipinfo=$(curl -s ipinfo.io)
            latlong=$(echo "$ipinfo" | jq -r '.loc')
            # Parse the latitude and longitude
            lat=${latlong%,*}
            long=${latlong#*,}
            location="lat=$lat&lon=$long"
        else
            # check if numeric id, or placename is being used
            [[ ${place##*[!0-9]*} ]] &>/dev/null && location="id=$place" || location="q=$place"
        fi

        # get json data from openweathermap:
        weather=$(curl -s http://api.openweathermap.org/data/2.5/weather\?APPID=$api\&"$location"\&units=$metric)
        city=$(echo "$weather" | jq -r '.name') # In case location has spaces in the name
        weather_desc=$(echo "$weather" | jq -r '.weather[0].description')   # In case description has spaces in the name

        # load values into array:
        all=($(echo "$weather" | jq -r '.coord.lon,.coord.lat,.weather[0].main,.main.temp,.main.pressure,.main.temp_min,.main.temp_max,.wind.speed,.wind.deg,.clouds.all,.sys.sunrise,.sys.sunset,.main.humidity'))
        #                   ARRAY INDEX  0          1          2                3          4              5              6              7           8         9           10           11          12

        longitude=$(printf '%06.1f' ${all[0]})
        latitude=$(printf '%+.1f' ${all[1]})
        condition="${all[2]}"
        temperature=$(printf '%+.1f%s' ${all[3]} $scaleT)
        pressure=$(printf '%.f %s' ${all[4]} hPa)
        temperature_min=$(printf '%+.1f%s' ${all[5]} $scaleT)
        temperature_max=$(printf '%+.1f%s' ${all[6]} $scaleT)
        windspeed=$(printf '%.1f %s' ${all[7]} $scaleV)
        winddir=$(printf '%3.f%s' ${all[8]} °)
        cloud_cover=$(printf '%d%s' ${all[9]} %)
        sunrise=$(date -d @${all[10]} +"%R")
        sunset=$(date -d @${all[11]} +"%R")
        humidity="${all[12]}%"
        description="$weather_desc"

        #Example format for output:
        printf "%s \n%s\ntemp: %s\nwind: %s %s\nPressure: %s\nH/L: %s | %s\nCloud Cover: %s\nHumidity: %s\nSunrise: %s\nSunset: %s" "$city" "$description" "$temperature" "$windspeed" "$winddir" "$pressure" "$temperature_max" "$temperature_min" "$cloud_cover" "$humidity" "$sunrise" "$sunset"
        

    else
        placeholder 1
    fi
fi

exit

conky:
};

conky.text = [[
${color white}${execi 300 ~/conky-conf/testing/weather-g/lua-weather.sh 6548487}
]];
2018-03-15-18-08-22_scrot.th.png

Last edited by manuel-909 (2018-03-15 22:18:51)

Offline

#944 2018-03-16 20:19:06

unklar
Member
Registered: 2015-10-31
Posts: 1,026

Re: Show us your conky

^ manuel-909

Thank you very much for your effort!

Deffinitely, I would need my own key.
What bothers me is that with openweather I don't get as detailed information for my place of residence as is the case with Accuweather or Intellicast.  hmm

That's why I'm not going to follow this up any further now.

Offline

#945 2018-03-16 22:17:53

manuel-909
Member
Registered: 2017-10-09
Posts: 81

Re: Show us your conky

ok at least we try  smile

Offline

#946 2018-03-17 06:39:45

ohnonot
...again
Registered: 2015-09-29
Posts: 4,297
Website

Re: Show us your conky

hello everyone,
i need to learn some lua-conky!
could you please point me to a well-written, well-maintained conky that uses lua?

Last edited by ohnonot (2018-03-17 06:40:28)

Offline

#947 2018-03-17 12:43:47

unklar
Member
Registered: 2015-10-31
Posts: 1,026

Re: Show us your conky

^It's not that easy, especially since I think you have a much greater experience/knowledge than I have.  wink

From my stomach it was these two that worked with the slightest adjustments from the box.
PackRat
mrneilypops
(as you can see, maintenance is one of those things)

To be able to continue using the excellent Lua scripts that were used in the past with conky1.9 in conky1.10, the ideas of @Indian and @manuel-909 were most convincing for me so far. launcher.lua

package.path = '/home/unklar/LUA/?.lua'
require 'draw_bg'
--require 'text'
--require 'time'
--require 'equalizer'

function conky_Hour_Main()
    return conky_Hour()
end
function conky_Minute_Main()
    return conky_Minute()
end

function conky_main()
    conky_draw_bg(10, 0, 0, 220, 320, 0x000000, 0.3)
--    conky_draw_bg(10, 30, 90, 241, 95, 0x000000, 0.4)
--    digits()
end 
 

However, the requirements for a normal user who likes to play with Conky configurations on his desktop are, in my opinion, no longer solvable.  hmm

Offline

#948 2018-03-17 19:45:51

unklar
Member
Registered: 2015-10-31
Posts: 1,026

Re: Show us your conky

Hello, loutch,

remember what you did here about system formatting?

I have

LANG=de_DE.UTF-8

and made all changes proposed by @damo. Still, I can't see any wind. The error message is always

/home/unklarer/damo-weather/lua-weather.sh: Zeile 99: printf: 12.92: Ungültige Zahl
/home/unklarer/damo-weather/lua-weather.sh: Zeile 100: printf: 50.83: Ungültige Zahl
/home/unklarer/damo-weather/lua-weather.sh: Zeile 115: printf: 15.5: Ungültige Zahl
/home/loutch/2b_Wunderground_API/scripts/lua-weather.sh: ligne 100 : printf: 7.07: nombre non valable

This is my weather.sh

#!/bin/bash
#
## lua-weather.sh by <damo> July 2016
## Adapted from bunsenweather.sh, which was based on ideas from 
## weatherbang.sh version 1.0, 2013 by Ryan Fantus
##
## Requires:
##          'jq' (sudo apt-get install jq);
##          API Key from http://openweathermap.org/api
##
## USAGE: Call this script from Conky with ( replace "<t>" with the update interval)
##          ${execpi <t> /path/to/lua-weather.sh [location]}


#### User configurables:  ##############################################

# Get API KEY by registering for one at http://openweathermap.org/api
api="xxxxxxxxxxxxxxxxxxxxxxxx"

# Either set the location manually here, or by passing it as a script parameter in the Conky.
# "yourlocation" must be a name (which doesn't have spaces), or a numeric id.
#
# id's can be obtained from http://bulk.openweathermap.org/sample/city.list.json.gz
# Download and extract the json file, then simply search for an id with grep. 
#   For example:   grep "New York" city.list.json
#
# If $place is not set, then the script attempts to get a geolocation from the IP address.
LANG="en_GB.UTF-8"
#place="$1"              # Get $place from script parameter.
place="2940132"   # Uncomment and add name or id. NB If the name has spaces, then you must use the id.

# Choose fahrenheit/Imperial or Celcius/metric:
#metric='imperial'
metric='metric'

# data file
datafile="/tmp/weather.txt"

#########################################################################
connectiontest() {
    local -i i attempts=${1-0}
    for (( i=0; i < attempts || attempts == 0; i++ )); do
        if wget -O - 'http://ftp.debian.org/debian/README' &> /dev/null; then
            return 0
        fi
        if (( i == attempts - 1 )); then # if last attempt
            return 1
        fi
    done
}

placeholder() {
    if (( $1 == 1 )) &>/dev/null;then
        echo "No internet connection"
        echo "Weather information unavailable"
    else
        echo "No API key"
        echo "Weather information unavailable"
    fi
}

if [[ $metric == metric ]] &>/dev/null;then
    scaleT="°C"
    scaleV="m/s"
else
    scaleT="°F"
    scaleV="mph"
fi

if [[ -z "$api" ]] &>/dev/null;then
    placeholder 0 && exit 1
else
    connectiontest 10
    
    # If latlong is preferred then don't set a value for $place
    if (( $? == 0 )) &>/dev/null;then
        if [[ -z $place ]] &>/dev/null;then
            # Geolocate IP:
            ipinfo=$(curl -s ipinfo.io)
            latlong=$(echo "$ipinfo" | jq -r '.loc')
            # Parse the latitude and longitude
            lat=${latlong%,*}
            long=${latlong#*,}
            location="lat=$lat&lon=$long"
        else
            # check if numeric id, or placename is being used
            [[ ${place##*[!0-9]*} ]] &>/dev/null && location="id=$place" || location="q=$place"
        fi

        # get json data from openweathermap:
        weather=$(curl -s http://api.openweathermap.org/data/2.5/weather\?APPID=$api\&"$location"\&units=$metric)
        city=$(echo "$weather" | jq -r '.name') # In case location has spaces in the name
        weather_desc=$(echo "$weather" | jq -r '.weather[0].description')   # In case description has spaces in the name

        # load values into array:
        all=($(echo "$weather" | jq -r '.coord.lon,.coord.lat,.weather[0].main,.main.temp,.main.pressure,.main.temp_min,.main.temp_max,.wind.speed,.wind.deg,.clouds.all,.sys.sunrise,.sys.sunset'))
        #                   ARRAY INDEX  0          1          2                3          4              5              6              7           8         9           10           11

        longitude=$(printf '%06.1f' ${all[0]})
        latitude=$(printf '%+.1f' ${all[1]})
        condition="${all[2]}"
        temperature=$(printf '%+.1f%s' ${all[3]} $scaleT)
        pressure=$(printf '%.f %s' ${all[4]} mb)
        temperature_min=$(printf '%+.1f%s' ${all[5]} $scaleT)
        temperature_max=$(printf '%+.1f%s' ${all[6]} $scaleT)
        cloud_cover=$(printf '%d%s' ${all[9]} %)
        sunrise=$(date -d @${all[10]} +"%R")
        sunset=$(date -d @${all[11]} +"%R")
        description="$weather_desc"
        winddir=$(printf '%3.f%s' ${all[8]} °)
        
        winddir=${all[8]}
        echo ${winddir%.*} > "$datafile"
        windspeed=$(echo ${all[7]}*1.9 | bc)
        windspeed=$(printf '%01.1f %s' "$windspeed" "kn")
        echo "$windspeed" | sed 's/,/./' >> "$datafile"
        echo "$sunrise" | sed 's/://' >> "$datafile"
        echo "$sunset" | sed 's/://'>> "$datafile"
        temp_degrees=$(printf '%.1f' ${all[3]})
        echo "$temp_degrees" >> "$datafile"
        echo "$city" >> "$datafile" 
        echo "$description" >> "$datafile"

    else
        placeholder 1
    fi
fi

exit 

Offline

#949 2018-03-18 05:23:53

manuel-909
Member
Registered: 2017-10-09
Posts: 81

Re: Show us your conky

weather now:
2018-03-18-01-21-57_scrot.th.png

Offline

#950 2018-03-18 18:27:16

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,168

Re: Show us your conky

ohnonot wrote:

hello everyone,
i need to learn some lua-conky!
could you please point me to a well-written, well-maintained conky that uses lua?

The BL conky thread

conky at deviant art

arch linux conky thread

plenty of conky with lua there.

You just looking to hack/learn some lua, or you after something in particular?

Last edited by PackRat (2018-03-18 18:27:38)


You must unlearn what you have learned.
    -- yoda

Offline

Board footer

Powered by FluxBB