lcpz / lain

Awesome WM complements

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Weather Widget not working just showing "N/A"

MohamedIrfanAM opened this issue · comments

Every other widgets like cpu temp,alsa, memory etc are working perfectly,
Only this one is not woking,just showing N/A

Please help

  • output of awesome -v
    awesome v4.3 (Too long)
    Compiled against Lua 5.3.5 (running with Lua 5.3
    D-Bus support: ✔
    execinfo support: ✔
    xcb-randr version: 1.6
    LGI version: 0.9.2
  • output of lua -v

     Lua 5.4.2  Copyright (C) 1994-2020 Lua.org, PUC-Rio
    
  • expected behavior and actual behavior

     Wheather just not showing it just showing `N/A', not showing any wheather
    
  • steps to reproduce the problem

     Always like this
    
  • X error log

    /usr/lib/Xorg.wrap: Only console users are allowed to run the X server
    xinit: giving up
    xinit: unable to connect to X server: Connection refused
    xinit: server error
    Couldn't get a file descriptor referring to the console.

wheather.lua is same as default

My widget

--[[ Weather
https://openweathermap.org/
Type in the name of your city
Copy/paste the city code in the URL to this file in city_id
--]]
local weathericon = wibox.widget.imagebox(theme.widget_weather)
theme.weather = lain.widget.weather({
    city_id = 1254187, -- placeholder(London)
    notification_preset = { font = "Hack 11", fg = theme.fg_normal },
    weather_na_markup = markup.fontfg(theme.font, "#ffffff", "N/A "),
    settings = function()
        descr = weather_now["weather"][1]["description"]:lower()
        units = math.floor(weather_now["main"]["temp"])
        widget:set_markup(markup.fontfg(theme.font, "#ffffff", descr .. " @ " .. units .. "°C "))
    end
})

OpenWeatherMap recently changed it API: now you need to create your own key.

You can find the updated information in the wiki.