Snapshot does not restore the state of Tuya curtains


I recently tapped into home assistant and so far I’m happy with its possibilities.

I have a Tuya curtain rail and a Tuya door sensor (to the back garden). What I am trying to achieve is to open the curtains when the door opens (only if the curtains are closed) and restore its state after the door closes. In addition, check based on time if the curtains should close or not.

So far I created two automations, one for opening and one for closing based on time and sunrise/sunset.

Based on this video:, I created a “scene on steroids” for the door sensor.
Unfortunately I can not seem to restore the state of the curtains, even though the automation is succesful. The only snapshots I can create are the following:

It simply doesn’t restore the percentage of the curtains before the change when I call the activate scene.

What I also thought of is to read out the state (not sure how yet), save it to a helper number and then use that to set the curtain position, however it doesn’t seem to like injecting the helper number in the position field.

I did come across this post on how to use the helper, but I couldn’t figure out how to do the template part.

Any idea how I can properly save and restore the state?

On a sidenote, the curtains have a remote. I use it to manually override it. In the smart home/tuya app I can see that the state updates nicely. Home assistant however did not get this updated value, as this morning my automation (of opening the curtains) failed, as it thought that the curtains were open.