diff --git a/weather-api-widget/weather.lua b/weather-api-widget/weather.lua
index 6ecc8a99..504580b4 100644
--- a/weather-api-widget/weather.lua
+++ b/weather-api-widget/weather.lua
@@ -170,14 +170,6 @@ local function worker(user_args)
local args = user_args or {}
- --- Validate required parameters
- if args.coordinates == nil or args.api_key == nil then
- show_warning(locale.parameter_warning ..
- (args.coordinates == nil and 'coordinates' or '') ..
- (args.api_key == nil and ', api_key ' or ''))
- return
- end
-
local coordinates = args.coordinates
local api_key = args.api_key
local font_name = args.font_name or beautiful.font:gsub("%s%d+$", "")
@@ -195,6 +187,13 @@ local function worker(user_args)
local locale = get_locale(lang)
+ --- Validate required parameters
+ if args.coordinates == nil or args.api_key == nil then
+ show_warning(locale.parameter_warning ..
+ (args.coordinates == nil and 'coordinates' or '') ..
+ (args.api_key == nil and ', api_key ' or ''))
+ return
+ end
-- Forecast endpoint includes current. I could map show_daily_forecast to days here.
-- Currently overfetching but only showing when opting in.
local weather_api =
diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua
index 3ec1c3f1..6208ea8b 100644
--- a/weather-widget/weather.lua
+++ b/weather-widget/weather.lua
@@ -152,13 +152,17 @@ local function worker(user_args)
local timeout = args.timeout or 120
local ICONS_DIR = WIDGET_DIR .. '/icons/' .. icon_pack_name .. '/'
- local owm_one_cal_api =
- ('https://api.openweathermap.org/data/2.5/onecall' ..
- '?lat=' .. coordinates[1] .. '&lon=' .. coordinates[2] .. '&appid=' .. api_key ..
- '&units=' .. units .. '&exclude=minutely' ..
- (show_hourly_forecast == false and ',hourly' or '') ..
- (show_daily_forecast == false and ',daily' or '') ..
- '&lang=' .. LANG)
+ local owm_one_call_api =
+ ('https://api.openweathermap.org/data/3.0/onecall' ..
+ '?lat=' .. coordinates[1] ..
+ '&lon=' .. coordinates[2] ..
+ '&appid=' .. api_key ..
+ '&units=' .. units ..
+ '&exclude=' ..
+ (show_hourly_forecast == false and 'hourly,' or '') ..
+ (show_daily_forecast == false and 'daily,' or '') ..
+ 'minutely' ..
+ '&lang=' .. LANG)
weather_widget = wibox.widget {
{
@@ -564,7 +568,7 @@ local function worker(user_args)
end)))
watch(
- string.format(GET_FORECAST_CMD, owm_one_cal_api),
+ string.format(GET_FORECAST_CMD, owm_one_call_api),
timeout, -- API limit is 1k req/day; day has 1440 min; every 2 min is good
update_widget, weather_widget
)