Have a DVR which is setup for motion detection and it has a alarm output. I want this to trigger a home assistant service called image_processing.scan. Home Assistant is Hassio/PI. Whats the easy way to interface the two? DVR’s output is a relay open/close. Do I add a ESP to monitor the relay open/close or can I interface with PI DBus? Ideas example?
Currently using FFMPEG_motion but struggling to get a good trigger/result.
Do you run HA on a Pi and is it near the DVR? You could just connect the DVR to the Pi GPIOs. Otherwise ESP if you need the two separate (or you dont use a Pi).
DVR and PI are close just not sure how to interface the two together. Have built ESPs but sort of want some instructions to get me started. @ Bartem its generic DVR no API that I can see. I have Node Red sensors for Disk space/status running but I dont see any alarm out but thats a good point will recheck.
If you can confirm the alarm output is just Normally Open going to Closed (or the reverse), you can wire it to a PI GPIO input.
Set the input to have an internal pulldown enabled, and connect GPIO(x) to the alarm relay -, and alarm relay + to GPIO 3.3V. The input should show up as low until the DVR triggers the alarm output, which should see the GPIO go high. Add the GPIO to HA through the GPIO interface,
If there is an API, that would definitely be the better option but the above should also work.
@callifo thanks no API just a log but I would need to make a Node Red flow to query the log for the event and by then the event is long gone. Type of internal pull resistor to use. Options are UP - pull-up resistor and DOWN - pull-down resistor - does this mean that to internal pulldown that the PI has internal resistors or as per a ESP do I add one between the GPIO pin selected and ground? Which is the best GPIO to start with (e.g 11?) https://pinout.xyz/resources/raspberry-pi-pinout.png
Yes it has a very weak configurable pull-up/down resistor internally, so you don’t need to add an external one; though it won’t hurt if you do.
Pin doesn’t really matter, maybe don’t use one of the multi use ones (e.g. serial, i2c, etc) incase you want to use it later.
Just to confirm what the output is, put a multimeter on the output and confirm when noalarm/alarm, there is no voltage output and that it either goes open circuit to short circuit or the reverse.