This page last changed on Sep 21, 2014 by lexjans.

Hi,

I use a webview to show a picture of the weather in de Netherlands.
This is the URL: http://gratisweerdata.buienradar.nl/buienradar.php?type=256x256

This works fine. The picture has to refresh every 5 minutes.
I can't get this to work.
There is no refresh parameter in the webview only a sensor.
I have search the form to get an example how to get this work.

Can some one please help me out to fix this.

Thanks Lex

I don't think it's possible at this time, the server would need to initiate the push itself.
A refresh rate on the webview has been requested in the past but has not been implemented yet.

Posted by ebariaux at Sep 22, 2014 10:39

Is there not an other way to get de job done.
With drools, wget de picture, save it on the system.
Do that every 5 minutes.
Let the webview point to your system.
Or do you have the same problem?

Posted by lexjans at Sep 22, 2014 11:16

Why not make that a cronjob instead? For me that has proven to be more robust than system calls or Drools from within OR.

Posted by pz1 at Sep 22, 2014 12:30

Yes, that could work, by linking a sensor to the web view.
The sensor is the URL for the web view to load.
For the refresh to work, the sensor value must change, so the URL has to be different everytime.

Posted by ebariaux at Sep 23, 2014 13:53

Hi Eric,

Not the URL change, but the content (picture) does.
Can you help me with an example?

Posted by lexjans at Sep 23, 2014 16:36

To get it into a webview you have to capture the buienradar image (a gif) separately to a directory within the OPenremote directory tree. I do use a private subdiretory webapps/private.
My controller runs on a Synology box (linux), where I use the follow script to get the image:

#!/bin/sh
cd /volume1/@appstore/OpenRemote/webapps/private > /dev/null
wget -O buien.gif http://api.buienradar.nl/image/1.0/RadarMapNL?w=256&h=256
exit 0

This is part of my larger script that is activated every 10 minutes by CRON.
For your case I have created an buien.html file with an auto refresh meta command:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en-US">
<head >
<meta http-equiv="refresh" content="5">
</head>
<body>
<img src="buien.gif" width="250" height="250" />
</body>
</html>

In UI designer create a webview with URL http://controller_IP:port/private/buien.html

This works for me on webconsole and on android

Posted by pz1 at Sep 23, 2014 23:10

Hi PZ1,

I understand the trick you used.
asap I put it on my eBox i use.

Thanks.

Lex

Posted by lexjans at Sep 24, 2014 07:23

Be aware that you have to make backups of your private directory, as this might get overwritten by an OR update

Posted by pz1 at Sep 24, 2014 08:13

Ok.

Thanks.

Posted by lexjans at Sep 24, 2014 08:26

Ok, it's working when i manual start the script.
When i put it in crontab the file buien.gif does not change.
So i think de crontab line does not work.

This is what i have done in crontab:

*/10 6-23 * * * root /opt/OpenRemote-Controller-Pro1.0.13/webapps/private/get_buienradar.sh

This is the get_buienradar.sh file:

#!/bin/sh
cd /opt/OpenRemote-Controller-Pro1.0.13/webapps/private > /dev/null
wget -O buien.gif http://api.buienradar.nl/image/1.0/RadarMapNL?w=256&h=256 2>&1
exit 0

If i start it manual, (./get_buienradar.sh), i have to give an ENTER otherwise the script don't return to the terminal.

What can be the problem? Is it the ENTER or the crontab file.
I try everything i know.

Can somebody help me.

Lex.

Posted by lexjans at Oct 07, 2014 21:03

This is the top of my crontab file on Synology DS212+

#minute hour    mday    month   wday    who     command
*/14    *       *       *       *       root    /volume1/@appstore/OpenRemote/webapps/private/weatherlogger.sh
*/2     *       *       *       *       root    /volume1/@appstore/OpenRemote/webapps/private/pvlogger.sh
Posted by pz1 at Oct 08, 2014 08:52

Make sure you have one or more lines in the end of the crontab.

It needs the "enter" in the end of "*/10 6-23 * * * root /opt/OpenRemote-Controller-Pro1.0.13/webapps/private/get_buienradar.sh"

Posted by rberg at Oct 09, 2014 01:57
Document generated by Confluence on Jun 05, 2016 09:31