Hi there
I’m trying to make my script for Xiaomi Vacuum a bit smarter after a map is regenerated and I’m trying to put corrdinates offset values using an input_number variable, so I didn’t have to map my whole floor to new coordinates, which are almost the same as the old ones, but just shifted with a fixed value.
Anyway - this is what I had so far and I’m trying to achieve a similar result but based on variables:
vacuum_living_room:
alias: Vacuum the living room
sequence:
- data:
command: app_zoned_clean
entity_id: vacuum.xiaomi
params:
- - 25200
- 24000
- 27500
- 26000
- 1
service: vacuum.send_command
And now I’m trying to perform a simple calculation on each coordinate. Basically add an offset value defined by input_number.
I’ve put the following to my scripts file:
vacuum_living_room:
alias: Vacuum the living room
sequence:
- data_template:
command: app_zoned_clean
entity_id: vacuum.xiaomi
params:
- - "{{ 25200+states('input_number.vac_off_x')| int }}"
- "{{ 24000+states('input_number.vac_off_y')| int }}"
- "{{ 27500+states('input_number.vac_off_x')| int }}"
- "{{ 26000+states('input_number.vac_off_y')| int }}"
- 1
service: vacuum.send_command
but the area passed in the service call must somehow be invalid as the vacuum starts and finishes immediately. And the Mi Home app does not draw any area on the map. Something is definitely wrong with the script then.
BTW. Is there any way to check what exactly is ‘calculated’ after the template is rendered?? In the logs I still see the template syntax instead of a rendered value.