Manually set Weather.Temperature value
#1
Hi everyone,

I have a small personal weather station in my backyard, and I would like the data to be displayed in Kodi, ideally in real-time and rounded to one decimal place. Home Assistant supports my weather station, so I've set it up to push the data to Home Assistant.

In Kodi (21.0), I'm creating an addon that will set up a websocket to the Home Assistant instance, allowing it to push any changes directly to the Kodi UI.

I know a bit of Python, and using the Multi Weather addon by ronie as an example, along with this wiki page, I managed to set up the websocket and update most weather labels as changes come in.

In the Weather Window, the values in Current.* and Day* update just fine. However, the infolabels Weather.* only update every 30 minutes, and they get rounded to whole numbers. I can't find a way to force Kodi to refresh those infolabels.

Here are some things I have tried:
  • Populate the weather window and run xbmc.executebuiltin('Weather.Update')
  • Changing the values manually on the home window with
    python:
    WINDOW = xbmcgui.Window(10000) # I also tried 12600
    WINDOW.setProperty('Weather.Temperature', '20.1 C')

I plan to use this with the Arctic Zephyr Reloaded skin, and I have done most of the testing with it, but I see the same behavior on the default Estuary skin.

Another possibly relevant detail:
To get the websocket to work without a never-ending loading icon, I did this in addon.xml:

xml:
<extension point="xbmc.python.weather" library="weather.py"/>
<extension point="xbmc.service" library="service.py"/>

weather.py does nothing except log when it's run (on startup, when changing settings, and every 30 minutes). service.py is what sets up the websocket and updates the values.

Any tips would be appreciated!

Thanks in advance,
Reply
#2
If I'm remembering correctly, the info label refresh is part of core Kodi and, as you noted, is done every 30 minutes.  I don't think there's anyway to change that interval.  That 30 minute interval is mentioned on the wiki page for weather addons:

https://kodi.wiki/view/Weather_addons
Reply
#3
Aw, that's a bummer, I was afraid that might be the case.

Thank you for your reply though!

I actually managed to tweak it to work for myself by playing around with the skin I'm using.
What I did was change all the infolabels with the values from the Weather Window.

Like so:

Code:
$INFO[Weather.Temperature -> $INFO[Window(Weather).Property(Current.Temperature)
$INFO[Weather.Conditions ->$INFO[Window(Weather).Property(Current.Condition)
$INFO[Weather.Fanartcode -> $INFO[Window(Weather).Property(Current.FanartCode)
$INFO[Weather.Location -> $INFO[Window(Weather).Property(Current.Location)

Maybe this info will be useful for someone else in the future.
Reply

Logout Mark Read Team Forum Stats Members Help
Manually set Weather.Temperature value0