I am using the following UI code
- type: state-icon
title: BlindSE
icon: mdi:arrow-down
entity: cover.salon_store_se
tap_action:
action: call-service
service: script.turn_on
service_data:
entity_id: script.set_blind
variables:
blind: "cover.salon_store_se"
pos: "{{ -25 }}"
tilt: "45"
basically passing on a cover entity name, position and tilt to this script which executes the positioning
set_blind:
alias: 'Set Blind'
mode: queued
sequence:
- service: cover.set_cover_position
data:
entity_id: "{{ blind }}"
position: "{{ state_attr(blind, 'current_position')|int + pos |int }}"
- service: cover.set_cover_tilt_position
data:
entity_id: "{{ blind }}"
tilt_position: "{{ tilt }}"
now I am trying to move the position template above from the script into the UI call.
So my question can the variable “pos” in the UI be a template? And if so why does this call return an error:
pos: "{{ state_attr('cover.salon_store_se', 'current_position') | int + 25 }}"
Set Blind: Error executing script. Invalid data for call_service at pos 1: expected int for dictionary value @ data[‘position’]