How to make two way communication between relay board and sitemap button?

I am turning ON & OFF buttons in sitemap ,it immediately affects the relay to turn ON/OFF but when the relay is OFF physically its not sending any command to the raspberry pi and the switch button in sitemap still remain ON.How can I overcome this?

What communication do you use for the switch? MQTT, zwave?

Hello @praveen_kumar, we meet again…

What topic and payload does your nodeMCU publish on MQTT when it’s turned off?

And can you post your item configuration, please?

I havent used zwave or anything,I directly connected raspberry GPIO pins with relay pins

You won’t be able to.
The gpio binding specifies a gpio to be an output OR an input. You’ll have to find ather way to get feedback from your relay to another gpio pin and add that to your binding.

Then can I use nodemcu for that? and I have more than 40 appliances how can control them as raspberry have 40 pins only!

Yes you can. NodeMCU, MQTT.
As many NodeMCUs as your wifi switch can handle!

But,my electrical switches are normal switches those are not wifi based switches

And? Disconnect you eclectrical switch from the mains. Wire it to a nodemcu with a pull up resistor on an interrupt pin and you’re done. MAke sure you debounce the input.

Plenty of info on the arduino forum and on various ESP blogs.
OR you can use the wemos d1 nodemcu and flash tasmota on it.

1 Like

Contact is used for input pins, Switch - for output pins

If you switch by sitemap, does it show the right state?
How do set the relay to OFF physically?
Post your item and sitemap plase.