Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Web Interface and easy motion notifications #13

Closed
wants to merge 9 commits into from

Conversation

williamkennyAK
Copy link

I have created push webhooks and integrated in mqtt notifications.

Also, developed a quick and dirty web interface which can do the following:

  • Easily configure motion notifications
  • Start an ftp server on device
  • Integrated in upload.html and upload.cgi
  • Reboot the camera
    This all runs on web server running on port 80.

I plan on continuing work on the web interface, but it is in a stable state ATM.

@guino
Copy link
Owner

guino commented Oct 17, 2021

This looks really good, was there a reason why config.cgi is both under cgi-bin and www/cgi-bin ? They looked the same at a quick glance but I did not compare in detail.

I want to load it up on my device and give it a good look but looks like you allow for configuring commands to notify of motion and such which is pretty cool.

It would be very cool if we could add a setting for notify of doorbell push too (for the doorbell devices) which would be just a different notification url (maybe slight different json data). Another suggestion is possibly a camera preview (using snap/mjpeg.cgi) which is obviously not necessary but would make it look more like other existing camera firmware -- even just a link to snap/mjpeg.cgi could be enough (no need to do a full preview on the same page).

You clearly know your way around linux/cgi stuff which is nice to see - kudos.

@williamkennyAK
Copy link
Author

williamkennyAK commented Oct 17, 2021

They are the same. I have been running a second web server on port 80 whose root is /mnt/mmc01/www/. The index.html file I'm using is purely a redirect to www/cgi-bin/config.cgi. I didn't want to modify index.html in /mnt/mmc01/
This is actually the absolute first time I've messed with any cgi stuff, but I've been messing around with Linux for 20+ years. sh is sh.

@williamkennyAK
Copy link
Author

I'm taking a look at your jpeg-arm program and trying to setup a proper build environment to compile for arm.
It seems if I try to pipe it to a file the snaphdr that is printed stops it from being recognized as a jpeg file.
I'm gonna give it a try to compile this and see what it works, but basically adding an option of svjpg which would suppress the header. Mayber there's a more efficient route? (I'm not a seasoned C programmer)

@guino
Copy link
Owner

guino commented Oct 17, 2021

@williamkennyAK you just need an arm toolchain to compile the jpeg code - I used this one https://toolchains.bootlin.com/downloads/releases/toolchains/armv5-eabi/tarballs/armv5-eabi--uclibc--stable-2020.08-1.tar.bz2

If you want the code to output a valid jpeg file you need to remove all lines that write headers and only write the jpeg buffer . The current code is meant to be the output for httpd, that’s why I suggested just showing a link on the config page. Not sure if that’s why you need a jpeg file but the less you write ‘files’ the faster things generally are.

@williamkennyAK
Copy link
Author

williamkennyAK commented Oct 17, 2021

Agreed, but what I intend to do is save a snap to send as a notification via telegram. I'm starting an ftp server on there which is mounted to my nas which is accessible from home assistant. This way, I can do a telegram notification with a snapshot, and offload videos and images to the nas daily.
Giving the option to strip the header just gives more options for use imo.

@williamkennyAK
Copy link
Author

Probably t he one thing I want to figure out the most is how to mount an nfs share on the camera that way I can just save snaps and video directly to my nas.

@guino
Copy link
Owner

guino commented Oct 17, 2021

The kernel/drivers in these devices are not capable of nfs mounts.

The best option I see is having whatever receives the motion alert pull the jpeg image using snap.cgi and send the telegram message. It is file-less and most of the intensive work happens outside of the device.

@williamkennyAK
Copy link
Author

It also makes me wonder what the possibility of putting a custom image on these devices. Would it be possible to build a replacement firmware that is more open? Something that allows us to run a more efficient rtsp/onvif server? I'm gonna have to do some digging to see what's out there.

Have you looked into the OTA update process of these devices? I wouldn't mind sacrificing one of these cameras to more of a teardown if there is a possibility of it working.

@williamkennyAK
Copy link
Author

I'm starting to think of an alternative approach to this. I think I'm going to rewrite this interface in python or even similar cgi scripting in a docker container running on a separate computer. This way we can have one central point where telnet commands can be sent to the camera(s) instead of putting extra overhead of running extra services on device. As you cautioned I'm running into performance issues. I'm going to close this PR and continue to develop this new method. I will make a few more changes to my fork and let it be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants