Twoway smart switch esp32s and MQTT


Hi all,

I am new to open hab and started my first project.

I am trying make twoway switch in openhab

I have ESP32 connected with relay which is subscribed to MQTT toppic (AM_LivingLight1_Channel)

i have created thing that is linked to an item AM_LivingLight1 which is a switch

when i turn on light from openhab UI it published “ON” on (AM_LivingLight1_Channel)
which is then received by ESP and turns on relay.

Its working fine, but i am having issue with by second switch which is a push button switch directly attached with ESP32s when i press it, it turns on/off light but the current status of light is not reflecting on my Openhab UI

since i turned light off using pushbutton it doesnot reflect on Openhab UI,
I tried publishing ON/OFF message from ESP to (AM_LivingLight1_Channel)
but no luck, please assist