Door rf sensor doesn't remember state after restart hassOS but state is unknow, is there a way to remember last state first? can you restart

See this topic, use strategy 2:

Works very well.