Help with shell_command, Alexa & variables

Hi. I’m trying to set a temperature on my thermostat via Alexa skill.
I’m using a shell_command, that should recieve a variable from that skill.
No problem with the skill: it works and correctly call the intent (HoldTermostatIntent).

These are sample utterances:
HoldTermostatIntent to warm for {text} minutes
HoldTermostatIntent to heat for {text} minutes

shell_command:
termostato_hold: ‘perl /home/pi/heatmiser-wifi-read-only/bin/heatmiser_hold_on.pl -h 192.168.0.8 -p 0000 21 {{ duration }}’

alexa:
  intents:
    WhereAreWeIntent:
      speech:
        type: plaintext
        text: >
          {%- if is_state('device_tracker.honorluca', 'home') and
                 is_state('device_tracker.huaweimamma', 'home') -%}
            Everyone is at home!
          {%- else -%}
            Luke is at {{ states("device_tracker.honorluca") }}
            and Mom is at {{ states("device_tracker.huaweimamma") }}
          {% endif %}

HoldTermostatIntent:
  action:
    service: shell_command.termostato_hold
    data_template:
      duration: "{{ text }}"
  speech:
    type: plaintext
    text: >
      ok {{ text }} minutes

it reach “speech” part and answers correctly but he doesnt trigger service: shell_command.termostato_hold.
Why??? I’m getting crazy.

Help me :smiley:

p.s. same shell_command like:

shell_command:
  termostato_on: 'perl /home/pi/heatmiser-wifi-read-only/bin/heatmiser_on.pl -h 192.168.0.8 -p 0000 {{ states.input_slider.ac_temperature.state | int }}'

works without problem.

What’s the ownership on the shell command? Remember that it’s going to execute as the HomeAssistant user (hass or homeasistant depending on your install) when HA runs it, so it has to have permissions to it as well as to the location of the script.

And if a command or script requires sudo, then the HA user will have to be added to the sudoers list.