Optimistic for a normal switch?

Unfortunately I run into a problem that I don’t know how to fix …

I have a number of custom switches and they all work fine. Except for one small thing … and that is that as soon as I change the switch state, the switch reverts back to the previous state as if nothing has changed because the sensor needs 1 second to update on its own.

Now I know that with an MQTT switch you have the option optimistic, this seems to be the solution if it was not for the fact that I do not use an MQTT switch … Therefore I have no alternative to set the switch directly to the new status …

Does anyone have a solution for this?
Thanks in advance

You’re going to have to give us more information than that.
What switches ?
How controlled ?
Does this also happen manually ?
What ‘does’ work for you ?
Post example code, if required

check “retain” configuration parameter

This actually sounds like your state topic is wrong. Are you sure it is correct?