ihrigb / node-red-contrib-doorbird-ultimate

Node Red Integration for Doorbird Devices
https://flows.nodered.org/node/node-red-contrib-doorbird-ultimate
Apache License 2.0
4 stars 3 forks source link

Doorbird Ring node triggers a restart on doorbell press #6

Closed Ryanshafer closed 2 years ago

Ryanshafer commented 2 years ago

I am currently running Node v14.19.1, Node Red 2.2.2 on Linux 5.10.63-v8+ arm64 LE

My flow is simple, I have The Doorbird ring node connected to a debug. Once I press the Doorbird's doorbell, Node Red immediately restarts.

Here is the log of the event and restart:

28 Mar 10:27:55 - [red] Uncaught Exception:
28 Mar 10:27:55 - [error] TypeError: this.strech is not a function
    at Socket.DoorbirdUdpSocket.onMessage (/home/pi/.node-red/node_modules/doorbird/dist/index.js:120:14)
    at Socket.emit (events.js:400:28)
    at Socket.emit (domain.js:475:12)
    at UDP.onMessage [as onmessage] (dgram.js:931:8)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Service RestartSec=20s expired, scheduling restart.
nodered.service: Scheduled restart job, restart counter is at 1.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.

Let me know if you need any more info or need me to try anything.

thanks!

illiteratealliterator commented 2 years ago

I've just got myself a Doorbird Doorbell, and I'm running into the same problem as @Ryanshafer when trying to catch a ring event.

I suspect the problem might be the onMessage function being called with the wrong 'this' value due to:

this.server.on("message", this.onMessage);

Perhaps something like this would do the trick?

this.server.on("message", (msg) => this.onMessage(msg));

I tried hacking this into my local version, but I ran into a subsequent error:

sodium.crypto_pwhash is not a function

Any chance you'd have time to get the 'Ring' node up and running again?

Thanks, the library looks really promising :)

Ryanshafer commented 2 years ago

As a work around, I (sadly) deactivated this node and used the built in http webhooks within the doorbird settings to call an http node to accomplish the same end result. I still am hoping that this bug will get resolved as my work around isn’t ideal.

On Thu, Jul 28, 2022 at 1:25 PM illiteratealliterator < @.***> wrote:

I've just got myself a Doorbird Doorbell, and I'm running into the same problem as @Ryanshafer https://github.com/Ryanshafer when trying to catch a ring event.

I suspect the problem might be the onMessage function being called with the wrong 'this' value due to:

this.server.on("message", this.onMessage);

Perhaps something like this would do the trick?

this.server.on("message", (msg) => this.onMessage(msg));

I tried hacking this into my local version, but I ran into a subsequent error:

sodium.crypto_pwhash is not a function

Any chance you'd have time to get the 'Ring' node up and running again?

Thanks, the library looks really promising :)

— Reply to this email directly, view it on GitHub https://github.com/ihrigb/node-red-contrib-doorbird-ultimate/issues/6#issuecomment-1198013887, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH5UICJKPOGETW5TBMFWYLVWJUY5ANCNFSM5R3BJH2A . You are receiving this because you were mentioned.Message ID: @.***>

illiteratealliterator commented 2 years ago

I was wondering if something like that would be possible, but I haven't run into anything in the app that would let me configure that. Are these webhooks something you need to configure using the LAN API? I just got NodeRed to play a doorbell sound on our Sonos... keen to find a way to hook it up to the actual doorbell!

Ryanshafer commented 2 years ago

Yeah, it is a bit convoluted to set up, which is why this node would be cleaner.

If I recall correctly, in the doorbird admin, you first need to create the http call that will match the IP + url in the node red HTTP node. I used http://{server ip}/doorbird/. Once created, then you need to schedule when it can be called on doorbell press. If the doorbell is pressed at the allowed day/time, the dorbird will make the http call. That's the basic idea.

The http call setup is located, oddly, under a section called "Favorites". The scheduling is done using "Actions". On that screen, at the top, you will have to switch from "relays" to "HTTP calls". Select your favorite and then turn the boxes blue for days/hours you want the http call to be made when pressed. 1 http call is allowed only. I just selected everything and let node red handle when and where to play the chime. Im using TTS-Ultimate node to connect to my sonos. You can upload your own mp3 for the chime, which is cool, set volume and which sonos, etc. The doorbird manual sort of describes each section in more detail: https://manual.doorbird.com/app/en/home.html.

Once set up, add a new flow with the http node setup with the same http url and set as get. Add a debug node. Publish and press the button and you should see it come through in the debug, if set up properly. If so, all you have to do is send the http call node to a change node and set the msg.output to true. Connect that to the TTS-Ultimate and you have a doorbell. If you want to use a custom ring, use the ownfileultimate node that comes with the tts-ultimate.

Good luck!

On Thu, Jul 28, 2022 at 2:12 PM illiteratealliterator < @.***> wrote:

I was wondering if something like that would be possible, but I haven't run into anything in the app that would let me configure that. Are these webhooks something you need to configure using the LAN API? I just got NodeRed to play a doorbell sound on our Sonos... keen to find a way to hook it up to the actual doorbell!

— Reply to this email directly, view it on GitHub https://github.com/ihrigb/node-red-contrib-doorbird-ultimate/issues/6#issuecomment-1198059454, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH5UIDYTYY5SB4CMZUGXVTVWJ2J3ANCNFSM5R3BJH2A . You are receiving this because you were mentioned.Message ID: @.***>

ihrigb commented 2 years ago

I will try to look into this in the next couple of days!

ihrigb commented 2 years ago

Issue is fixed with version 0.0.9 as far as I can test it. Please check it on your setup and let me know, if there are still any problems.

illiteratealliterator commented 2 years ago

@Ryanshafer Thanks for the detailed breakdown, much appreciated! I'd seen both the Favorites and the Schedule UIs but it hadn't occurred to me that those are what you'd use to setup something like a ring web hook. Whacky!

@ihrigb I installed 0.0.9 and that's fixed it, thank you so much! I'm now successfully getting events when the doorbell is rung. The event names seem a little strange though. First, 'motion' events are coming through here too (which is fine, I can filter them), but the 'ring' event is named "1" with a bunch of spaces in the name. Does that look right to you? I'm guessing this is just how Doorbird works, but thought I'd mention it before working around it.

image

ihrigb commented 2 years ago

@illiteratealliterator I'd be fine to trim the event - doorbird just reserves eight bytes for the event. Then my filter for motion events would actually work, so you do not need to filter. I will update this tomorrow or so. Thanks for the feedback!