update image file (dashboard)

Hallo,

 

I am using images for tthe weather conditions beeing sent by wunderground. The images (gif files) are updated via a crontab job and I tried to overwrite the files on my raspberry server. Unfortunatly thr raspberry is read only. (Fortunatly this is the case, otherwise I would have killed the raspi many times!!)

My questions now are:

Is it possible "free" files 

or

ist it possible to allow write access to a whole folder.

Regards Walter

 

Paul Reed's picture

Re: update image file (dashboard)

I'm not that familiar with the low write version of emoncms, but isn't it only the OS which is read-only?
Could you not use one of the other partitions on the SD card which is rw to store the image file, such as where the database folders are sited?

Paul

raspiprof's picture

Re: update image file (dashboard)

Thanks Paul! That may be true, I did not try another  area/partion. I of course tried to make the folder with read write access. I will come back as soon as I have tried to move the image folder I am using to the database folder.

Walter

Paul Reed's picture

Re: update image file (dashboard)

I wouldn't put the image folder IN the database folder, but in the same volume where the database folders are.

Paul

pb66's picture

Re: update image file (dashboard)

As Paul suggested there is a 3rd "data" partition on the SD image which is not read-only and you can put files there if you need full read and write access whilst running the OS read-only.

The data partition is mounted as /home/pi/data so you can relocate you files in there using 

sudo mv /existing/path/to/fileorfolder /home/pi/data/fileorfolder

You can move sub-folders rather than individual files to keep it neat and/or create a new folder in "data"

You can add symlinks if you need those files or folders to "appear" to remain in their current locations eg

sudo ln -s /home/pi/data/fileorfolder /existing/path/to/fileorfolder

will make "fileorfolder" accessible by either path.

Paul  

EDIT - obviously this will need to be done while in RW mode by using rpi-rw first.

raspiprof's picture

Re: update image file (dashboard)

Hallo Paul

as you suggested I am saving the files in the partition which is not read only: /home/pi/data/images.This folder is mounted (I do hope this is the right wording) and now can be seen and is updated in /var/www/emoncms/images using a crontab job.

Thanks for this help!

Now I do have the problem that the images are not updated in the dashboard. Thus I do need some sort of refresh command. I do not know whether and how often the feed data are automatically updated within the dashboard. This of course would be nice.

If I may ask even another question. How can I put time stamps (something like last updated) on the dashboard for the images or the other widgets.

I hope my questions do not annoy you. I am totally aware that these questions are Mainly on how to build a webpage, but I must say that I am an old newbee and try to get forward in small steps.

Once agin thank you for your help.

Walter

[2 near-duplicates deleted by moderator - RW]

pb66's picture

Re: update image file (dashboard)

This isn't something I've tried to do so I'm guessing a little here but I suspect your images are being cached by the browser and because the image's file  name doesn't change the browser doesn't know to download it again. Maybe there is an html option you can set for the image that forces the image to be refreshed eg "no-cache" or you can add a ever changing part to the image name eg a timestamp something along the lines of 
img src="/path/to/image/image.jpg?<?php echo time(); ?>/> might work if it's recognised as a different file but reaches the same image.

Worth a try ?

Paul

Paul Reed's picture

Re: update image file (dashboard)

Hi Walter, I am doing the very same thing except instead of using cron, I'm using a task in node-red, which I suppose amounts to the same process.

I presume that you are saving the image file to the same name, such as weather.gif and overwriting the previous file? (as Wunderground call their image files by different names cloudy_nt.gif etc, depending upon the conditions).

How are you presenting the image in your dashboard?
I use a Text/paragraph box and use;

<img src="/images/weather.gif" alt="Current Conditions">

to pull the current image held in my images folder into the dashboard, and it updates fine.

As for the timestamp, no immediate ideas.

Paul
PS I'll PM you a link.

pb66's picture

Re: update image file (dashboard)

Just found this so it should be possible

http://www.willmaster.com/library/web-content-prep/preventing-browser-cache.php

and if you can get the timestamp into an element to cause a refresh it can't be much harder to display the time, or can it ?

Paul

pb66's picture

Re: update image file (dashboard)

Or try adding something like

Updated:
<script language="JavaScript">
document.write(document.lastModified);
</script>

in a text box,

http://www.javascriptsource.com/time-date/determine-page-update-date-by-brad-jones-120319200005.html

 

EDIT - just tries this and it works as a stand alone page but I couldn't get it into a text box maybe someone with more website knowledge can chip in, a "updated at" could be a useful addition

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.