Hi there,
I’m trying to close a cover and depending on the temperatur it should behave differently:
Temp >= 24° → cover should go to position 60
Temp < 24° → cover should go to position 0
Here’s my code in the automation:
- id: 'xx'
alias: xx
description: ''
trigger:
- event: sunset
offset: +00:20:00
platform: sun
- at: '19:00'
platform: time
condition:
- after: sunset
after_offset: +00:20:00
condition: sun
- after: '19:00'
condition: time
action:
- data:
position: '{% if states("sensor.temp_schlafen")|float >= 24|float %}60{%else%}0{%endif%}'
entity_id: cover.rollladen_schlafzimmer_links
service: cover.set_cover_position
I’m not totally sure about the “float”, but I always get this error:
Error executing script. Invalid data for call_service at pos 1: expected int for dictionary value @ data[‘position’]
If I remove the whole IF ELSE and put position: ‘60’, it works flawlessly.
Can somebody please tell me what I have to change?
Thanks!