[OH3] Custom Widget - Is it possible to set refresh interval for background image?

I am developing a custom widget that has a background image (snapshot taken by my weather camera) that I would like to have refreshed every 5 mins. Searching the community but not finding anything that would provide an example.

Am I trying to do something that is not possible? Tried adding a refresh interval on the URL but that is not working. The image will refresh if I hit the browser refresh but that’s not the best if it can be automated. The code segment I am using is below.

 default:
    - component: f7-block
      config:
        style:
          background-image: url('/static/weatherImage.jpg?refresh=150s')
          background-size: cover
          background-repeat: no-repeat
          background-position: bottom-left
          padding: 30px 0 60px 0
          margin-top: 0

An alternative may be to try an image card which has a refresh interval built in and try to make it a background - but have not found any examples of this either.

Any ideas or direction would be greatly appreciated.

I’m not aware of any way to force the f7 components to refresh. I think your best bet here is a work-around of some kind.

My first attempt would probably be to use an oh-image component as the first child of the block and just place everything else on top of it. The oh-image does come with a refresh interval.

2 Likes