What exactly are you trying to do? It doesnât make sense to me. Seems like youâre using way too many input_numbers for a button. Also, if you want to pass a number OR a value from an entity, you have to adjust your template in your script to account for that.
testscript:
alias: testscript
sequence:
- service: cover.set_cover_position
data:
entity_id: cover.eg_ez_roll_esphome
position: >
{{ states(position_var) | int or position_var | int }}
- service: input_number.set_value
data:
entity_id: input_number.helfer_testnummer
value: >
{{ states(position_var) | int or position_var | int }}
mode: single
So the final goal of this is to have one script that can be called for all my blinds.
The frontend will have a template cover for lovelace. The lovelace cover buttons as well as my wall switches will start automations that will call the script. Also giving it the corrosponding âwindow openâ switch and a âdefault positionâ to the script, which then acts accordingly.
In my example, I was trying to debug where I loose the actual number and therefore I did the second sevice call, sending the number sent into the script to a input number displaying its outcome. Finally the âservice: input_number.set_valueâ will be gone.
@Burningstone: changing the code to your proposal results in the same error:
âFehler beim Aufrufen des Diensts script/testscript. expected int for dictionary value @ data[âpositionâ]â
Why is the script using âstates(âposition_varâ)â as if âposition_varâ is an entity? Is that a new thing or has it always been that way and I just missed it or is it not really an entity and they shouldnât be using it as such?
The variable was being transmitted as data to the script. Itâs not an entity as far as I know.
ok, taking your input into account, I need to feed the variable as int into the script. This means, that the cast float -> int must happen in the call of the script.
So if I use the templating development tools, this:
He hands over the entity_id as a variable to the script and not the state of the entity_id, thatâs why he needs states(position_var) to get the state of the entity_id passed to the script.
@CeeCee
You canât just use a template in lovelace like you tried, you need something like this.