Need help with conky using accuweather please [SOLVED]

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
zcot
Level 9
Level 9
Posts: 2956
Joined: Wed Oct 19, 2016 6:08 pm

Re: Need help with conky using accuweather please

Post by zcot »

bash line:

Code: Select all

jq < ~/.conky/cronograph/accuweather/scripts/../../conk/weather/script/accu/../script/dump.tmp 'temp_maxF'
anything along those lines, it would return that thing. you will have to dig the man to get into subcategories or something.

still completely stabbing in the dark over here though.

looks like you are making progress, good job on that.
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with conky using accuweather please

Post by Logansfury »

zcot wrote: Wed Jun 05, 2024 8:44 pm bash line:

Code: Select all

jq < ~/.conky/cronograph/accuweather/scripts/../../conk/weather/script/accu/../script/dump.tmp 'temp_maxF'
anything along those lines, it would return that thing. you will have to dig the man to get into subcategories or something.

still completely stabbing in the dark over here though.

looks like you are making progress, good job on that.
I THINK I GOT IT!!!

The online resources finally gave me a script that extract the temps correctly:

Code: Select all

#!/bin/bash

# Define the path to the JSON file
json_file="$HOME/.cache/5_day.json"

# Check if the JSON file exists
if [ ! -f "$json_file" ]; then
    echo "Error: JSON file not found at $json_file"
    exit 1
fi

# Extract the temperature values for the first instance of 2024-06-06
mintemp_f=$(jq -r '.list[] | select(.dt_txt | contains("2024-06-06")) | .main.temp_min' "$json_file" | head -n 1)
maxtemp_f=$(jq -r '.list[] | select(.dt_txt | contains("2024-06-06")) | .main.temp_max' "$json_file" | head -n 1)

# Check if the temperature values are not null
if [ -z "$mintemp_f" ] || [ -z "$maxtemp_f" ]; then
    echo "Error: Temperature data not found for 2024-06-06"
    exit 1
fi

# Output the result
echo "Minimum temperature in Fahrenheit on 2024-06-06: $mintemp_f"
echo "Maximum temperature in Fahrenheit on 2024-06-06: $maxtemp_f"
Going to work out getting this displaying on the cronograph.

Wish me luck man!!
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
zcot
Level 9
Level 9
Posts: 2956
Joined: Wed Oct 19, 2016 6:08 pm

Re: Need help with conky using accuweather please

Post by zcot »

that's a heck of a lot better!

now work out to replace something like contains("2024-06-06" with some stuff you were using earlier using date, -this way it just always works based on any given date.
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with conky using accuweather please

Post by Logansfury »

zcot wrote: Wed Jun 05, 2024 9:31 pm that's a heck of a lot better!

now work out to replace something like contains("2024-06-06" with some stuff you were using earlier using date, -this way it just always works based on any given date.
I'm stuck! I have display in terminal but not in conky:

tomorrows temps

Code: Select all


# Define the path to the JSON file
json_file="$HOME/.cache/5_day.json"

# Calculate tomorrow's date in YYYY-MM-DD format
tomorrow_date=$(date +%Y-%m-%d -d "tomorrow")

# Extract the temperature values for tomorrow
mintemp_f=$(jq -r --arg tomorrow "$tomorrow_date" '.list[] | select(.dt_txt | contains($tomorrow)) | .main.temp_min' "$json_file" | head -n 1)
maxtemp_f=$(jq -r --arg tomorrow "$tomorrow_date" '.list[] | select(.dt_txt | contains($tomorrow)) | .main.temp_max' "$json_file" | head -n 1)

# Check if the temperature values are not null
if [ -z "$mintemp_f" ] || [ -z "$maxtemp_f" ]; then
    echo "Error: Temperature data not found for $tomorrow_date"
    exit 1
fi

# Output the result
echo "${mintemp_f}F/${maxtemp_f}F"
day after tomorrow:

Code: Select all

#!/bin/bash

# Define the path to the JSON file
json_file="$HOME/.cache/5_day.json"

# Calculate the date for the day after daytwo in YYYY-MM-DD format
daytwo_date=$(date +%Y-%m-%d -d "2 days")

# Extract the temperature values for daytwo
daymintemp_f=$(jq -r --arg daytwo "$daytwo_date" '.list[] | select(.dt_txt | contains($daytwo)) | .main.temp_min' "$json_file" | head -n 1)
daymaxtemp_f=$(jq -r --arg daytwo "$daytwo_date" '.list[] | select(.dt_txt | contains($daytwo)) | .main.temp_max' "$json_file" | head -n 1)

# Check if the temperature values are not null
if [ -z "$daymintemp_f" ] || [ -z "$daymaxtemp_f" ]; then
    echo "Error: Temperature data not found for $daytwo_date"
    exit 1
fi

# Output the result
echo "${daymintemp_f}F/${daymaxtemp_f}F"
day 3:

Code: Select all

#!/bin/bash

# Define the path to the JSON file
json_file="$HOME/.cache/5_day.json"

# Calculate the date for three days after today in YYYY-MM-DD format
threedays_date=$(date +%Y-%m-%d -d "3 days")

# Extract the temperature values for three days after today
threedaymintemp_f=$(jq -r --arg threedays "$threedays_date" '.list[] | select(.dt_txt | contains($threedays)) | .main.temp_min' "$json_file" | head -n 1)
threedaymaxtemp_f=$(jq -r --arg threedays "$threedays_date" '.list[] | select(.dt_txt | contains($threedays)) | .main.temp_max' "$json_file" | head -n 1)

# Check if the temperature values are not null
if [ -z "$threedaymintemp_f" ] || [ -z "$threedaymaxtemp_f" ]; then
    echo "Error: Temperature data not found for $threedays_date"
    exit 1
fi

# Output the result
echo "${threedaymintemp_f}F/${threedaymaxtemp_f}F"
run as a bash from terminal these give perfect display but its blank in conky:

Code: Select all

${voffset 20}${goto 90}${font hooge 05_53:size=12}${execi 60 cat ~/.cache/weather.json | jq '.main.temp' | awk '{print int($1+0.5)}'}°F ${font}${goto 180}${execi 60 cat ~/.cache/weather.json | jq -r '.weather[0].main'}${voffset -32}${goto 125}${font conkyweather:size=40}${font}${voffset -12}${goto 185}${voffset 12}${goto 185}${font conkyweather:size=20}${voffset 7}${goto 80}${execp ./temp1.sh}${execp echo "${mintemp_f}/${maxtemp_f}"}${goto 185}${font}${voffset 6}${goto 84}${execp ./temp2.sh}${execp echo "${daymintemp_f}/${daymaxtemp_f}"}${goto 140}${execp ./temp3.sh}${execp echo "${threedaymintemp_f}/${threedaymaxtemp_f}"}${goto 190}${voffset 7}${goto 85}${exec date -d "tomorrow" '+%a'}${goto 140}${exec date -d "+2 days" '+%a'}${goto 190}${exec date -d "+3 days" '+%a'}

Can you fix this non working code please?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
zcot
Level 9
Level 9
Posts: 2956
Joined: Wed Oct 19, 2016 6:08 pm

Re: Need help with conky using accuweather please

Post by zcot »

I can't run any of this stuff, because I don't have all the pieces.

so, I can only just glance at the code and try to make guesses, but that's not nearly good, because typically you will get useful error messages that lead you into the proper corrections if you can run it.
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with conky using accuweather please

Post by Logansfury »

I haven't the faintest idea what to do now. I have 3 bash scripts that each correctly print what I need in terminal. I am trying to use other conkys that import info from files as templates but nothing is working. If you make six variable outside of conky, what is necessary to display them in conky?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with conky using accuweather please

Post by Logansfury »

OH HOLY CRAP

I think I got it.
${exec ~/.conky/cronograph/accuweather/temp1.sh}${execp $mintemp_f}

This just put the high and low on the screen!!

Lemme get rid of the bad calls from the other file and get these formatted in place and I wlll report back
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with conky using accuweather please

Post by Logansfury »

I did it!!!!! :D :D :D

Image

welcome to daily, tomorrow, next day, and day following temperatures working on a 2009-2012 era conky I was sure was no longer available in working form! I still cant believe I got it working!!

I am not done, now I need to puzzle out what to do about the weather icons that are supposed to display on screen. Hopefully this on will be less painful.

So I am afraid to turn on the news. Is western civilization still standing?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with conky using accuweather please

Post by Logansfury »

I used the Sirius conky as a template, and grabbed it's call from openweathermap for the weather condition icon. Currently it's a clear moonlit night in Vegas :D

Image
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2067
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help with conky using accuweather please

Post by Koentje »

See, and you didn't need my help at all! ;)
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with conky using accuweather please

Post by Logansfury »

Koentje wrote: Thu Jun 06, 2024 5:32 am See, and you didn't need my help at all! ;)
I'm stuck my friend.

I have been at it for hours with online resources and they cannot produce the batch script I need. Ive one more step to go on this
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with conky using accuweather please

Post by Logansfury »

Image

Above are incorrect icons for the future dates weather. The script I got put together online is not capable of getting the correct icon code so I can get the right icon displayed
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
Post Reply

Return to “Compiz, Conky, Docks & Widgets”