Hello,
I have a problem with the control of my blinds. I want to control the slats depending on the sun elevation. For this I have created a template sensor in configuration.yaml:
sensor:
- platform: template
sensors:
reversierung:
friendly_name: "Jalousie Reversierung"
value_template: >
{% if (state_attr('sun.sun', 'elevation')*50/35)|int>50 %}
50
{% elif (state_attr('sun.sun', 'elevation')*50/35)|int<0 %}
0
{% else %}
{{ (state_attr('sun.sun', 'elevation')*50/35)|int }}
{% endif %}
I want to use the value in an Automation like this:
domain: cover
entity_id: cover.rs_essen_2
type: set_position
position: "{{sensor.reversierung}}"
When I want to specify the value of the sensor as cover position in an automation I get an error message. I think something like “wrong data type”. Is there a better way to achieve what I want? Where is my error?
Thanks in advance!