HA to control SONOFF Matter device

I’m looking to use Home Assistant (HA) to control my exterior lights, which are connected to SONOFF MiniR4M WiFi smart switches. The “ON” trigger signal would come from a HikVision NVR alarm output, and I’d like the lights to stay on for around 5 minutes, for example.

Would a Raspberry Pi 4 be suitable for this setup? Since the SONOFF MiniR4M uses WiFi instead of Zigbee, I’m wondering if a coordinator like the SONOFF ZBDongle-P or ZBDongle-E would be necessary. Any insights would be appreciated!

Hello, welcome to HA forums !

I’m not sure to understand your current topology and what you want to achieve, would this diagram be exact ?

What model is your NVR ? What output does it have ? Is it compatible onvif ?

Some NVR can be added natively to HA and use their alarm output very easly… and others need to have a sort of wifi relay to have the I/O compatible to HA…

I’m not sure you can control a MiniR4m over HA without having a border router ? (anyone have tried that on the forum ?)

IF you need a thread network to add any devices then go for the ZBDongle-E as it’s the newest version (dongle-P works too but is less powerfull).

I will try a test to add a sonoff minir4m to HA without a border router next week.

Raspberry PI 4 is great for hosting HA.
You can use the GPIO to wire any external components, please take a look at this : HA - GPIO

Hello Pierre,

Thank you for such a detailed welcome! I’ve created a small diagram of what I’d like to achieve.

Since the MINIR4M is a WiFi device, it seems that a Thread network may not be necessary, but if you could try it out, that would be great. I also read through the Matter integration guide Matter (BETA) - Home Assistant

The Matter protocol relies on (local) IPv6 and mDNS (multicast traffic) which should be able to travel freely in your network. Matter devices that use Wi-Fi (including Thread border routers) must be on the same LAN/VLAN as Home Assistant. Matter devices that only use Thread must be joined to Thread networks for which there is at least one border router connected to the Home Assistant LAN.

In the meantime, I’ll order a Raspberry Pi 4 Model B (4GB), it will be connected to the router with a LAN cable, therefore no wifi hardware is required. The OS to use is Home Assistant OS?

The NVR model is Hikvision DS-7608NI-M2/8P. I was planning to use its alarm output module; 1A & 1B are just plain old switches with N.O. contacts.

For the IPV6 and V/Lan it’s ok in your case as you are not going to have multiples networks (unsless you want to acess your cameras though HA)

OS to use yes it’s home assistant, there is a walkthough of how to install it, it’s very easy Install - guide

You can also install HA on a windows platform as a docker service or in a VirtualMachine, this will allows you to run some tests if you want to be sure.

I see your model use ONVIF so it’s highly possible you can use this given integration for your NVR : Hikvision - integration

You can on some devices such as Reolink NVR’s map an alarm for a specific camera and then write a basic rule to turn ON a light for a given time…

I don’t own this kind of NVR so you will have to test this.

Still, it’s possible to map only your alarm output to the GPIO of the RPi4 and then execute your scenario…

What is also possible, is to have thread sensors such as Eve - Motion detectors : Eve - Motion over Thread (so longer distance) and start a recording or turn on a light for a given camera… (you would need a Thread network tho, but it cost the antenna so it’s relatively cheap)

Pierre.

That’s great news! Yes, the NVR does support ONVIF, and I also found this thread explaining how to configure it in Home Assistant: Can't load HikVision Binary Sensor - #22 by Knol010

This means I won’t need any additional cabling beyond the LAN connection—perfect! I’ll go ahead and purchase the hardware and update here once I’ve got everything set up.