Need Help! ESP8266 4 channel relay and 4 switches

Hi,

Need help with code to work on an ESP8266 to control 4 relays that can be taugled by 4 switches.
I have used MQTT to switch 4 relays connected to ESP8266.
Need help to taugle the relay state with 4 switches connected to 4 GPIO ports of the ESP.

I have worked on ESP and WeMo emulator to connect with Alexa in my previous project.
I used a IF loop her to taugle it on the ESP.
Regards,
Abhay

Hi

I have used ESPEasy (letscontrolit.com) flash firmware to do what you are trying to achieve.

I purchased NodeMCUs for my switch ESP and then got some of these for the Relay ESPs Link Sprite LinkNode R4 / R8

Ive never had an issues with them, and it simplifies triggering 5/12v relays. They were available on Amazon UK, but Amazon pulled the plug on their store for some reason, however you can buy direct from them, expect longer delivery times.

Thank you.

Can you kindly share the code that you use, I am searching for the code.
I have the ESP8266 and the relays with me.

I also have push switches that I have connected to 4 GPIO pins.

I also found a similar project to trigger a single relay.

Can someone help to define 4 switches and 4 relays by modifying the code.
I am new to MQTT hence the ask.

I’m not controlling 4 relays.
I have a sonoff basic (1 relay) thats running ESPEasy.

A :+1: for ESPeasy

To control the relay via MQTT, send /{devicename}/gpio/12 with payload 0 or 1

There is a good guide by @xbmcnut here:

I can’t speak to ESPEasy, but another option is Tasmota’s firmware, which I really like. MQTT and a handy Web interface where you can control and even define the module type easily (it supports the 4 channel models)… even OTA updates that I’ve tested successfully twice now.

I think tasmota for simplicity and stability
Espeasy for flexibility and wide range of supported sensors etc

espeasy is a kind of half way house between stock firmware and rolling your own code in arduino ide.

Espeasy is the only firmware I found that can support rotary encoders natively with no code hacking

Thank you.