Help request to get my webcam/weathercam online

Post Reply
willefg
Newbie
Newbie
Posts: 8
Joined: Fri Mar 08, 2019 12:27 am
Location: Bladel, the Netherlands
Station model: Froggit with GW2000
Software: WEEWX
Contact:

Help request to get my webcam/weathercam online

Post by willefg » Fri Dec 22, 2023 7:41 pm

I like to get my webcam online. Problem is that this Hikvision DS-2DE3304W can only use FTP and my website is hosted on a system only accessible via SFTP. For now the webcam stores all pictures to a folder on a Synology NAS. I’ve been looking for a simple (I’m not an IT expert, can’t go much beyond following installation instructions) way to sync my NAS folder to the remote webserver, or any other way to get a periodic photo in a folder of Meteotemplate.

Has anyone else had this issue and can point me to some solution? I have a few Raspberry Pi’s running (one with WEEWX) so maybe a script that would sync my local NAS folder to the host, would be great. Thank you for your help.

davidefa
Expert
Expert
Posts: 905
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Help request to get my webcam/weathercam online

Post by davidefa » Fri Dec 22, 2023 10:38 pm

I may suggest one of the following:

a) use an sftp client of your raspberry to upload the image, from the nas to the server ( which distribution are you using, I'm not a raspberry user, but maybe someone else may help )
b) open a port on your router ( and expose the webcam to the internet ) so that the webcam plugin can access the image directly
c) use your hikvision to ftp the image to an 'itm server' ( you may use a free hosting service for that ), configure your webcam plugin to access the image from the 'itm server'

P.S.
For 'itm server' I mean in-the-middle or intermediate ( but itm sounds... more stupid ; - )
Image

willefg
Newbie
Newbie
Posts: 8
Joined: Fri Mar 08, 2019 12:27 am
Location: Bladel, the Netherlands
Station model: Froggit with GW2000
Software: WEEWX
Contact:

Re: Help request to get my webcam/weathercam online

Post by willefg » Mon Dec 25, 2023 1:00 pm

@davidefa Thank you for your reply. I’ve been trying different things for the last couple of days, but to no avail, unfortunately.

Regarding
a) My Raspberry Pi with Debian running WEEWX has the ability to send over SFTP. Other RPi all with DietPi (Debian distro) could run OpenSSH. I’ve been looking at setting up an FTP-to-SFTP-bridge, but did manage to get it going due to lack of knowledge and experience
b) I tried by installing Surveillance Station on my NAS so it would show image through the webserver on the NAS to the outside world. It does, but only as a (low res 480p) video stream, not as jpg snapshots.
c)the in-the-middle server could be like what I mentioned in a) an FTP-to-SFTP-bridge of some sort. I found services online but they’re all too expensive for just this weathercam. That’s not worth it to me.

..d) I also tried something else. The Hikvision sends the jpg snapshots over FTP to a folder on the Synology NAS. I can set it up so it sends always to the same folder with no sub folders. The name file that comes in has always the prefix “Photo_* followed by a number and the time/date stamp. The NAS allows for scheduled bash script tasks. I tried setting up a rename task that would just move any jpg with the prefix (Photo_*.jpg) in it to a webcam.jpg file. Since the scheduled task runs at the same pace as the camera sending over snapshots it will never encounter more than 1 file with a similar name. That seemed to work. Every minute I get a new webcam.jpg file with the same file size and time/date of the last sent snapshot from the camera. Only thing is when I try to open the webcam.jpg file, I get “no such file or directory” error.

It would be easiest to have a bash script that could do this rename and then use an SCP SFTP command to sent the jpg file to my meteotemplate webhost folder. I’ve only ever installed scripts of others and managed to edit with the help of instructions, but I don’t have the knowledge to built my own.

Next to that, I’ve tried the webcam plugin with manually uploaded snapshots, but I always get the missing settings.php error. I know that the instructions say to first install webcam plugin, create settings and run the cron and I did. I used to have my weathercam running on my meteotemplate site through Wunderground. Could that still interfere with webcam plugin? Is there a way to reset webcam plugin completely?

davidefa
Expert
Expert
Posts: 905
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Help request to get my webcam/weathercam online

Post by davidefa » Mon Dec 25, 2023 3:16 pm

Regarding option b) ( which in my opinion is the easiest as it takes only 'one step' ) I've done the following ( I have a few hikvision too but are DS-2CDxxxx ):
- configured the router to forward port 80 of the camera to the outside ( putting the camera in a 'demilitarized zone' should work too )
- take a snapshot of the camera going to http://IP_OF_TH_ROUTER/ISAPI/Streaming/channels/1/picture ( so dis should be the url to use in the webcam setup )

Not sure if the url is exactly the same for your camera ( search the online hikvision documentation ), but I need to authenticate ( username and password ) before accessing the image.
I have uploaded on the forum webcam plugin ver 3.2/3.3 which you can use ( it supports authentication without exposing your credentials )

P.S.
As you say, if you copy the webcam.jpg image 'by hand' and configure the webcam plugin, it should work.
If you have run the setup and the update script complaints it can't find the settings:
- verify the plugins/webcam permissions, it should be writeable ( files and sub folders, too )
- verify you have copied the updateWebcam.php script in the load/crons folder ( only from ver 3.3 the script can be executed in the plugins directory too )
To 'reset' the webcam plugin completely simply delete the plugins/webcam directory and reinstall the plugin
Last edited by davidefa on Mon Dec 25, 2023 3:30 pm, edited 1 time in total.
Image

davidefa
Expert
Expert
Posts: 905
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Help request to get my webcam/weathercam online

Post by davidefa » Mon Dec 25, 2023 3:29 pm

Regarding option c) you could :
1) register to one of those free hosting services, with ftp access too ( in Italy altervista,org is quite popular ). You will use this only to store, temporarily, the images
2) configure your camera to ftp the images to this new_server
3) rename the images ( and delete the old images )
4) configure the webcam plugin to access the image in this new_server

This option involves a few more steps ( and is not 'very elegant', but if it works... who cares ; - )
Image

willefg
Newbie
Newbie
Posts: 8
Joined: Fri Mar 08, 2019 12:27 am
Location: Bladel, the Netherlands
Station model: Froggit with GW2000
Software: WEEWX
Contact:

Re: Help request to get my webcam/weathercam online

Post by willefg » Mon Dec 25, 2023 4:07 pm

@davidefa
Thank you again for your help!

I tried your picture link from the Hikvision camera and mine responds to exactly the same url. It does ask for login credentials so I'll need to find your webcam plugin version. I already have port 80 open for my NAS so I'll be using a different port for the camera to access it from outside. I tested that already from an external connection and that works. I also created a new user with minimal rights in the camera so anyone "steeling" the password can only view the image not enter any settings.

davidefa
Expert
Expert
Posts: 905
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Help request to get my webcam/weathercam online

Post by davidefa » Mon Dec 25, 2023 8:30 pm

Forgot to add: run once the script:

Code: Select all

http://hetweerinbladel.frankwillems.com/template/plugins/webcam/updateWebcam.php?password=YOUR_UPDATE_PASSWORD
as this will create the necessary webcam table in the database
Image

willefg
Newbie
Newbie
Posts: 8
Joined: Fri Mar 08, 2019 12:27 am
Location: Bladel, the Netherlands
Station model: Froggit with GW2000
Software: WEEWX
Contact:

Re: Help request to get my webcam/weathercam online

Post by willefg » Tue Dec 26, 2023 6:24 pm

Thanks again @davidefa
Forgot to add: run once the script:

Code: Select all

.../template/plugins/webcam/updateWebcam.php?password=YOUR_UPDATE_PASSWORD

as this will create the necessary webcam table in the database
I wasn't sure what you meant with "UPDATE_PASSWORD". The ones for the camera link update and Meteotemplate admin gave "incorrect password". When I tried the one for the meteotemplate database on my host it start to run something, however after a while it came back with a "504 Gateway Timeout" message. It did, however, start loading a jpg file in the webcam/images folder, but one with 0kB. Since that nothing happened even with the cronjob running.

willefg
Newbie
Newbie
Posts: 8
Joined: Fri Mar 08, 2019 12:27 am
Location: Bladel, the Netherlands
Station model: Froggit with GW2000
Software: WEEWX
Contact:

Re: Help request to get my webcam/weathercam online

Post by willefg » Tue Dec 26, 2023 11:01 pm

It has been 5 years since I first setup meteotemplate, so it is a bit rusty. I could confirm what was meant with update-password as it is called just that in the config.php file; the SQL database password. (Sorry for being a nitwit…)
So, that leaves me with the 504 Gateway Timeout and me receiving a message from my host every time the cron runs and fails. It does generate a timestamped jpg but with nothing in it, just 0kB. I’ve tried with the credentials of the Hikvision http image in the webcam plugin in the URL, in the username/password fields and both. Does seem it struggles to retrieve the picture.

davidefa
Expert
Expert
Posts: 905
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Help request to get my webcam/weathercam online

Post by davidefa » Wed Dec 27, 2023 8:59 am

Please pm me the url and credentials to access your camera ( you can remove/change them when everything is ok ) so I can check on my meteotemplate test installation
Image

willefg
Newbie
Newbie
Posts: 8
Joined: Fri Mar 08, 2019 12:27 am
Location: Bladel, the Netherlands
Station model: Froggit with GW2000
Software: WEEWX
Contact:

Re: Help request to get my webcam/weathercam online

Post by willefg » Wed Dec 27, 2023 11:30 am

Thank you, Davidefa

I sent you a PM

willefg
Newbie
Newbie
Posts: 8
Joined: Fri Mar 08, 2019 12:27 am
Location: Bladel, the Netherlands
Station model: Froggit with GW2000
Software: WEEWX
Contact:

Re: Help request to get my webcam/weathercam online

Post by willefg » Sat Jan 06, 2024 1:19 am

PROBLEM SOLVED!

Thanks to Davidefa we managed to track the issue I had. If anyone else encounters a similar issue this might be helpful. Davidefa managed to get my webcam running on one of his Meteotemplate test installations, using the image capture url to my network with the weathercam. When I used that same url in Meteotemplate webcam plugin, it didn't work on my weather site that is hosted at a webhosting provider. It turns out that this provider limits the number of ports that can be called from a php script or otherwise wants to connect to. I had setup port forwarding on port 1234, which worked on the test installation and also when I addressed that from outside of my network. Davidefa then suggested to use ports like 80 or 443, which, to his knowledge, are more commonly used. That did solve the issue.

Davidefa, much thanks for the time and effort that you so kindly provided!

Post Reply