I have several shades that I want to write scripts for custom toggle-like behavior. Is there a way to access the covers last toggle direction? I would prefer not to add so many helper bools and track this myself when the info is already there. Anyway to get this value from a HA script via templates, etc?
Why not just use the cover.toggle
or cover.toggle_tilt
action?
These shades open from the top and from the bottom, but aren’t very smart about when the top and bottom run into each other. They stop just fine, but fail to update state etc. and stopping isn’t usually what I want to happen. I have created cover templates to deal with this and otherwise get the behavior that I want by moving both when they would run into each other. This is working fairly well for automation and using the sliders in HA to move the shades around. Now I’m working on cases where we have physical buttons that used to toggle the shades, but since I just get open/stop/close as the result of a toggle, I can’t distinguish between the cases where I want to move both and where I only want to move one, so I instead plan to replace cover.toggle with a script that handles the collision the way I want and hence I want access to the last direction the shades were moved. I know I could also solve this by adding yet another template per motor with the behavior I want, but that would be much more verbose.
That is what you are going to have to do.