Sometimes I’d like to detect the presence or absence of mains voltages (240v AC here). Examples include knowing when my traditional hot-water system is opening or closing a heating valve, or when my outdoor motion sensor is switching on or off the outside light. (It’s a mains-powered unit giving a switched live output.)
I understand the underlying electronics and could build a board myself, but that’s probably too much effort, especially considering the safety requirements.
Anyone know of an easy reasonably-prepackaged solution that could become a binary sensor in HA? I’m guessing a Sonoff Pow would work, but it might be overkill - I don’t need to switch the current or measure anything other than presence or absence of a signal.
I have some outdoor motion triggered lights, and I have connected them to a Sonoff Pow. When the power is above a threshold value, I assume the light must be turned on.
I use a Quibino Relay module and connect the voltage to be sensed to the I2 switch input, this shows up as a binary sensor in HA
I suppose any Zwave relay with mains rated switch inputs would work, there are some that don’t have mains rated inputs (Everspring) thats why i chose the Qubino
Just use a power supply which is looked in before the device doing the switching. IE: before the thermostat or motion sensor. You can buy very cheap 240vac to 5vdc power supply modules from AliExpress. I have a few on their way now, only about AUD$1 each from memory
I like the look of that optocoupler - it could work nicely in situations where I’m already using a Sonoff switch (which could provide the Vcc) and want to connect one of its GPIO inputs to an existing 220v source. That would work well for my outdoor-light-with-motion-sensor example.
I will be using a micro usb cable splitter to power a 5v relay and a power passthrough power bank which in turn powers the raspberry pi where hass runs. The powerbank acts as a ups for the pi. The relay is connected to hass as a pir sensor through a suitable pin.
The relay and splitter y cable costs 1.5$ total from aliexpress.
I wanted to do exact thing to detect when my hot water boiler is running. my hot water system is not that old, It is air to water heating system, but doesn’t have any smart IoT.
I googled around the internet to find a solution, I found your topic. I was about to hack into the honeywell motorized valve to connect it to optocoupler circuit, Then i realised that it will be risky and may avoid my warranty for the system.
Then it came to my mind the idea of using Non-contact voltage detector(NCVD), I never have one before, so I built one to test on a white board, it really can detect AC on live wire.
So what I did, I bought a very cheap non-contact voltage detector, I was lucky that it is without any power button or any sensitivity, you just need to add battery to it. I took off the LED/buzzer from the board, then I connected a resistor and optocoupler instead. Then I connected the output terminal of the optocoupler to Aqara Zigbee contact sensor as described in the following link:
My sensor was ready to be tested, I just need to extend the antenna of the NCVD to be touching the wire that feeds the Honeywell motorized Valve. Whenever my boiler started to heat the water, it will send AC into the wire, NCVD will detect the voltage, then optocoupler output will be almost short circuit to close the Aqara Contact sensor.
For my simpler, original question, though, these days I would probably just use a Shelly device. Actually, the Shelly i3 looks perfect: i could use one input to monitor my heating valve and another my hot water valve, and still have one left over!