eu-evops / homebridge-hikvision

28 stars 21 forks source link

Need help with installation on homebridge #1

Open turbidWaters opened 3 years ago

turbidWaters commented 3 years ago

Hi I have been using homebridge-camera-ffmpeg. I came across your plug-in searching fo hikvision.

I want to help my brother, who has a hikvision system but does not have the facility to open ports on his internet connection. So, I am planning to get him a Apple Tv+homebridge so he can monitor his cameras when outside the house.

Can you please help me with installing this on homebridge? A sample config.json would greatly help.

Thanks in advance.

elfive commented 3 years ago

based on the code, configure should be like this(may not correct):

{
    "platform": "Hikvision",
    "displayName": "Camera 1",
    "channelId": 1,
    "username": "YOUR USERNAME HERE",
    "password": "YOUR PASSWORD HERE",
    "host": "YOUR CAMERA IP ADDRESS HERE",
    "secure": false,
    "hasAudio": true
}

but, after configured the config.json, homebridge crash and restart continuously with the error log below. so i think currently this plugin may still under development and not usable.

[10/12/2020, 11:14:16 AM] ====================
[10/12/2020, 11:14:16 AM] ERROR LOADING PLUGIN @evops/homebridge-hikvision:
[10/12/2020, 11:14:16 AM] Error: Cannot find module 'hap-nodejs'
Require stack:
- /homebridge/node_modules/homebridge-hikvision/dist/HikVisionNVR.js
- /homebridge/node_modules/homebridge-hikvision/dist/index.js
- /usr/local/lib/node_modules/homebridge/lib/plugin.js
- /usr/local/lib/node_modules/homebridge/lib/pluginManager.js
- /usr/local/lib/node_modules/homebridge/lib/api.js
- /usr/local/lib/node_modules/homebridge/lib/server.js
- /usr/local/lib/node_modules/homebridge/lib/cli.js
- /usr/local/lib/node_modules/homebridge/bin/homebridge
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/homebridge/node_modules/homebridge-hikvision/src/HikVisionNVR.ts:1:1)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
[10/12/2020, 11:14:16 AM] ====================
turbidWaters commented 3 years ago

Thanks @elfive

This error

[10/12/2020, 11:14:16 AM] Error: Cannot find module 'hap-nodejs'

Can be mitigated by (I think)

npm install -g hap-nodejs

I dont have the time to experiment right now and I am not good with tinkeing around with code.

Will try to attempt an install in the coming weekend anyway.

camorobot commented 3 years ago

Hi,

let me know if you got anny luck :)

kravena commented 3 years ago

Was getting the same error, performing the "npm install -g hap-nodejs" from the terminal window in the portal resolved that problem for me.

camorobot commented 3 years ago

Ey just try it with the ffmpeg plugin

This config is working for me:

{ "platform": "Camera-ffmpeg", "name": "Camera FFmpeg", "cameras": [ { "name": "Camera Achter", "manufacturer": "Hikvision", "videoConfig": { "source": "-i rtsp://USER:PASSWORD@IP:554/Streaming/Channels/102", "stillImageSource": "-i rtsp://USER:PASSWORD@IP:554/Streaming/Channels/101", "maxFPS": 25 } } ] },

sponte commented 3 years ago

Apologies for not responding earlier, but all github emails were going into my spam folder :(

Anyhow, please let me know if the issue is still present @turbidWaters. Latest version of this plugin should not be dependent on hap-nodejs anymore.

MykolaDiachok commented 3 years ago

Hi, @sponte! Yes, the issue is still present, and after added npm install -g hap-nodejs

tstordyallison commented 3 years ago

Yeah, same - I just installed this and ran into the same thing. A quick npm install -g hap-nodejs fixed it.

tstordyallison commented 3 years ago

Actually, then I got:

[12/18/2020, 4:29:06 PM] [Hikvision] Registering cameras with homebridge
(node:90384) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getLocalAddress' of undefined
    at RTPStreamManagement.generateSetupEndpointResponse (/Users/tomstordy-allison/.nvm/versions/node/v14.15.3/lib/node_modules/hap-nodejs/src/lib/camera/RTPStreamManagement.ts:1012:27)
    at /Users/tomstordy-allison/.nvm/versions/node/v14.15.3/lib/node_modules/hap-nodejs/src/lib/camera/RTPStreamManagement.ts:969:16
    at /Users/tomstordy-allison/.nvm/versions/node/v14.15.3/lib/node_modules/hap-nodejs/src/lib/util/once.ts:10:18
    at StreamingDelegate.prepareStream (/Users/tomstordy-allison/.nvm/versions/node/v14.15.3/lib/node_modules/@evops/homebridge-hikvision/node_modules/homebridge-camera-ffmpeg/src/streamingDelegate.ts:276:5)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

So I assume whatever version of hap-nodejs I got as 'latest' wasn't quite right. Will have a bit more of a dig.

tstordyallison commented 3 years ago

https://github.com/eu-evops/homebridge-hikvision/pull/10

Fixes the above, and a bunch of other small tidy up bits.

falsebit commented 2 years ago

Hi all,

Was wondering if you could point in the right direction here. Trying to install the Hikvision plugin and this is the first plug-in that I'm installing on Homebridge.

I'm getting the below error in the logging window of Homebridge; Starting to advertise 'Homebridge 8378 CA55' using ciao backend! [7/23/2021, 10:29:29 PM] Homebridge v1.3.4 (Homebridge 8378) is running on port 51434. Initializing HAP-NodeJS v0.9.4... [7/23/2021, 10:29:30 PM] [@evops/homebridge-hikvision] Launched child bridge with PID 3049 [7/23/2021, 10:29:31 PM] Registering platform '@evops/homebridge-hikvision.Hikvision' [7/23/2021, 10:29:31 PM] [@evops/homebridge-hikvision] Loaded @evops/homebridge-hikvision v1.0.17 child bridge successfully [7/23/2021, 10:29:31 PM] Loaded 0 cached accessories from cachedAccessories.0E55AE9EE02E. [7/23/2021, 10:29:31 PM] [@evops/homebridge-hikvision] Initialising accessories for HikVision... Preparing Advertiser for '@evops/homebridge-hikvision CCFC' using ciao backend! Starting to advertise '@evops/homebridge-hikvision CCFC' using ciao backend! [7/23/2021, 10:29:31 PM] Homebridge v1.3.4 (@evops/homebridge-hikvision) is running on port 30541. (node:3049) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'status' of undefined at AxiosDigest.getWwwAuth (/homebridge/node_modules/@evops/homebridge-hikvision/node_modules/axios-digest/index.ts:69:13) at processTicksAndRejections (internal/process/task_queues.js:95:5) (Usenode --trace-warnings ...to show where the warning was created) (node:3049) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:3049) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. (node:3049) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'status' of undefined at AxiosDigest.getWwwAuth (/homebridge/node_modules/@evops/homebridge-hikvision/node_modules/axios-digest/index.ts:69:13) at processTicksAndRejections (internal/process/task_queues.js:95:5)

Would anyone have any idea why I'm getting this error?

I'm also not sure on the dependencies, which is the below code;

sudo npm install -g homebridge-camera-ffmpeg @evops/homebridge-hikvision --unsafe-perm

Does this need to be run in the directory of where the .yml lives for Homebridge?

Thanks in advance.