I’m clearly not understanding this…
I’ve read the “passing variables to scripts” documentation, spent hours trying different possibilities and searching here for the answer.
(I’m very new to scripts and fields!)
So how do I pass an entity id to a script?
(The error I get is : Template rendered invalid entity IDs: {‘entity_id’: ‘input_number.hh_test_number’} )
alias: yet another script test
sequence:
- action: input_number.set_value
metadata: {}
data:
value: 6
target:
entity_id: "{{ my_entity_id }}"
description: ""
fields:
my_entity_id:
selector:
target: {}
name: my entity id
default:
entity_id: input_number.hh_test_number
A target object is not an entity ID. Use an entity selector. FWIW, it’s usually a good idea to include filters to make the selector more specific and easier to use.
alias: yet another script test
sequence:
- action: input_number.set_value
metadata: {}
data:
value: 6
target:
entity_id: "{{ my_entity_id }}"
description: ""
fields:
my_entity_id:
selector:
entity:
filter:
- domain: input_number
name: my entity id
default: input_number.hh_test_number
Thanks for that.
I had already tried using the Entity selector, but couldn’t make it work.
However I’ve now established (I think) what the problem is, and it’s connected with the default setting.
If I edit the script with this window:
When I change the default value and save the script and then try to run it I get this error:
Error: Template rendered invalid entity IDs:
When I collapse that window it works!
Weird.
But now I can start making some progress with my (very complicated) heating control automation.
Thanks again.