0 Mitglieder und 1 Gast betrachten dieses Thema.
Eine weitere Option ist, die Wettersymbole lokal vorzuhalten, das textuelle Wetter auszuwerten und das passende lokale Wettersymbol an Conky auszuspielen.
wget -qO- 'de.wttr.in/hademstorf_Niedersachsen?format=+%C\n+%t+%w+%P+%h\n' | sed 's|^ *||;s| *$||' >Wetter.txt
ln -sf "$(sed -n '1p' Wetter.txt).gif" Wetter.gif
ZitatEine weitere Option ist, die Wettersymbole lokal vorzuhalten, das textuelle Wetter auszuwerten und das passende lokale Wettersymbol an Conky auszuspielen.... und da bin ich am Ende meiner Kenntnisse...
#!/usr/bin/env python3# -*- coding: utf-8 -*-## wetter.py# pylint: disable=missing-docstring# pylint: disable=invalid-nameimport urllib.requestimport jsondef get_weather_image(weather_code): # FIXME Wettercodes auf Bilder "mappen" if weather_code in {"182", "185", "281", "284", "311", "314", "317", "350", "377"}: return "LightSleet.png" if weather_code in {"266", "293", "296"}: return "LightRain.png" return "Unknown.png"def get_winddir_image(winddir_code): # FIXME Windrichtung auf Bilder "mappen" if winddir_code in {"N", "E", "S", "W", "NE", "NW", "SE", "SW", "NNE", "NNW", "SSE", "SSW", "ENE", "ESE", "WNW", "WSW"}: return winddir_code + ".png" return "Unknown.png"response = Nonetry: response = urllib.request.urlopen("http://de.wttr.in/hademstorf_Niedersachsen?format=j1") weather = json.loads(response.read()) #print(json.dumps(weather, indent=4)) weatherCode = weather.get("current_condition")[0].get("weatherCode") temp_C = weather.get("current_condition")[0].get("temp_C") winddir16Point = weather.get("current_condition")[0].get("winddir16Point") windspeedKmph = weather.get("current_condition")[0].get("windspeedKmph") pressure = weather.get("current_condition")[0].get("pressure") humidity = weather.get("current_condition")[0].get("humidity") #print(weatherCode) print("${image ~/.conky/weather_images/" + get_weather_image(weatherCode) + " -p 0,8 -s 16x16}") print(temp_C + chr(176) + "C") #print(winddir16Point) print("${image ~/.conky/winddir_images/" + get_winddir_image(winddir16Point) + " -p 0,32 -s 16x16}") print(windspeedKmph + "km/h") print(pressure + "hPa") print(humidity + "%")except IOError: print("Wetter nicht verfügbar")finally: response.close()
# conky.text = [[${execpi 900 ~/.conky/wetter.py}]];
#!/usr/bin/env python3# -*- coding: utf-8 -*-""" reads weather data from wttr.in - see https://github.com/chubin/wttr.in """# pylint: disable=missing-function-docstring# pylint: disable=invalid-nameimport urllib.requestimport jsondef get_weather_image(weather_code): if weather_code in {"113"}: return "Sunny.png" if weather_code in {"116"}: return "PartlyCloudy.png" if weather_code in {"119"}: return "Cloudy.png" if weather_code in {"122"}: return "VeryCloudy.png" if weather_code in {"143", "248", "260"}: return "Fog.png" if weather_code in {"176", "263", "353"}: return "LightShowers.png" if weather_code in {"179", "362", "365", "374"}: return "LightSleetShowers.png" if weather_code in {"182", "185", "281", "284", "311", "314", "317", "350", "377"}: return "LightSleet.png" if weather_code in {"200", "386"}: return "ThunderyShowers.png" if weather_code in {"227", "320"}: return "LightSnow.png" if weather_code in {"230", "329", "332", "338"}: return "HeavySnow.png" if weather_code in {"266", "293", "296"}: return "LightRain.png" if weather_code in {"299", "305", "356"}: return "HeavyShowers.png" if weather_code in {"302", "308", "359"}: return "HeavyRain.png" if weather_code in {"323", "326", "368"}: return "LightSnowShowers.png" if weather_code in {"335", "371", "395"}: return "HeavySnowShowers.png" if weather_code in {"389"}: return "ThunderyHeavyRain.png" if weather_code in {"392"}: return "ThunderySnowShowers.png" return "Unknown.png"WINDDIR_CODE_DICT = {"N": "N", "E": "O", "S": "S", "W": "W", "NE": "NO", "NW": "NW", "SE": "SO", "SW": "SW", "NNE": "NNO", "NNW": "NNW", "SSE": "SSO", "SSW": "SSW", "ENE": "ONO", "ESE": "OSO", "WNW": "WNW", "WSW": "WSW"}def get_winddir_de(winddir_code): if winddir_code not in WINDDIR_CODE_DICT: return "???" return WINDDIR_CODE_DICT[winddir_code]response = Nonetry: response = urllib.request.urlopen( "http://de.wttr.in/hademstorf_Niedersachsen?format=j1") weather = json.loads(response.read()) # print(json.dumps(weather, indent=4)) weatherCode = weather.get("current_condition")[0].get("weatherCode") temp_C = weather.get("current_condition")[0].get("temp_C") winddir16Point = weather.get("current_condition")[0].get("winddir16Point") windspeedKmph = weather.get("current_condition")[0].get("windspeedKmph") pressure = weather.get("current_condition")[0].get("pressure") humidity = weather.get("current_condition")[0].get("humidity") # print(weatherCode) out = "${image ~/.conky/weather_images/" + \ get_weather_image(weatherCode) + " -p 0,16 -s 16x16}${goto 24}" if not temp_C.startswith(("+", "-")): temp_C = "+" + temp_C out += temp_C + chr(176) + "C " # print(winddir16Point) out += windspeedKmph + "km/h aus " + get_winddir_de(winddir16Point) + " " out += pressure + "hPa " out += humidity + "%" print(out)except IOError: print("Wetter nicht verfügbar")finally: response.close()
heidekreis.sh: Zeile 53: printf: </b></p>: Ungültige Zahl.7-Tage-Inzidenz [alt] 17,1 [ 20,6] 60,1 [62,2] 0,0 [ 0,0]
[...] 7-Tage-Inzidenz für Deutschland [...]
DE_inzidenz=$(curl -s https://www.corona-in-zahlen.de/weltweit/deutschland/ | sed -n '234p' | cut -c 25-29)
${exec free -h | grep 'Speicher' | cut -c 28-32}
TEXT# Netzwerk${font Ubuntu:size=12}${color1}Netzwerk$color$font --${if_existing /proc/net/route eno1}#Anzeige Kabel${downspeedgraph eno1 25,70 009bf9 e49c16}${alignr}${upspeedgraph eno1 25,70 009bf9 e50c16}Down >> ${color1}${downspeed eno1}${alignr}${upspeed eno1}$color << UpIPv4 (Extern)${alignr}${color2}${execi 300 wget http://checkip.dyndns.org/ -q -O - | grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'}$colorIPv4 (Intern LAN)${alignr}${color2}${addr eno1}$color${else}${if_existing /proc/net/route wls1}#Anzeige WLAN${downspeedgraph wls1 25,70 009bf9 e49c16}${alignr}${upspeedgraph wls1 25,70 009bf9 e50c16}Down >> ${color1}${downspeed wls1}${alignr}${upspeed wls1}$color << UpIPv4 (Extern)${alignr}${color2}${execi 300 wget http://checkip.dyndns.org/ -q -O - | grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'}$colorIPv4 (Intern WLAN)${alignr}${color2}${addr wls1}$color${else}${endif}${endif}${execi 3600 speedtest-cli --simple}
conky.text = [[]];
bash: ./convert.lua: /usr/bin/lua: Defekter Interpreter: Datei oder Verzeichnis nicht gefunden