Openhab-android: Image items are not refreshing

Created on 20 Jun 2020  路  13Comments  路  Source: openhab/openhab-android

Actual behaviour

In 2.13.5-beta Image items with refresh interval set are not refreshing. The issue is not present in 2.13.0

Expected behaviour

Image items should refresh properly.

Steps to reproduce

  1. Add an Image item with refresh interval (eg camera feed) to the sitemap
  2. Open the sitemap in the app

The issue has probably originated in #2039 but I'm not sure.

bug

All 13 comments

This seems not to 100% solved.

I have my webcams on sitemap with refresh interval of 1000ms and it works.

But I have also statistic images of my photovoltaic and there refresh interval is at 1 minute. If I open the app the statistic images show old values and old time. I have to wait 1 minute, and then it refreshes. Or I swipe down to force an update, then a new image is shown.

So I think images have to be refreshed every time the site/frame is opened again. In an older version this worked and in the Playstore main release it works too I think.

'Open' as in 'open from recents'? Or 'open with the app not running before'? It's supposed to reload in the former case; if that doesn't work I need to check it again.

Tested with release 2.13.9-beta from playstore.

Made a php script to generate an image with current time.

<?php
$text = date("H:i:s");

header('Content-type: image/png');
$im = imagecreate(100, 30);
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);
imagestring($im, 5, 15, 7, $text, $textcolor);
imagepng($im);
imagedestroy($im);

?>

Included image like this in my sitemap with a refresh of 10 seconds

Text label="Test" {
      Image url="http://127.0.0.1/bild.php"     refresh=10000
}

Testing scenarios:

  1. all apps closed > start app > navigate to Test > old time / older than 10s FAIL

  2. stay on Test > send app to background > wait more than 10s > go back to opened app > directly refreshed OK

  3. display turns off due to inactivity with Test opened > wake up with fingerprint > directly refreshed OK

  4. navigate from other frame to Test > old time FAIL

Conclusion:

it refreshes only after 10 seconds (as defined in sitemap) or when directly bringing back app to front and Test was open before.
It does not refresh when navigating between frames in the app.

*with directly refreshed I mean: time is not next 10s intervall but directly refreshed to current time, that's ok.

Thanks, I'll check that.

@mueller-ma Please reopen.

OK, found the issue: the HTTP request is fired at the correct time by the image view, but the response is served from (OkHttp internal) cache. I'll think about a solution.

2084 should fix this. Thanks again for the great reproduction test case!

Issue again in 2.13.17-beta. Image not refreshing when navigateing to frame/page.

Was working in 2.13.16-beta.

I can not reproduce that (using the test case you posted above) on 2.13.18-beta. From the commit history, I don't see what could cause a regression there either.

After rotating the device images don't refresh anymore.

I rather see an issue that the image disappears completely after device rotation. Are you referring to that?
In any case, I'll have a look into that.

The images don't disappear on my device, they just stop refreshing.

It's weird, can not describe a testing scenario.
Will investigate it.

Sometimes it doesn't update and sometimes it does not load and display white area instead.

2119 should fix this ... the issue was pretty subtle and only happened in a specific timing scenario (new WidgetImageView instance created after rotation instead of reusing an existing one + first layout pass happening after assigning image URL to WidgetImageView).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KushAdit picture KushAdit  路  12Comments

mueller-ma picture mueller-ma  路  3Comments

holmes picture holmes  路  7Comments

MikeJMajor picture MikeJMajor  路  3Comments

CWempe picture CWempe  路  14Comments