Storing Video to External Storage such as a USB Drive

I’m looking to store images locally directly on Vera.

Is it possible to have video stored to an external USB drive (AKA USB Key)? If so, does anyone have a link or recommendations on doing so?

I’m not sure if write privileges to the filesystem are provided to Luup scene/or Luup plug-in code, but if it is you could use os.execute(cmd) to run shell commands.

I assume you are talking about downloading the image from an IP camera to the usb drive, so assuming you have the drive mounted as “/mnt/usb” and the IP camera’s current image is downloadable from “http://10.1.1.1/image.jpg” you could should be able to use something like the following as a Luup scene and then schedule or trigger to run as needed:

os.execute(“curl -o /mnt/usb/ “… os.time() …”.jpg http://10.1.1.1/image.jpg”)

I understand it isn’t the most elegant solution, and I haven’t debugged or tested that code, but it should download the current image from the camera and give it a file name that is the current time in seconds, so as long as you don’t trigger it more than once a second that should be fine. If this would be of interest to you as a solution give it a shot and let me know if you need help debugging it.

Instead of that, you could use luacurl ([url=http://luacurl.luaforge.net/]http://luacurl.luaforge.net/[/url]) luasocket ([url=http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/]http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/[/url]), or luup.wget ([url=http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_wget]http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_wget[/url])

As for storing in a USB drive, it does work; but you have to manually mount it, typcally something like:

mount /dev/discs/disc0/part1 /mnt/

Of course, you could add an entry to /etc/fstab to make it automount at startup

@javier: Are those modules included with Vera? I went with os.execute because I have more experience with *nix and the “standard” executables included in distros then I do with Lua. I am interested in learning more Lua, is there there a list of if the Lua modules that are included with the Vera?

Hum… that calls for a wiki page. Here’s a quick list:

[ul][li]LuaSocket ([url=http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/]http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/[/url])[/li]
[li]LuaFilesystem ([url=http://www.keplerproject.org/luafilesystem/]http://www.keplerproject.org/luafilesystem/[/url])[/li]
[li]LuaCurl ([url=http://luacurl.luaforge.net/]http://luacurl.luaforge.net/[/url])[/li]
[li]LuaExpat ([url=http://www.keplerproject.org/luaexpat/]http://www.keplerproject.org/luaexpat/[/url])[/li]
[li]LuaSec ([url=http://www.inf.puc-rio.br/~brunoos/luasec/]http://www.inf.puc-rio.br/~brunoos/luasec/[/url])[/li]
[li]LuaProfiler ([url=http://luaprofiler.luaforge.net/index.html]http://luaprofiler.luaforge.net/index.html[/url])[/li][/ul]

… and of course, you could simply upload any lua-only module. For example that’s how I’ve ported LuaXPath and plan to add a few extra utilities to make it simpler to use.

@javier, do you now include all of the components of LuaSocket? Last time I checked the SMTP module was missing (for example):

http://forum.micasaverde.com/index.php?topic=1512.msg8061#msg8061

and yes, you could do with a Wiki page for the libs that are included, and what bits aren’t (if like the above example)

You’re right, only the core and mime parts are included; the higer-level modules are missing (http.lua, url.lua, tp.lua, ftp.lua, smtp.lua). Of course, being just Lua files, you could simply upload them yourself.

thanks for the feedback, everyone! It looks like I have some playing around to do. :slight_smile:

is it possible to write this capacity (local image storage) to a plugin so us common mortals can use it?

sure. any ideas about how would you like to use it?

Here’s a thought for the plugin and goal:

  1. Plug-in a USB drive into the back of the Vera.
  2. This storage is automatically allocated for using the web interface to install packages (ipkg)
    … and …
  3. automatically used to store images from IP video cameras for later retrieval.

To do a lot of this by hand you have to manipulate a lot of things (i.e. fstab, fix jffs, etc.). Is there someway a plugin could automate the processing of all of this?

sure. any ideas about how would you like to use it?
[/quote]

javier : Just to store images from a motion activated camera

Yes, but it would tricky to do so and still allow for user configuration files (ie, fstab) to be manually edited for other reasons.

Or what about simply doing a wiki for right now so us novices can figure it out? :slight_smile:

Can anyone assist with steps of configuring a USB drive to be the extra storage in order to store video locally, install updates to the firewall, etc.? I’m having a hard time trying to figure it out.

Thanks,.