Switch last_changed not recorded/always resets at startup

I made a little python script a while ago.