Skip to content

Commit

Permalink
Fixed some bugs (#1547)
Browse files Browse the repository at this point in the history
* Fixed reconnection bugs

* Updated documentation

* hikvision-doorbell version up

---------

Co-authored-by: Roman Sokolov <calm@adguard.com>
  • Loading branch information
Roman Sokolov and vityevato authored Aug 8, 2024
1 parent 12c734f commit 947aa15
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
10 changes: 8 additions & 2 deletions plugins/hikvision-doorbell/fs/DOORBELL_README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Hikvision Doorbell (beta)
# Hikvision Doorbell

At the moment, plugin was tested with the **DS-KV6113PE1[C]** model `doorbell` with firmware version: **V2.2.65 build 231213**, in the following modes:

Expand Down Expand Up @@ -30,16 +30,22 @@ The interaction mode is configured using the **SIP Mode** combobox. The plugin s

#### Don't Use SIP

In this mode, a SIP proxy is not used, and the `doorbell` must be connected to `Hik-Connect` or to your `Indoor Station`.
This mode should be used if you have an **Indoor Station** and a `doorbell` connected to it.

You should also enable the **Hik-Connect** (Platform Access Mode) in the `doorbell` settings so that `this device` receives a call notification. These are the implementation features of the doorbell software, unfortunately.

#### Connect to SIP Proxy

This mode should be used when you have a separate SIP gateway and all your intercom devices work via SIP telephony.

**On this device** you need to configure a connection to your SIP proxy (gateway) in the additional tab, which will appear after saving the selection.

**On `doorbell`** also set up a connection to a SIP proxy (gateway), and also, in the appropriate section of the settings, specify the “phone number” of this device so that a call will also be received here.

#### Emulate SIP Proxy

This mode should be used when you have a `doorbell` but no **Indoor Station**, and you want to connect this `doorbell` to Scrypted server only.

In this mode, the plugin creates a fake SIP proxy that listens for a connection on the specified port (or auto-select a port if not specified). The task of this server is to receive a notification about a call and, in the event of an intercom start (two way audio), simulate picking up the handset so that the `doorbell` switches to conversation mode (stops ringing).

On the additional tab, configure the desired port, and you can also enable the **Autoinstall Fake SIP Proxy** checkbox, for not to configure `doorbell` manually.
Expand Down
2 changes: 1 addition & 1 deletion plugins/hikvision-doorbell/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vityevato/hikvision-doorbell",
"version": "0.0.4",
"version": "0.0.5",
"description": "Hikvision Doorbell Plugin for Scrypted",
"author": "Roman Sokolov",
"license": "Apache",
Expand Down
6 changes: 2 additions & 4 deletions plugins/hikvision-doorbell/src/doorbell-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,8 @@ export class HikvisionDoorbellAPI implements HikvisionAPI

} catch (error) {
this.console.error(`Install error: ${error}`);
if (error.code === 'EHOSTUNREACH') {
// if host unreached we rethrows error for restarting of the installation process
throw error;
}
// we rethrows error for restarting of the installation process
throw error;
}
}

Expand Down
11 changes: 7 additions & 4 deletions plugins/hikvision-doorbell/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,12 +541,11 @@ class HikvisionCameraDoorbell extends HikvisionCamera implements Camera, Interco
if (autoinstall) {
try {
await this.getClient().setFakeSip (true, ip, port)
this.console.info (`Installed fake SIP settings on doorbell. Address: ${ip}, port: ${port}`);
} catch (e) {
this.console.error (`Error installing fake SIP settings: ${e}`);
if (e.code === 'EHOSTUNREACH') {
// repeat if unreached
this.installSipSettingsOnDeviceTimeout = setTimeout (() => this.installSipSettingsOnDevice(), UNREACHED_REPEAT_TIMEOUT);
}
// repeat if unreached
this.installSipSettingsOnDeviceTimeout = setTimeout (() => this.installSipSettingsOnDevice(), UNREACHED_REPEAT_TIMEOUT);
}
}
}
Expand Down Expand Up @@ -668,6 +667,10 @@ export class HikvisionDoorbellProvider extends RtspProvider
super();
}

getScryptedDeviceCreator(): string {
return 'Hikvision Doorbell';
}

override getAdditionalInterfaces() {
return [
ScryptedInterface.Reboot,
Expand Down

0 comments on commit 947aa15

Please sign in to comment.