Prevent switch misalignment

Hello everyone,
I have a question about the status of a switch.
Sometimes, due to mqtt - arduino Protocoll, I switch a button but the item linked doesn’t change his state.
Is it any solution to have a feedback if the command is really executed from the object in the real world and change the switch button accordingly anytime?

Thanks, muplex

Setting autoupdate=false on the Item should achieve that internally to Openhab.

But I think some/all(?) UIs do their own internal version of ‘autoupdate’. The trouble is, users expect instant response from the UI, If they poke a button and it doesn’t change or beep in less than half a second, they poke it again with possible unwanted effects.

I’m not sure how you could tackle that without separating the input (button) from the effect (a ‘light on’ icon). I’m pretty sure Classic UI at least can manage that part, but it still means the button state can get out of step with light state.

Sorry,
I didn’t follow what you mean.

My situation is like these:

Switch Neopixel_Int_Accendi "On/Off" <rgb> (Int_Luci) {mqtt=">[mosquitto:Int/L/RGB_1_in/IO:command:ON:1],>[mosquitto:Int/L/RGB_1_in/IO:command:OFF:0],<[mosquitto:Int/L/RGB_1_out:state:default]", autoupdate="false"}

It works very good.
In the arduino code I put the sub on the same topic also if I use a phisical button on the light and it works like a charm.
The problem comes out when I push the switch inside basic UI gui and the command is not correctly copyied from the ESP/Arduino light system.
So, cause of that, Sometimes I have end up with openhab switch = ON and the light OFF for example or the viceversa.

How can I prevent that kind of situation?

Sorry, have someone solved already that situation in some way?

Sounds like the MQTT is getting lost somewhere between UI and target ESP. I don’t know anything about MQTT, hopefully someone else can give pointers.

what you mean i can give pointers ? have you an example to show me ?

I don’t know anything about MQTT, I have no examples to show you.
Other people do use MQTT, and they may be able to offer help.