felipecrs / dahua-vto-on-home-assistant

This is my personal setup for using the Dahua VTO doorbell on Home Assistant, with no VTH or cloud dependency.
MIT License
9 stars 0 forks source link

Getting rid of Asterisk #1

Open moskovskiy82 opened 3 weeks ago

moskovskiy82 commented 3 weeks ago

Found a link for this solution on one of the telegram channels. Is asterisk required only for the button pressed event?

As this is easily achieved with the dahua integration or i get something wrong? Would love to have the same set up but setting up an asterisk for this seems will take too much time

trigger:

felipecrs commented 3 weeks ago

You can see in my automation.yaml that I already use such sensor:

https://github.com/felipecrs/dahua-vto-on-home-assistant/blob/164d142b7ee5e473e657e663848c2a140a8cd981/home-assistant/automations/doorbell-ringed.yaml#L4-L8

But on my tests, unless the VTO is connected to a SIP server (that's why Asterisk), such sensor won't fire.

moskovskiy82 commented 3 weeks ago

Well strange as for me it works without any flow. I have a VTO3211D

Haven't almost touched any settings but if it helps here is the setup

image

image

image

image

image

image Seems here room no doesn't do ....t

UPnP enabled but all failed :) And everything works including DMSS

image

image

image

felipecrs commented 3 weeks ago

Thank you. I had tested before using the VTO's own SIP Server and it didn't work. But I will test again. You are not the first one who says it works.

I have some questions though:

image

The IP address you blurred is the VTO's IP address?

And everything works including DMSS

That is one difference. I purposely disabled cloud access on my VTO.

Also, can you please explain what happens when you press the doorbell button with this setup?

What audio does it play? If the sensor is working correctly, I would expect it to play "Calling now, please wait a moment" and then nothing else.

moskovskiy82 commented 3 weeks ago
  1. Yes VTO's. As you can see when the SIP Server check box is checked all options are not available for change. I guess IP is put up automatically.
  2. As soon as the button is pressed "Calling now, please wait a moment" is played on VTO. DMSS shows an incoming call and the integration in HA fires an event. So i get an announcement "Someone is calling at the gate" on my smart speaker
felipecrs commented 3 weeks ago
  1. Yes VTO's. As you can see when the SIP Server check box is checked all options are not available for change. I guess IP is put up automatically.

Yes, intuitively that's what it does, but I read somewhere that these options can be changed, but you need to change them with "Enable SIP Server" unticked, save, and then tick it. Not sure if it's true anyway.

  1. As soon as the button is pressed "Calling now, please wait a moment" is played on VTO. DMSS shows an incoming call and the integration in HA fires an event. So i get an announcement "Someone is calling at the gate" on my smart speaker

Amazing. I wish I could replicate that. I will do some tests this weekend. I hope I don't need to enable cloud function for this to work though.

convicte commented 3 weeks ago

To add another point of data for your consideration @felipecrs my setup is identical to this of @moskovskiy82 as it comes to the VTO. Mine is a different model (VTO2101E), which could point to the fact it's a universal behavior for these VTOs. In addition, I am using https://github.com/rroller/dahua integration for triggering an HA automation, to have a T2S announcement from my Google speaker.

Pressing the button will trigger an Opened/Closed event in HA for the button entity: image

The automation is as simple as:

alias: Doorbell-cast-notification - through integration Dahua VTO
description: ""
trigger:
  - platform: state
    entity_id: binary_sensor.vto_button_pressed
    from: "off"
    to: "on"
condition: []
action:
  - service: media_player.volume_set
    data:
      volume_level: 1
    target:
      device_id:
        - REDACTED
  - repeat:
      count: "2"
      sequence:
        - service: tts.cloud_say
          data:
            entity_id: media_player.living_room_clock
            message: Ding-Dong, someone is at the door!
            language: en-IE
            cache: true
        - delay:
            hours: 0
            minutes: 0
            seconds: 5
            milliseconds: 0
  - service: media_player.volume_set
    data:
      volume_level: 0.5
    target:
      device_id:
        - REDACTED
mode: single

As for the VTO side, the announcement would at first be something to the effect of "Calling now, please wait a moment", but don't remember the exact wording, followed by another announcement when the call fails (since I don't have anything set up to actually pick it up). I don't remember the wording verbatim, but something like "Call was not picked up...". This announcement is made after 20–30 seconds of ringing.

I hope this helps! Would really love to recreate your setup without needing to deal with Asterisk, etc.

felipecrs commented 3 weeks ago

followed by another announcement when the call fails (since I don't have anything set up to actually pick it up)

You can solve that by cancelling the call as soon as possible after it starts ringing. Check my automation:

https://github.com/felipecrs/dahua-vto-on-home-assistant/blob/d03427bc7475e5e718567aeee55f157722b20145/home-assistant/automations/doorbell-ringed.yaml#L13-L15

felipecrs commented 3 weeks ago

But hey guys, if the button_pressed sensor is working for you with the built-in SIP server, you don't need Asterisk. As mentioned in my setup, that's the only reason why I needed it.

You can just skip setting up Asterisk in this case, and proceed with everything else. :D

Cr4z33 commented 4 days ago

Well strange as for me it works without any flow. I have a VTO3211D

Haven't almost touched any settings but if it helps here is the setup Tell me what did you setup then in Home Assistant to be able to get the VTO calls?

@moskovskiy82 can you please extend the details?

I am trying to get this working without the need of Asterisk.

Cr4z33 commented 4 days ago

OK while waiting for @moskovskiy82 reply I would like to give Asterisk a try therefore @felipecrs can you please give me some further details? 🙏🏼

Like what "SIP Domain" did you enter to connect the VTO to Asterisk?

Did you leave "VDP" or did you enter "asterisk" (as suggested by someone in another issue I cannot remember about)?

Also what extension number is Home Assistant then? 801?

I've got by the way a VTO2202F-P-S2.

felipecrs commented 3 days ago

@Cr4z33 check the files in this repository, I believe everything is explained there.

Cr4z33 commented 1 day ago

@felipecrs tell me did you have to enter the "5060" port and the "admin" SIP server username in the Asterisk integration config?

Actually would you mind copying&pasteing the YAML config here please? 😬

I still can't get it working. 🥲

felipecrs commented 23 hours ago

tell me did you have to enter the "5060" port and the "admin" SIP server username in the Asterisk integration config?

Where? I didn't understand it.

Anyway, the config is pretty much default as far as I remember:

ami_password: secretpass
auto_add: false
auto_add_secret: secretpass
video_support: false
generate_ssl_cert: true
certfile: fullchain.pem
keyfile: privkey.pem
additional_sounds: []
mailbox: false
mailbox_port: 12345
mailbox_password: ""
mailbox_extension: "100"
mailbox_google_api_key: ""
log_level: info
Cr4z33 commented 21 hours ago

@felipecrs thanks for sharing, but I got Asterisk working at last by editing sip.conf.

I had to change the default port to 5060.

After that my VTO calls got accepted by Asterisk.

Now I have to keep adapting your Frigate card code to my entities and devices so it's still a long journey... 🥵

I hope you won't mind if I will reply here again?

At the end of the day I think it's useful for everybody interested into it. 😅

felipecrs commented 20 hours ago

I had to change the default port to 5060.

I think you messed up with something. You didn't need to do this. sip.conf is for the deprecated chan-sip support. And 5060 is already the default for pjsip (pjsip.conf).

Furthermore, chan-sip (sip.conf) comes even disabled by default unless you enable it on modules.conf. So... what you are describing makes no sense to me.

I hope you won't mind if I will reply here again?

Absolutely not, please do it.

Cr4z33 commented 20 hours ago

Well before I was getting errors in the Asterisk addon logs when pressing the VTO button and also the Asterisk integration was accepting 5038 port only.

As soon as I changed the port to 5060 in sip.conf the integration accepted it too (and the errors were gone).