I’ve created a custom entity and it works well except that the state and attributes do not persist through a restart. I thought it was because I was setting the values via templating but even when I remove those it always resets the device entirely (and if I take out templating then I lose the tilt attribute).
How can I get the state of my curtains to persist through a restart?
curtains_side:
unique_id: "curtains_side"
device_class: curtain
friendly_name: "Side Curtains"
position_template: 100
tilt_template: 0
open_cover:
service: pyscript.curtain_control_open
data:
entity_id: cover.curtains_side
close_cover:
service: pyscript.curtain_control_close
data:
entity_id: cover.curtains_side
stop_cover:
service: cover.stop_cover
entity_id: cover.curtains_side
set_cover_position:
service: cover.set_cover_position
data:
position: "{{position}}"
set_cover_tilt_position:
service: cover.set_cover_tilt_position
data:
position: "{{tilt}}"