Hi,
how can i pass numbers from an input number field to a script?
I want to control my roborock s50 and set a position for the goto command.
groups:
vacuum:
name: Vacuum a room
entities:
- input_number.robox
- input_number.roboy
- script.vacuum_goto
configuration:
input_number:
robox:
name: X-Position
initial: 25500
min: -25500
max: 51000
step: 100
mode: box
roboy:
name: Y-Position
initial: 25500
min: -25500
max: 51000
step: 100
mode: box
scripts:
vacuum_goto:
alias: "Goto Position XY"
sequence:
- service: vacuum.send_command
data_template:
entity_id: vacuum.robo
command: app_goto_target
params: ['{{ states.input_number.robox.state | int }}', '{{ states.input_number.roboy.state | int }}'] #{{ states.input_number.robox.state | int }}, {{ states.input_number.roboy.state | int }}
With single and double quotes nothing happens. Without them i get an error:
Error loading /home/homeassistant/.homeassistant/configuration.yaml: invalid key: "OrderedDict([('states.input_number.robox.state | int', None)])"
in "/home/homeassistant/.homeassistant/scripts.yaml", line 8, column 0
When i work with fixed numbers it works fine
vacuum_goto3:
alias: "Goto(3) Position 25500 25000 (nach links)"
sequence:
- service: vacuum.send_command
data: #_template: # Note the use of 'data_template:' below rather than the normal 'data:' if you weren't using an input variable
entity_id: vacuum.robo
command: app_goto_target
params: [25500, 25000]
Can anyone help me?