hjdhjd / homebridge-doorbird

Homebridge plugin for Doorbird
Apache License 2.0
54 stars 14 forks source link

Different port each startup #36

Closed bleistift2 closed 4 years ago

bleistift2 commented 5 years ago

Hi,

thank you for the plugin, I'm using it with a D301 and it works great. Unfortunately the plugin is using a different port after each restart ("DoorBird is running on port ...", not the one it is listening on). Since my Homebridge is located in a docker container on a Synology NAS I have to re-configure the firewall each time to keep it working.

Is there a way to specify the port?

Another small issue, since the D301 doesn't support a camera I'm only using the lock, is there a way to delete/hide the camera and motion sensor devices in HomeKit but keep the lock?

Thanks in advance for the support.

bombadiltom commented 5 years ago

As the port is a camera and your device does not support one, why do you need access to it? Anyway, at the moment, the port given in videoconfig is used for the webserver. This could be changed to a new config value and the given port could be used for the camera.

Also, at the moment the camera is always created, but as the device type is a config value, this could be implemented with some if statements...

Are there any other doorbird devices without camera?

bleistift2 commented 5 years ago

Thanks for your answer. I don't know about other Doorbird devices without a camera other than the D301 at the moment but the updated D302 has been announced a while ago. The plugin informs about two ports at startup: "DoorBird is listening on port XXXX" and "DoorBird is running on port YYYY" I've managed to set the XXXX port (is that the webserver?) in the config but I haven't found a value to set the port YYYY the Plugin is running on. Each startup it states a different port. My problem is that without the YYYY port accessible all 3 HomeKit devices (lock, camera and motion sensor) are marked as "not available" even if the webserver port XXXX is accessible. Unfortunately I'm new at using homebridge, what do you mean with if statements?

mrhund commented 5 years ago

The XXXX Port is the Webserver, which is used for forwarding the events and can be configured in the config file. The other Port (YYYY) is assigned by Homebridge dynamically at startup and afaik cannot be set to a fixed port.

Von meinem iPad gesendet

Am 08.08.2019 um 22:17 schrieb bleistift2 notifications@github.com<mailto:notifications@github.com>:

Thanks for your answer. I don't know about other Doorbird devices without a camera other than the D301 at the moment but the updated D302 has been announced a while ago. The plugin informs about two ports at startup: "DoorBird is listening on port XXXX" and "DoorBird is running on port YYYY" I've managed to set the XXXX port (is that the webserver?) in the config but I haven't found a value to set the port YYYY the Plugin is running on. Each startup it states a different port. My problem is that without the YYYY port accessible all 3 HomeKit devices (lock, camera and motion sensor) are marked as "not available" even if the webserver port XXXX is accessible. Unfortunately I'm new at using homebridge, what do you mean with if statements?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fbrownad%2Fhomebridge-doorbird%2Fissues%2F36%3Femail_source%3Dnotifications%26email_token%3DAGOOB2Z3S6YSQWHNYUF4OO3QDR5PBA5CNFSM4IKEG6M2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD34ZAXA%23issuecomment-519671900&data=02%7C01%7C%7Caf092cdcc4de444b7bd308d71c3d7e0e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637008922735095207&sdata=wxM1qW8RLZkct6y5SYnQ9FHftuojKJHp2OOdJBcHlSI%3D&reserved=0, or mute the threadhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGOOB2YCU2API7RZSBWA4YLQDR5PBANCNFSM4IKEG6MQ&data=02%7C01%7C%7Caf092cdcc4de444b7bd308d71c3d7e0e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637008922735105218&sdata=s5yEdWx8546svwhv4mm5bSBaxEoBDbd0ub4%2BGmu8VGg%3D&reserved=0.

bombadiltom commented 5 years ago

Fixed camera port is possible: https://github.com/nfarina/homebridge/issues/927

bombadiltom commented 5 years ago

BTW: "if statements" are not user related, this would have to be implemented in the source

bleistift2 commented 5 years ago

Thank you for the link and the information. Unfortunately I didn't manage to get it working so far. server.js already had a port parameter, I nevertheless added another, so it looks like this:


      username: advertiseAddress,
      pincode: accessoryPin,
      category: accessory.category,
      port: accessoryPort,
      port: accessory.cameraSource.port,
      mdns: this._config.mdns
    }, this._allowInsecureAccess);```
Since I don't have a camera and therefore don't have ffmpeg installed I didn't know where to add
`ffmpeg.js -> this.port = cameraConfig.portc;`
and added
`"accessory.cameraSource.port": 5000`
directly under the camera listening `"port": 5001` in the config.js.
Since that didn't work, what's the right way to do it?
Are the 2 port parameters in server.js the problem?
How do I define the parameter in config.js?
bombadiltom commented 5 years ago

Changing the config.js is not enough, all referenced issues refer to different versions of ffmges.js, so at first the latest version of ffmeg.js would have to be integrated.

What about just commenting out those three lines: // Setup and configure the camera services var cameraSource = new FFMPEG(hap, cameraConfig, self.log, videoProcessor); doorBirdAccessory.configureCameraSource(cameraSource); But as the whole thing is added as a video doorbell, I do not know, how HomeKit reacts to this.

bleistift2 commented 5 years ago

Unfortunately commenting out these lines results in the whole plugin refusing to start. So it seems like in order to fix the port of the Doorbird plugin I'll have to install the otherwise not needed ffmpeg plugin and try the way suggested in the other thread. I'll try it some day next week, thank you.