Know the state based on the history

Some lights of mine are controlled by RF. Since these those can’t communicate the state. Wouldn’t it possible to know the state by the history which is known in Home Assistant. This way it knows the state and could show the right switch in the interface.
Looking forward for some feedback.