Xiaomi door/window sensor last opened time / Philips HUE motion sensor

hello thanks for the teaching and information, anything that I couldn´t make work was that everytime I restart Home assistant it show as last time changed? can I fix this to only show the time that the sensor was really triggered?