Hi everyone,
I try to set-up a script that can be called from multiple automations with changing variable.
In my case I have multiple automations to set my shutters to a specific position an would like to set them with only one script.
So one of my automations looks like this:
alias: "Close at sunset"
description: ""
trigger:
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
below: -7
condition: []
action:
- service: script.shutters_down
data:
position_var: 50
mode: single
And the script has:
alias: "Close Shutters"
sequence:
- device_id: 3f19442a537d7684d75abfe15a93c437
domain: cover
entity_id: 01fb8df83d85318698294eacaed0f8c3
type: set_position
position: {{ position_var | float }}
Saving the script fails with:
Message malformed: value must be one of [‘close’, ‘close_tilt’, ‘open’, ‘open_tilt’, ‘stop’] for dictionary value @ data[‘type’]
Running it via an Input Number also did not help:
position: {{states('input_number.shutter_position') | float }}
If I set a number to position, it works fine:
position: 30
But the idea is of course to make the script a generic one so I can use it from multiple automations.
Same error.
What am I not seeing here?
Thanks for any hint or help.