Using an external web hosted scheduling tool for CHDKPTP - LUA Scripting - CHDK Forum

Using an external web hosted scheduling tool for CHDKPTP

  • 1 Replies
  • 4136 Views
*

Offline Sdack

  • ***
  • 195
Using an external web hosted scheduling tool for CHDKPTP
« on: 16 / March / 2018, 01:54:52 »
Advertisements
Hi folks,
I've been thinking about adding a web front end to my incredibly cost effective CHDK and Raspberry Pi based timelapse rigs, so that I can monitor and control them from anywhere in a browser.

Thus far I've been using the awesome Multilapse script (by Manoweb and Reyalp), and, while it's been working very well, I would really like to have a monitoring to alert me when things stop working.  At the moment I have to browse either the online gallery, where my images are uploaded to.  Or, use an ftp program to log in and check the filenames, which are timestamped. 

A couple of days ago I checked in and found the camera had stopped working an hour earlier and, while a hour isn't much, it could have been half a day and I'd rather have received an email or even and SMS immediately.

While looking into this I came across a couple very professional and robust looking, open-source tools.

One is called
GumCP
https://github.com/gumslone/GumCP
And aside from allowing the creation of buttons to run scripts on the host machine, it serves up a nice array of detail about the machine state,



Another even more promising option is
Chronicle
https://github.com/jhuckaby/Cronicle

Chronicle runs on a webserver hosted, in my case, on a Raspberry Pi Zero, using Node.js and npm.  Aside from the scheduling, it gives a very nice

The flexibility offered for scheduling is incredible.  One can add multiple overlapping tasks at any interval and the task will run a command on the machine

I am trying to figure out how to issue Lua commands as tasks and just tried to add a voltage request
Code: [Select]
= return get_vbatt( )
So I initiated a chdkptp session via an SSH connection to the machine in question.. thinking, naeively that I could simply run the Lua command and it would work.

It didn't!

It appears to my mind that I'm initiating a second shell command with my Chronicle task.
I Googled for insights into running a command from one shell, to a process running in another shell but didn't find anything that I could understand.

Any suggestions would be welcome.

Cheers
Sdack

UPDATE:  Today my camera crapped out again and I lost 4 hours of images.  Fortunately this is a pro bono job for a local school.
« Last Edit: 16 / March / 2018, 04:11:45 by Sdack »

*

Offline reyalp

  • ******
  • 14128
Re: Using an external web hosted scheduling tool for CHDKPTP
« Reply #1 on: 16 / March / 2018, 13:34:48 »
A couple of days ago I checked in and found the camera had stopped working an hour earlier and, while a hour isn't much, it could have been half a day and I'd rather have received an email or even and SMS immediately.
FWIW, it shouldn't be hard to make multilapse send an email when the camera fails. Just make a shell script that uses the 'mail' command or something like that, and invoke it like poweron/poweroff. Of course, this won't work if multilapse itself is crashing or freezing.

Another approach would be to use a cron job that for example, checks the last file time and alerts if it's too old.


edit:
I should add that sending internet mail like this from linux can be complicated, due to spam mitigations by the ISP or recipients mail system. In this kind of situation, it's often better to set up the system as a "smart host" (https://en.wikipedia.org/wiki/Smart_host) to send via an account on a normal mail provider.

Quote
I am trying to figure out how to issue Lua commands as tasks and just tried to add a voltage request
Code: [Select]
= return get_vbatt( )
I don't know anything about GumCP and I'm not clear *where* you entered this, but command line programs like chdkptp only have one standard input. If you started chdkptp in an ssh session and didn't pipe or redirect anything, then that is where standard input comes from.

If you wanted to invoke chdkptp from GumCP, it would need to invoke chdkptp and feed standard input using a pipe, or just pass everything on the command line. However only one instance of chdkptp can be connected to a given camera at a time, so this would not be compatible with multilapse. If you wanted GumCP to display camera status while chdkptp runs, the best approach would be to modify multilapse to write out whatever the desired information is, and then arrange for GumCP to read it.

If you wanted to GumCP to control multilapse, that would be more complicated. It seems like you should be able to send signals like HUP or TERM from GumCP, but anything more complicated would require some coding.
« Last Edit: 16 / March / 2018, 13:43:01 by reyalp »
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal