VStarcam Motion Detection

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

User avatar
Marci
Posts: 532
Joined: Friday 22 January 2016 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Wakefield, West Yorkshire UK
Contact:

Re: VStarcam Motion Detection

Post by Marci »

(But no, there's no useful logging... but it should acknowledge connections with FTP Client Connected, and any default ftp errors)
Extended Domoticz homebridge-plugin for latest Homebridge - adds temp/humidity/pressure sensors, power consumption sensors, DarkSkies virtual weather station support, YouLess Meter support, general % usage support & switch/lamp status checking!
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: VStarcam Motion Detection

Post by simon_rb »

When its running and I try to connect to the ftp server it fails. Hmmm
User avatar
Marci
Posts: 532
Joined: Friday 22 January 2016 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Wakefield, West Yorkshire UK
Contact:

VStarcam Motion Detection

Post by Marci »

Fails as in... error? Script restarts? Does the uploads folder exist and is it write able?
Extended Domoticz homebridge-plugin for latest Homebridge - adds temp/humidity/pressure sensors, power consumption sensors, DarkSkies virtual weather station support, YouLess Meter support, general % usage support & switch/lamp status checking!
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: VStarcam Motion Detection

Post by simon_rb »

There is an ftp test on the camera, every time I click test it fails the test and the sensor doesn't change in domoticz I have tried to connect to the ftp server from my Mac with no success. I shall check the folder and permissions now
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: VStarcam Motion Detection

Post by simon_rb »

The folder is there and is writable. Have noticed that while forever server_ftp is running my Pi stays at 96% usage. If I end it, it goes down to about 15%. I think its looping itself on my Pi.

Update:- I was right, its just trying to restart the file. This is my log

/home/pi/domoticz-cam-bridge/server_ftp.js:27
var hostaddr = '192.168.1.26’; // Domoticz IP
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:475:10)
at startup (node.js:117:18)
at node.js:951:3
error: Forever detected script exited with code: 1
error: Script restart attempt #1
/home/pi/domoticz-cam-bridge/server_ftp.js:27
var hostaddr = '192.168.1.26’; // Domoticz IP
User avatar
Marci
Posts: 532
Joined: Friday 22 January 2016 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Wakefield, West Yorkshire UK
Contact:

Re: VStarcam Motion Detection

Post by Marci »

Wrong apostrophe at end of the quoted line.... Needs to be ' not ’
Extended Domoticz homebridge-plugin for latest Homebridge - adds temp/humidity/pressure sensors, power consumption sensors, DarkSkies virtual weather station support, YouLess Meter support, general % usage support & switch/lamp status checking!
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: VStarcam Motion Detection

Post by simon_rb »

Thanks! Can't believe I missed that lol. Another error.

module.js:338
throw err;
^

Error: Cannot find module 'ftpd'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/pi/domoticz-cam-bridge/server_ftp.js:3:12)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:475:10)
error: Forever detected script exited with code: 1
error: Script restart attempt #1
module.js:338
throw err;
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: VStarcam Motion Detection

Post by simon_rb »

I don't think I have Pure FTP installed. Im guessing I need that so I'll install using this:-
sudo apt-get install pure-ftpd

Is that right?
User avatar
Marci
Posts: 532
Joined: Friday 22 January 2016 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Wakefield, West Yorkshire UK
Contact:

Re: VStarcam Motion Detection

Post by Marci »

Run npm install ftpd from within the folder containing server_ftp.js
Extended Domoticz homebridge-plugin for latest Homebridge - adds temp/humidity/pressure sensors, power consumption sensors, DarkSkies virtual weather station support, YouLess Meter support, general % usage support & switch/lamp status checking!
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: VStarcam Motion Detection

Post by simon_rb »

Thanks mate, nearly there lol. At least its listening now..

ftpd #1 is listening on port 8089
ftpd #2 is listening on port 8090
2016:08:17:22:27:44: FTP Client #1 Connected
/home/pi/domoticz-cam-bridge/server_ftp.js:71
request.get('http://'+host+':'+port+'/json.htm?type=command&param=switchlight&idx='+idx1+'&switchcmd=On').on('error', function(err){
^

ReferenceError: host is not defined
at FtpServer.<anonymous> (/home/pi/domoticz-cam-bridge/server_ftp.js:71:26)
at emitOne (events.js:77:13)
at FtpServer.emit (events.js:169:7)
at FtpServer._onConnection (/home/pi/domoticz-cam-bridge/node_modules/ftpd/lib/ftpd.js:147:8)
at Server.<anonymous> (/home/pi/domoticz-cam-bridge/node_modules/ftpd/lib/ftpd.js:108:10)
at emitOne (events.js:77:13)
at Server.emit (events.js:169:7)
at TCP.onconnection (net.js:1427:8)
error: Forever detected script exited with code: 1
error: Script restart attempt #1
ftpd #1 is listening on port 8089
ftpd #2 is listening on port 8090
2016:08:17:22:32:01: FTP Client #1 Connected
/home/pi/domoticz-cam-bridge/server_ftp.js:71
request.get('http://'+host+':'+port+'/json.htm?type=command&param=switchlight&idx='+idx1+'&switchcmd=On').on('error', function(err){
^
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: VStarcam Motion Detection

Post by simon_rb »

I think its working. Changed the hostaddr to host :)
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: VStarcam Motion Detection

Post by simon_rb »

Nearly a year to the day and this has stopped working. I updated Node and I think that has something to do with it. I have opened an issue in GitHub as well. It contains this below..

Hi,

Not sure if this is maintained, this has worked solidly since this was first released. I did an update on nodes when upgrading homebridge. For some reason this isn't working anymore.. I have ran npm install in the domoticz-cam-bridge directory and that hasn't worked.

Any logs I can send you?

Code: Select all

pi@raspberrypi:~/domoticz-cam-bridge$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/forever-monitor/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN [email protected] license should be a valid SPDX license expression
pi@raspberrypi:~$ node -v
v7.10.1

pi@raspberrypi:~$ sudo systemctl status domoticz-ftp-cam-bridge.service -l
● domoticz-ftp-cam-bridge.service - Domotic FTP Cam Bridge Service
   Loaded: loaded (/lib/systemd/system/domoticz-ftp-cam-bridge.service; enabled)
   Active: inactive (dead) since Sat 2017-08-12 16:58:35 BST; 3 days ago
 Main PID: 2109 (code=exited, status=0/SUCCESS)

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
pi@raspberrypi:~$ forever restart /home/pi/domoticz-cam-bridge/server_ftp.js
info:    Forever restarted process(es):
data:        uid  command         script                                     forever pid   id logfile                    uptime      
data:    [0] EL39 /usr/bin/nodejs /home/pi/domoticz-cam-bridge/server_ftp.js 26009   29256    /home/pi/.forever/EL39.log 0:0:0:1.298 
You have new mail in /var/mail/pi
pi@raspberrypi:~$ sudo systemctl status domoticz-ftp-cam-bridge.service -l
● domoticz-ftp-cam-bridge.service - Domotic FTP Cam Bridge Service
   Loaded: loaded (/lib/systemd/system/domoticz-ftp-cam-bridge.service; enabled)
   Active: inactive (dead) since Sat 2017-08-12 16:58:35 BST; 3 days ago
 Main PID: 2109 (code=exited, status=0/SUCCESS)
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: VStarcam Motion Detection

Post by simon_rb »

Somehow I managed to get it working. Changed process.EventEmitter to just events within the ftpd,js file. (there was 3 of them in my file).
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest