Hello everyone. I have some motorized curtains. I want to know the position of them, however there isn’t an entity for them that has this info. There is a state attribute that will change with position (0=closed 100=open).
So at this point I am not sure how to get the position from this created sensor.
I want to create an automation that checks to see where the curtain is after a command is issued to change the position. That way if the curtain does not move or there is a problem, I can have HA issue the command again or notify me that there was a problem.
Thank you both for the assistance. Looks like this is working as expected. Now I need to learn how to make an automation to check after the command to raise or lower the curtain happens so that if there is a problem it will let me know.
One thing that I am noticing is that when the curtain is moving it will report either 0% or 100% (down 0%, and 100% up). Wondering if there is a way to either not report any change (just hold the previous value) or not report anything (null). Thank you once again.
Better for sure in that it displays the value when stopping, but still shows 0% when moving down and 100% when moving up. I am understanding the If then statement part but not the else part. Maybe the this.state when moving down is 0%?
Note that the unit (%) is now part of the state making the state a string that you can not use in a line graph or calculations in other templates. You can remove it altogether with:
state: >
{% if states('cover.curtaininside2') in ['open', 'closed'] %}
{{ state_attr('cover.curtaininside2', 'current_position')|float(0) }}
{% else %}
moving
{% endif %}