MINIR4M matter detach relay event trigger for automation

I have all light switches in my apartment with MINIR4Ms and my home automation is 100% Matter only. I have in multiple rooms smart lights and would like to use the physical light switch in combination with a MINIR4M in detach relay to use the change of state as an event to trigger automations. As is, there is only one attribute exposed which is the on-off state of the switch itself and I couldn’t find a way to achieve this.

The optimal solution I see is to have the switch expose an additional attribute in matter that is different from the on-off state that I could subscribe an automation to. Ideally, while keeping the fallback in case of connectivity loss / downtime of the controllers.

Thnx,

Ivan

1 Like

It supports physical switches wired to S1/S2 for control of the load light/other applications.

Yes, that is what I already have in place everywhere. What I want to do is make sure that the switch can still be used to turn off/ on the smart lights programatically without disconnecting them from power. Right now, when the physical switch is used the behaviour fits well with dumb-lamps. For smart lamps, it would make more sense to be able to use the detach relay mode and have e.g. an additional entity exposing the toggle event, but not change the state of the electrical power to the lamp.

Since I‘m still working on this topic and think that this would be an excellent feature to have with the MiniR4M in the matter version. There is already a community solution that applies to many Sonoff devices that takes the LAN controls / API and is when going through the public API, I can see events triggered on a virtual entity. What would be fantastic, is to have this feature natively with either another virtual entity exposed or changing the default behavior of the switch when in detach relay where power to the light is always on and the matter switch state represents the physical toggle position. Is something like this already on a roadmap and would you be willing to add it?

Do you mean turning it into a wireless switch with the relay always on?

Yes, but only if you put it in the detach relay state of course. Or just expose two entities like the Home Assistant custom component does using the eWeLink API. I would personally prefer the later.

To simplify, I would love to be able to turn on the detach relay, and wire my automation to control the smart light via the physical button vs turning off power to it.

Of course this make only sense for switches that are connected to smart lights and still needs the fallback feature, which is fortunately already implemented - for cases where connectivity goes down etc.

Hey

The feature is under the Swutch Mode settings on its device page. But for matter that’s not supported, as the standard itself has limitations.

I asked Sonoff already to build a new feature to the MINIR4M. They should have a Always On Relay function. Means that in any software when you turn on/off or with the physical switch it should just change the state to on/off but not cut the relay. With that you could build in any matter aware software like Home from Apple or Google or whatever an automation turn off the smart bulb when the MINIR4M is turned off. They told me they sent it to the engineering but this is already six month ago… I think they just want to sell their Gateway. But this is not what matter is about. Matter is a standard that you can use whatever home automation you like to use. So please Sonoff… build a alway on feature to the MINIR4M that I can control smart bulbs on every matter aware software like Home Kit

Hi Dani, yes fully agree and also having the feeling that this kind of feature is not popular with the manufacturers.

I actually have what you described working to some degree in Home Assistant now. However, with a big caveat. There is a HACS implementation for Sonoff devices where the „virtual toggle“ is exposed as a sensor, BUT, it only works in cloud mode and that has proven to be rather unreliable. The open source integration supports the ewelink LAN mode, but at least for me (and anyone who has tried so far in the community) it only works for the main on/off entity and the rest only works in cloud mode. I don‘t know where the Sonoff server is hosted exactly and their architecture, but I‘m getting quire varying degrees of latency, ranging up to a couple of seconds at worst. So if you combine this with the wireless nature of smart lights, I can have a delay of several seconds until lights turn on/off. At other times, it‘s close to instant.

I also don‘t agree that this is not possible to realize with Matter natively. There is a CSA Matter definition for a generic switch and devices that already support this type of functionality.

I think the easiest way to do this would be to create a virtual device and scenes to control it