Reason:
The sensor read the last state on startup and polling / overwriting it sometimes.
Also the RestoreState class writes all state known states down on tear down / ha stop.
If you overwrite a state via the states dev tool or the API, it will not impact the actual device. If the device state is being polled, it will overwrite the state in the state machine the next polling.