Ok, this is most probably the most ridiculous and cumbersome way to overcome a problem that could be mitigated by a munfacturer easily, but until someone improves the firmware of the Ezviz DB1 the Home Automation enthusiasts will be stuck without the ability to use de keypress in a simpler way.
The story: the Ezviz DB1 does offer ONVIF (if flashed with the Hikvision firmware LINK) and the Onvif integration does allow you to use motion alerts, but somehow someone forgot to add a simple “doorbell press” to it.
First I tried to circumvent this issue by adding a relay, but failed (the relay didn’t respond and I didn’t bother to further investigate). After some reading it became clear that the Hikvision doorbell connects to a webserver (http://alarm.eu.s3.amazonaws.com/) every time it’s button was pressed.
As I am running Pihole I could find these DNS queries in my logs which led me to the idea of using that in homeassistant. I therefore created the following script that continuously runs through the pihole log to see if there are any DNS queries to that server and if so; flip the switch of my doorbell in Homeassistant. This script runs in a cron at reboot.
It also works with an input boolean and a little modification to your command. I even created a second way to update the input boolean using the RESTapi.
Ok, the script works if I run it manually, but I cannot get it to work on the background on my dockerized pihole. How did you setup the script to run at reboot?
I tried to create a file calling the script in /etc/cron.d/, tried to add a reference to the script through crontab -e, but all without success.
I run it in Cron at the host. This does mean that it is best to store the pihole log somewhere in the filesystem of the host. This was for me, as relative Docker noob, the biggest challenge to figure out.
Docker noob here also, so your hint helped me again. I have set it up like you did: store the log local on my Ubuntu machine instead of in the docker container, and make the script run on the Ubuntu host. This works directly.
Thanks for the post - I am trying to use the same DNS query trigger and have it working with a binary_sensor that Alexa can sense, but I cannot figure out how to reset the state to OFF after doorbell press. This seems so silly that I cannot believe there is not an easy solution. Am I missing something?? I tried working with an input_boolean and was hopeful with that, but Alexa does not work with that as a trigger for a routine (which is what I am after). I have tried off_delay but that does not seem to work for me. Any help or suggestions would be greatly appreciated!
There isn’t an option in Adguard or Pihole. That’s why, if you look at my mentioned script, I constantly monitor the log of pihole and trigger based on that.
I added my doorbell to Motioneye and then use the “stream” function of Motioneye to further do the cool stuff in homeassistant. Camera is added via rtsp URL as: rtsp://192.168.1.107:554/Streaming/Channels/101
Are you also using homekit? I added the camera directly to ha via the rstp url you pasted. But in homekit it takes ages to load the camera. But in HA its fast.
I don’t use homekit. Just to check: you did change the IP address of the camera didn’t you? Chances are next to none you have it running on the same IP as I am running it…
It is quite common for a stream to take some time to start. What you can do is keep the stream alive. This can be done with the preload stream setting. More on this can be found at: Camera - Home Assistant