Template Switch state in frontend problem

Hello, all.
I encountered one problem with Template Switch. When switch state is changed, the connected sensor read after some time, so in the frontend i see some delay. When i toggle the switch slider, it come’s back immidiately, but after some time (when connected switch state is refreshed by HASS) slider come to right position. Is it possible to avoid this “jumping” from one state to another and back and show the exact switch position?