Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button press sensor only fires if the doorbell is connected to SIP #359

Closed
felipecrs opened this issue May 26, 2024 · 18 comments
Closed

Button press sensor only fires if the doorbell is connected to SIP #359

felipecrs opened this issue May 26, 2024 · 18 comments

Comments

@felipecrs
Copy link

felipecrs commented May 26, 2024

I have a VTO2202F-P-S2, and I am building a guide to make it work with Home Assistant without the VTH or the Cloud services.

Everything works great, including the button press sensor of this integration.

However, if I disconnect the SIP server, the button press sensor no longer changes/fires. Which is sad for me because this means I need a full-blown Asterisk server just for this.

So, I wonder if there's any alternative.

I will try capturing the event logs later.

@felipecrs
Copy link
Author

felipecrs commented May 26, 2024

This is the only event that fires in such case:

--myboundary
Content-Type: text/plain
Content-Length: 74

Code=SIPRegisterResult;action=Pulse;index=0;data={
   "Success" : false
}

--myboundary

At least it appears to be consistent.

@felipecrs
Copy link
Author

felipecrs commented May 26, 2024

According to my tests, the same event is not triggered when SIP is connected normally.

I think it's a good idea to also check for this event to consider the doorbell button pressed. @rroller, what do you think?

@myhomeiot
Copy link

@felipecrs if you need all events from Dahua VTO including doorbell button press, you can try my integration which is just about events and commands, it's should works without active SIP connection.

@felipecrs
Copy link
Author

Hi @myhomeiot, that is really helpful. Thank you.

But I have some automations based on this integration and would prefer not to change it.

I believe this is just a corner case that can be fixed by adding one extra condition here:

# Convert doorbell pressed related events to common event name, DoorbellPressed.
# VTO devices will use the event BackKeyLight and the Amcrest devices seem to use PhoneCallDetect
if code == "BackKeyLight" or code == "PhoneCallDetect":
code = "DoorbellPressed"

@myhomeiot
Copy link

myhomeiot commented May 27, 2024

@felipecrs It's already check the BackKeyLight code which generated if someone press the doorbell button, so it's should work.
You can check if your VTO sends this event without SIP server setup.

@felipecrs
Copy link
Author

You can check if your VTO sends this event without SIP server setup.

Isn't this what I did?

This is the only event that fires in such case:

--myboundary
Content-Type: text/plain
Content-Length: 74

Code=SIPRegisterResult;action=Pulse;index=0;data={
   "Success" : false
}

--myboundary

At least it appears to be consistent.

I was using the following command:

curl -s --digest -u admin:$DAHUA_PASSWORD  "http://192.168.1.203/cgi-bin/eventManager.cgi?action=attach&codes=[All]&heartbeat=5"

Also, if the VTO was sending out the BackKeyLight code event I suppose the button press sensor would be working.

Please let me know if I did something wrong.

@myhomeiot
Copy link

I was using the following command:

I check events from my VTO using this command and it's doesn't show any BackKeyLight events at all, I think this is a limitation of eventManager.cgi HTTP. But this integration definitely receives it using DHIP connection. The question is if it's still generated when no active SIP connection.

@felipecrs
Copy link
Author

Oh, I see. Do you know of an easy way to subscribe to all events, including these BackKeyLight, so that I can test here?

@myhomeiot
Copy link

Oh, I see. Do you know of an easy way to subscribe to all events, including these BackKeyLight, so that I can test here?

I think the simplest way will be installing my integration (it's can work in parallel with this integration) and check all coming dahua_vto events from Developer Tools->Events or by this simple automation Dahua VTO All Events

@felipecrs
Copy link
Author

Sounds good. I will report back once I have the data for this test. Thank you!

@smol84
Copy link

smol84 commented May 30, 2024

I sitll have this issue, anyone else?

@felipecrs
Copy link
Author

I sitll have this issue, anyone else?

Also when the doorbell is disconnected from SIP?

@felipecrs
Copy link
Author

Ok, @myhomeiot I finished testing events using your integration. The result is:

  • When the VTO is NOT CONNECTED to a SIP server, NO EVENT is emitted on button press.

The SIPRegisterResult is just fired from time to time, I guess it's the VTO attempting to connect to the SIP server.

This means the VTO is useless when not connected to a SIP server and nothing can be done to capture the button press in such case, I think, therefore I am closing this issue.

However, it is not very difficult to run the Asterisk add-on to have a SIP server the doorbell can connect to. That's what I do.

@felipecrs felipecrs closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2024
@myhomeiot
Copy link

@felipecrs Thanks for the update! Can you try to use VTO local SIP server if you have this option?

image

@felipecrs
Copy link
Author

felipecrs commented May 30, 2024

This is what I was trying first. Same results. No event emitted. And immediately after pressing the button the doorbell says "The call was not answered". Which is the same as when the doorbell is not connected to SIP.

@felipecrs
Copy link
Author

I think for this option to work, it needs a VTH connected. Or some extension connected to the VTO SIP Server so the VTO can call it.

@convicte
Copy link

@felipecrs I am really interested in your efforts to integrate the Dahua VTOs with HA and am already really impressed with your progress.
#kudos.

This said I am struggling to understand the issue you are having with capturing the button presses. While I am not using @myhomeiot integration right now (may switch if need be), since it was predated by https://github.com/rroller/dahua which worked as well, there is really no issue in getting the button presses into HA.

It may be that I am missing some important detail here. If you could please explain, maybe we can figure it out.

BTW, my SIP is also set up to be enabled on device and I don't have a Dahua VTH panel, nor any panel for this matter. Just using the VTO as a camera and a dumb doorbell ringer.

Screenshot_20240531_004014_Firefox.jpg

@felipecrs
Copy link
Author

@convicte, this is surprising to me. Can you please share some more details?

What did you fill in this page exactly?

What number is the VTO configured to call? Default is 9901 I think.

What does the VTO say (voice prompt) when you press the button? Is it "Calling now"?

And finally, you mean the binary_sensor.button_press is working normally for you when using the built-in SIP Server and no VTH?

Maybe it has something to do with firmware version. I am using latest from Dahua website,

DHI-VTO2202F-P-S2
4.600.0000000.0.R,build:2022-08-13

Or maybe my model behaves differently than yours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants