Shell_command in configuration file is not recognised by automation

Hi, I am starting with HA and already managed to integrate my solar invertor (AWorks), but now I am trying to build my first automation based upon shell_command and can’t get it to work. What am I doing wrong? It seems the shell_command is not recognised in the configuration.yaml file.
I run HA OS 12.2 , core 2024.4.3 on a Raspberry PI5
my complete configuration.yaml:


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes


automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sensor:
  - platform: saj
    name: AWorks
    host: 192.168.0.213
    type: wifi
    username: *my uid*
    password: *my pw*

shell_command:
  blynk_set_solar: 'curl https://lon1.blynk.cloud/external/api/update?token=*my blynk token* &V47=sensor.saj_aworks_current_power'

my complete automation.yaml:

- id: '1713372970113'
  alias: solar2blynk
  description: ''
  trigger:
  - platform: state
    entity_id:
    - sensor.saj_aworks_current_power
  condition: []
  action:
  - service: shell_command.blynk_set_solar
    data: {}
  mode: single

When I look at the automation in the UI I get this error message:

Any suggestions highly appreciated.

Try leaving out the ’ ’ round the actual shell command.
or don’t use shell_command but use command_line in config

command_line:
  - switch:
      name: blynk_set_solar
      command_on: 'curl https://lon1.blynk.cloud/external/api/update?token=*my blynk token* &V47=sensor.saj_aworks_current_power'

Thanks Spiro, I’ll try that. If the first suggestion doesn’t work, I’ll have to study the use of command_line first :wink:

Hi Spiro,
I finally got it working, quotes did not help unfortunately, but I found somewhere in this forum the suggestion that it might help if I add the path to the curl command.
Now I have : /usr/bin/curl … and that works!
Thx.

command_line:
  - switch:
      name: ok
      command_on: 'curl -k -s  "http://192.168.1.5/web/remotecontrol?command=352"'

Ah, interesting. This is how I used the curl command in command_line switch. I wonder why you had to give more of a path? Anyway , you got it working. :+1: