Wifi relay with physical switch 230v AC Mains

Hello,

Recently I came a cross a project: https://luani.de/projekte/esp8266-hvio/, since then it got me wondering are the off the shelf items like this available?

My needs are a MQTT wifi relay but it should also be possible to use a physical switch on 230v AC mains.

Kr,
Philippe

It really depends on what you mean by ‘off the shelf’

Take a look at the Sonoff range of products http://sonoff.itead.cc/en/

Whilst they don’t currently support MQTT there is a well supported alternative firmware that does Tasmota, details of which can be found here

@GadgetUK Sonoff doesn’t allow a physical 230v mains switch. If I would be able to attach that and get the state with MQTT that would be great.

For custom building something I don’t really have the knowledge, I was hoping some one had a solution and could by it from them.

Ok, are you trying to simply find out the state of a physical switch (230V) over MQTT ?
If so what sort of switch is it ?
Do you want to be able to control the 230v remotely (from Home Assistant) of simply just monitor the state of the switch ?

I want to do:

  • Control the Lights using MQTT/HA
  • Know the state of the switch using MQTT/HA
  • When the switch is flipped, depended on the state turn on/off the light

All have to be done over 230v AC Mains

Im not sure that something off the shelf exists for your needs but it’s fairly easy to build. What you’d need is a ESP8266 (a microcontroller with wifi capabilities), a temporary push button and a relay. The push button would be connected to an input pin of the 8266 and monitored by the microcontroller. When pushed, the state of the relay would change. The program should also monitor MQTT publications from HA to change the state accordingly to what is sent.
The relay would be connected to an output pin of the 8266 (,using a transistor would be safer).
At last, the 8266 should sent through MQTT the state of the relay TO HA.

Thanks for the reply, but the push button is not sufficient. I would need a 230v AC Mains switch.

I have build stuff for 5v and used relais, the 230v I don’t really know who to build it and make sure it’s durable.

this is probably the easiest wall switch, assuming you want it for the wall?
https://www.ebay.co.uk/itm/Sonoff-T1-1-2-3-Gang-WiFi-RF-Panel-Touch-Switch-Smart-Retome-Control-Light-UK-/273159334691?var=&clk_rvr_id=1512416174048&utm_medium=cpc&utm_source=twenga&utm_campaign=twenga&utm_param=eyJlcyI6MCwicyI6OTcyMDIzNywiY2kiOiIwM2I4ODkwNmQ0OWRjMTRiMGMyNzRmZmU3NTRkZmIzZCIsImkiOiIyNzMxNTkzMzQ2OTEiLCJ0cyI6MTUyNDgzODM2OCwidiI6Mywic28iOjE1MDAsImMiOjIwNzA1fQ%3D%3D&rmvSB=true

you would probably have to flash it for your mqtt needs or you could make your own version

Yes it’s the easiest and indeed it’s in a wall, I cannot change the wiring to 3.3V as not possible. Currently I have a 230V AC Main and I want to keep using that.

the sonoff devices run on 230v AC Mains

Indeed but the switch isn’t, I have to rewire the complete switch. I also have a motion detection outdoor how acts as switch there for it has to be able to handle 230v.

maybe you will have to draw a circuit diagram, I don’t really understand what it is you are looking for or how you want to integrate it into your HASS set up

Ouch… I had to stop watching. Why did he put the pull up resistor on ground? It’s not pulling anything up when the switch is in the off position.

So you want a 230v input to control the electronics that switches another 230v circuit? That is an odd requirement, most of us use a low voltage to switch a mains voltage. Maybe you need to rethink your design.

For example, change your outdoor sensor to wifi/zwave/zigbee.

@nickrout, Is there a wifi outdoor motion sensor? I haven’t found one yet…

with outdoor capable I mean minimal IP44.

Not specifically. I would probably knock one up with a sonoff, a pir sensor, a suitable case and some waterproofing.

I know this is an old thread, but Sonoff recently released a device capable of using an existing wall switch:

Your original question was more about using a switched 230v feed, rather than a switch, but I figured others coming to this thread may benefit also :slight_smile: