restore ( Optional , boolean): Whether to store the intermediate result on the device so that the value can be restored upon power cycle or reboot. Warning: this option can wear out your flash. Defaults to false .
As to your second question, it is stored every time the state changes. This can be an issue for the esp8266 as it uses the limited flash available in the RTC and this can wear out fast. Not an issue for the ESP32.
I’m having this same issue with the HA integration not equaling ESPhome. I’m running it on a wemos D1 mini. It sounds like maybe I should upgrade to an ESP32 and just use the restore function?