Ideas for detecting 230v on/off

Hey folks,

I have a hard wired underfloor heating system that I want to feed its on/off status into home assistant.

The thermostat has a switche live (230v) that triggers the boiler, pump and zone valve and I would like to detect that voltage being present.

And suggestions on hardware to do this?



An optocoupler connected to an esp8266.

Thanks @nickrout i have just been trawling eBay for that very thing. All my electronics gear(soldering iron etc) is in storage so having to use prebuilt modules and found a basic optocoupler module I could hook up to a gpio pin. Just need to figure out powering the esp module and hot glue it all into a box :slight_smile:

This is hard to answer without knowing more about the system.

It depends a lot on how it its controlled, for instance is there a contactor / relay or is controlled by a solid state relay? If it uses a relay is there an extra contact that you can use or add an auxiliary contact to?

Is power that opens the zone valve AC or DC? Can you add a small relay in parallel with the valve? This may be one of the better ways, you can put a relay with each zone and feed a esp8266 or esp32 and provide an output to ESPHome to track when each zone is heating.

Have you checked the wiring diagram for the controller to see if it has an auxiliary output built into it? Some do.

You can use a small contactor like 240 volt relay with din rail mount or 240 volt relay with din rail mount , I think the first relay can also be screw mounted.

Anyway there are a lot of options.

@carbuthn it’s a pretty simple system and all I have a is a switched live I can tap into at a couple of points. No real controller just a thermostat that takes mains voltage as power and feeds it back when calling for heat.

I think I have found a way of using an optocoupler module to take that mains voltage into a gpio. Fingers crossed it shouldn’t be too big a job

@sparkydave That’s the one I have found. Hopefully a bit easier that I first thought.

I know this thread is more than 2 years as of now. I am having similar requirement to detect whether A/C voltage is applied to a circuit to trigger further automation. Not just detecting the 230v is power supply is there or not. Can we use this one along with some current limiting resistors and provide this is as ADC input of esp8266 d1 mini or esp32 boards? The esp boards will be used for other automation as well within the circuit so it will not be just used for this purpose. Are there any issue with this approach?

IMHO 3.3v You can apply to any GPIO without any ballast resistor, as well no need to use ADC.
I will use any simple AC 240V relay which will be smaller and cheaper, probably.

Thanks for your reply. I was just worried about any spikes that may go higher than 240v which may increase the DC voltage more than 3.3v. I am yet check the output of those HIK devices, It may provide stable 3.3v. Regarding GPIO without any ADC, are you suggesting to use GPIO as Binary switch which will be taking the 3.3v as a trigger?

Why don’t use a proper coupling relay? I usually go for Eltako ER12 or ER61 series, they accept anything from 8V DC to 250V AC on the input side and I can safely trigger a GPIO on the other side. I’ve also used Finder SSR coupling relays for the same purpose.

Thanks for your suggestion. I am using Opto-Coupler based arrays to trigger automation. My requirement is to activate those relays based on the input voltage 230v supplied. I have another post with related to this requirement. A cloud based switch will trigger series of relays managed by esp32 in this setup. The GPIO has to be triggered based on 230v is presented to it or not.

my idea too…plenty relays that use 220 for coil: