Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 22 additions & 0 deletions weather.openmeteo/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
v1.0.29 (12/11/2025)
--------------------
* Personalized weather forecast should now work with any skin
* Forecast support up to 12 days
* Reworked addon settings

v1.0.26 (4/11/2025)
--------------------
* Personalized weather forecast
* Alternative weather API for skin developers
* Added timeofday window properties
* Added snow window property
* Added season window property
* Added new default WMO weather icons
* Added setting to disable map layers for any location
Note: Only the first location is enabled by default
* Do not rely on addon settings for geolocation
* Fixed rare exception if weather data is not up to date
* Fixed addon settings corruption on some android devices (hopefully)
* Added translation: Italian (thanks @mapi68)
* Added translation: Russian (thanks @feruk)

v1.0.14 (22/07/2025)
--------------------
* Added pressure units: hPa, kPa, mmHg, inHg, psi
Expand Down
4 changes: 2 additions & 2 deletions weather.openmeteo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

- No account or API key required
- Geolocation (only on first run)
- Current, hourly and daily weather
- Current, hourly, daily and timeofday weather
- Maps: Radar, Infrared, Temperature, Wind Maps, ...
12h history for map animations (Requires skin support)
- Airquality: AQI, PM25, PM10, ... (Requires skin support)
Expand All @@ -14,6 +14,6 @@
- Weather alert notifications
- Weather alert properties for skins (Requires skin support)
- Graphs (Requires skin support)
Special window properties that can be used for graphs (e.g. Example)
Special window properties that can be used for graphs
- WMO weather codes support (Requires skin support)
WMO icons are more precise than KODIs builtin codes
6 changes: 5 additions & 1 deletion weather.openmeteo/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="weather.openmeteo" name="Open-Meteo" version="1.0.14" provider-name="OpenHT">
<addon id="weather.openmeteo" name="Open-Meteo" version="1.0.29" provider-name="OpenHT">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.requests" version="2.27.1+matrix.1"/>
Expand All @@ -20,6 +20,10 @@
<description lang="hu_HU">Időjárás, térképek, levegőminőség és pollenelőrejelzés az open-meteo.com, a rainviewer.com, a weather.gc.ca és a met.no oldalakról</description>
<summary lang="id_ID">Prakiraan cuaca oleh Open-Meteo</summary>
<description lang="id_ID">Ramalan cuaca, peta, kualitas udara, dan serbuk sari dari open-meteo.com, rainviewer.com, weather.gc.ca dan met.no</description>
<summary lang="it_IT">Previsioni meteo di Open-Meteo</summary>
<description lang="it_IT">Meteo, mappe, qualità dell'aria e previsioni del polline da open-meteo.com, rainviewer.com, weather.gc.ca e met.no</description>
<summary lang="ru_RU">Прогноз погоды от Open-Meteo</summary>
<description lang="ru_RU">Прогноз погоды, карты, качество воздуха и пыльцы от open-meteo.com, rainviewer.com, weather.gc.ca и met.no</description>
<summary lang="sk_SK">Predpoveď počasia z Open-Meteo</summary>
<description lang="sk_SK">Počasie, mapy, kvalita vzduchu a peľové údaje z open-meteo.com, rainviewer.com, weather.gc.ca a met.no</description>
<summary lang="ta_IN">திறந்த-மெட்டியோவிலிருந்து வானிலை முன்னறிவிப்பு</summary>
Expand Down
3 changes: 1 addition & 2 deletions weather.openmeteo/lib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def getdata(type, loc, map=None):

# URL
if type == 'weather':
url = config.map_api.get(type).format(map[0], map[1])
url = config.map_api.get(type).format(map[0], map[1], config.maxdays)
elif type == 'airquality':
url = config.map_api.get(type).format(map[0], map[1])
elif type == 'sun':
Expand Down Expand Up @@ -159,7 +159,6 @@ def getrvindex(type):
# Get location (GeoIP)
def getloc(locid):
utils.log(f'Geolocation ...')
utils.setsetting('geoip', 'true')

# Get location
try:
Expand Down
691 changes: 413 additions & 278 deletions weather.openmeteo/lib/config.py

Large diffs are not rendered by default.

94 changes: 93 additions & 1 deletion weather.openmeteo/lib/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def speedconv(value, unit):
if unit == 'mph':
v = value / 1.609344
elif unit == 'm/min':
v = value * 16,667
v = value * 16.667
elif unit == 'm/s':
v = value / 3.6
elif unit == 'ft/h':
Expand Down Expand Up @@ -291,6 +291,36 @@ def precipconv(value, unit):
def precip(value=False):
return precipconv(value, config.addon.precip)

# Snow
def snowconv(value, unit):
if value is not False:
value = float(value)

if unit == 'in':
v = value / 2.54
else:
v = value

if config.addon.snowdp == '0':
return round(v)
else:
if config.addon.unitsep == ',':
return str(round(v,int(config.addon.snowdp))).replace('.',',')
else:
return round(v,int(config.addon.snowdp))

else:

if unit == 'in':
v = 'in'
else:
v = 'cm'

return v

def snow(value=False):
return snowconv(value, config.addon.snow)

# Pressure
def pressureconv(value, unit):
if value is not False:
Expand Down Expand Up @@ -382,3 +412,65 @@ def moonphaseimage(deg):
elif deg >= 273 and deg <= 357:
return '7.png'

# Season
def season(lat):
d = utils.dt('dayofyear')

if lat >= 0:
n = True
else:
n = False

if d >= 80 and d <= 172:
return utils.locaddon(32471) if n else utils.locaddon(32473)
elif d >= 172 and d <= 264:
return utils.locaddon(32472) if n else utils.locaddon(32474)
elif d >= 264 and d <= 355:
return utils.locaddon(32473) if n else utils.locaddon(32471)
else:
return utils.locaddon(32474) if n else utils.locaddon(32472)

# Item
def item(value, type, unit=True):

if type == 'temperature':
v = temp(value)
u = temp()
elif type == 'precipitation':
v = precip(value)
u = precip()
elif type == 'snow':
v = snow(value)
u = snow()
elif type == 'speed':
v = speed(value)
u = speed()
elif type == 'distance':
v = distance(value)
u = distance()
elif type == 'pressure':
v = pressure(value)
u = pressure()
elif type == 'uvindex':
v = temp(value, config.addon.uvindexdp)
u = ''
elif type == 'solarradiation':
v = dp(value, config.addon.radiationdp)
u = 'W/m²'
elif type == 'particles':
v = dp(value, config.addon.particlesdp)
u = 'μg/m³'
elif type == 'pollen':
v = dp(value, config.addon.pollendp)
u = f'{utils.locaddon(32456)}/m³'
else:
v = round(value)
u = ''

if value is False:
return u
else:
if unit:
return v, u
else:
return v
11 changes: 3 additions & 8 deletions weather.openmeteo/lib/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
def Main():
startup = True
utils.log(f'Starting service ...')
utils.setsetting('service', 'idle')
utils.log(config.addon_info, 3)

# Geolocation
if not utils.setting('geoip') and not utils.setting('loc1'):
utils.setsetting('geoip', 'true')
if not utils.geoip() and not utils.setting('loc1'):
utils.geoip(True)
utils.setsetting('service', 'running')
weather.Main('1', mode='geoip')
weather.Main('1', mode='download')
Expand Down Expand Up @@ -67,9 +68,3 @@ def Main():
utils.log(f'Stopping service ...')
api.s.close()

# Workaround KODI issue (v0.9.5)
try:
utils.setsetting('service', 'stopped')
except:
pass

Loading
Loading