Open sidamos opened 5 years ago
I did further testing and auto refresh does work if I use the Nest URL as a static URL instead of from an openHAB String Item.
For an example on how the image URL looks like (I deleted some chars here and there, so that it does not really work with my camera):
Looks like vm.original_url
could indeed be undefined.
https://github.com/openhab/org.openhab.ui.habpanel/blob/7fbdf026e18656ede362351d44267bce844e665b/web/app/widgets/image/image.widget.js#L70
Since it's only defined here - only for static urls:
https://github.com/openhab/org.openhab.ui.habpanel/blob/7fbdf026e18656ede362351d44267bce844e665b/web/app/widgets/image/image.widget.js#L58-L60
This was introduced in #143.
I think the rationale at the time was that if you're specifying a String item, you're responsible for autoupdating it via rules instead of relying on the widget's autoupdate. Nonetheless, it's still a bug.
At the moment, I am using a time triggered rule as a workaround, but it is very hacky:
rule "Nest Snapshot Refresh" when Time cron "0 0/5 * ?" // every 5 minutes then var orig = FrontDoorCameraNestHello_Camera_SnapshotURL.state.toString FrontDoorCameraNestHello_Camera_SnapshotURL.sendCommand("/static/black.jpg") Thread::sleep(500) FrontDoorCameraNestHello_Camera_SnapshotURL.sendCommand(orig) end
It is necessary to really change the URL and the sleep is also necessary, otherwise it won't update.
I will check if we can add input validation on the widget configuration when I get on a PC.
I have an image widget with an openHAB String item which contains a snapshot url for my Nest camera and I have set auto refresh to 60 seconds.
Instead of refreshing the image, I get this in the browser console: vendor.js:119 TypeError: Cannot read property 'indexOf' of undefined at image.widget.js:70 at n (vendor.js:108) at m.$eval (vendor.js:147) at m.$digest (vendor.js:144) at m.$apply (vendor.js:147) at vendor.js:109
When I enable No Cachebusting, then I don't get an error in the browser console, but the image goes black after 60 seconds.
Using openHAB 2.4.0. Tested on newest Chrome version on Linux and Android.