Manually set Weather.Temperature value



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,