Working on Accuweather conky. Have a question for anyone familiar with Accuweather.

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.
Post Reply
User avatar
Logansfury
Level 7
Level 7
Posts: 1712
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Working on Accuweather conky. Have a question for anyone familiar with Accuweather.

Post by Logansfury »

Good Morning everyone,

Despite the time it took, the years it shed off my life expectancy, and the three and a half aneurysms it caused, getting the Cronograph conky up and running with openweathermap was tremendous fun.

I have taken a look at the Accuweather conditions icon set, and found it to contain 40 images for different reported weather, as opposed to the 18 images/conditions that Openweathermap recognizes.

I am starting to work on an Accuweather conky:
Image

The issue is that there seems to be only current temp, weather condition, and an icon number in their current conditions forecast:

www.dataservice.accuweather.com/currentconditions/v1/329506?apikey=xxx is the URL I am using. Is anyone familiar with Accuweather and have a more robust command to use to get more info like min/max daily temps, feels like temp, wind spd, gusts, and direction, humidity etc.

Thanks for reading,

Logan
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 7
Level 7
Posts: 1712
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Working on Accuweather conky. Have a question for anyone familiar with Accuweather.

Post by Logansfury »

I just found another command to use in conjunction with the other command:

https://dataservice.accuweather.com/forecasts/v1/daily/1day/329506?apikey=xxxx

This is giving me max and min temps, and emergency alert conditions, but nothing else. Still need a way to get to sunrise/sunset, wind, humidity etc
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 7
Level 7
Posts: 1712
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Working on Accuweather conky. Have a question for anyone familiar with Accuweather.

Post by Logansfury »

It looks like while I was working on this I may have inadvertantly had a request being sent every second along with the conky refresh. I got a message that I made too many calls and my API KEY was nuked. All my calls now bring up a bad key message.

I have emailed their support to explain the situation and see if I can get a new key to resume work on this.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 7
Level 7
Posts: 1712
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Working on Accuweather conky. Have a question for anyone familiar with Accuweather.

Post by Logansfury »

Making forward progress again. I was only shut off from the service for 24 hours, and I have found out I can make 50 total calls a day, so I made sure to adjust the conf file.

I finally found the key to getting robust information, at the end of the forecast request I needed to append "details=true" that increased the output of information on the return page by a factor of about 8. I have sun rise/set, moon rise/set, moon phase, moon age, excessive temp warnings, wind info, total sunlight hours etc etc.

I am going to build a sweet little weather widget :)
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 7
Level 7
Posts: 1712
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Working on Accuweather conky. Have a question for anyone familiar with Accuweather.

Post by Logansfury »

Safari, sogoodi.

Image

I am forced to go Pseudo-Transparency to not wash out the icon, as I am using ${image} instead of a lua. I may well ask for help getting a lua put together so I can go full Transparency! I just need to get the correct icon name and that is already being calculated by existing bash scripts I coaxed out of an online resource.

Until I can get a lua version of the icon display, I would like an outline around the visible dimensions of the widget. Can anyone explain how to do that please?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 7
Level 7
Posts: 1712
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Working on Accuweather conky. Have a question for anyone familiar with Accuweather.

Post by Logansfury »

The humidity read from this provider is whacked, but the widget is getting more populated. Going to add more moon crap shortly:

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

Re: Working on Accuweather conky. Have a question for anyone familiar with Accuweather.

Post by Koentje »

I did some abracadabra in the image lua and i changed it so you can present any image from within conky!

transparent-image.lua

Code: Select all

--[[
2024 Koentje


]]

require 'cairo'
require "imlib2"
home_path = os.getenv ('HOME')


function fDrawImage(cr,path,xx,yy,ww,hh,arc)
    cairo_save (cr)
    local img =  cairo_image_surface_create_from_png(path)
    local w_img, h_img = cairo_image_surface_get_width(img), cairo_image_surface_get_height(img)
    cairo_translate (cr, xx, yy)
    if arc then
        cairo_rotate (cr, arc)
    end
    cairo_scale (cr, ww/w_img, hh/h_img)
    cairo_set_source_surface (cr, img, -w_img/2, -h_img/2)
    cairo_paint (cr)
    cairo_surface_destroy (img)
    collectgarbage ()
    cairo_restore (cr)
end

function conky_image(img,xxx,yyy,hhh,www)
  if conky_window==nil then return end
  local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)
  local cr=cairo_create(cs)
  local updates=conky_parse('${updates}')
  update_num=tonumber(updates)

  if update_num>4 then
--    local image = img

    fDrawImage(cr,img,xxx,yyy,www,hhh)
  end

   cairo_surface_destroy(cs)
   cairo_destroy(cr)
end


Then add this to your conky script

Code: Select all

lua_load = './transparent-image.lua',


And if you want to show an image add this line to your conky script

Code: Select all

#                "path to image"  "position x"  "position y"  "image width"  "image height"
${lua conky_image /home/admin/.conky/MyPanels/images/weather/s000f000.png 40 40 60 60}


Now you can also use this from within the weather_icon bash script. You can use the $weather_icon string as filename!
echo "\${lua conky_image /path/to/$weather_icon 40 40 60 60}"

Tadaaa.. ;)
Image
User avatar
Logansfury
Level 7
Level 7
Posts: 1712
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Working on Accuweather conky. Have a question for anyone familiar with Accuweather.

Post by Logansfury »

not sure where I fouled up, but I have no display.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
Post Reply

Return to “Compiz, Conky, Docks & Widgets”