A bit of a late reply.
I used a Sonoff SV in isolated mode (the same way that it is used for garage door motors and electric gates). Energisers have dry contacts inside so you can hook up a few different things to them. I also flashed the SV with ESPHome so it intergrates without problem into HA.
1. The on/off dry contact is hooked up to the SV's relay which toggles on/off for a second or so to simulate the magnetic fob.
2. I hooked up the 12V siren dry contact to a 12V relay that I monitor on one of the three exposed GPIO pins for an alarm.
3. I soldered two leads to the status LED of the energiser and hooked them up via an optocoupler to one of the other GPIO pins.
The code and set-up are both very experimental and I struggled a lot with debouncing the status signal and getting the right toggle interval for the on/off switch, but the set-up has been working and stable for a year now. I want to fix it up properly in the next few months so it looks neater though.
If you want, I can do a proper write-up for you of what sins I committed.
(
@Zuluzebra may also be interested.)
I made a simple PCB with 6 isolated inputs and 4 isolated outputs, all controlled by an ESP32. It's designed to "supervise" a garage door motor, or gate motor, but should be perfect for an electric fence as well, so long as you keep it some distance away from the energiser, I guess. I've definitely not tested it in this role, and would expect a fair amount of interference. That said, if the Sonoff SV survives it, mine should too, I would think!
The idea is to have 4 isolated inputs for status (an LED, gate motor gearbox pulses, obstacle detection, etc), and 4 outputs for things like FRX (inductive loop trigger), toggle trigger (stop - open - stop - close), pedestrian access, and Lock. The last 2 isolated inputs are designed to be connected directly to the motor wiring, so you can see what the gate motor is doing. These have higher value current limiting resistors, for connection to up to 24V motors. It also has a DCDC converter, allowing it to be powered from up to 24V.
Here is a rendering of the latest version's PCB. I have 3 of the first batch (slightly different layout, much smaller resistors!) left if anyone is interested. Selling assembled and preflashed with a test ESPHome-based firmware for R300. After that, you can update OTA (or using an external USB-serial adapter via the pin header under the ESP32-WROVER module).
