MQTT timing issue: Wrong user for "new state"

There’s ready made blueprints for this exact scenarios you can try if rolling your own is causing you issues.

In no particular order: