Automation - execute curl command

I tried for several hours create automation for below scenarios:

1.In case ‘’ change to ‘home’
Execute CURL command (only one execute).
2.when ‘’ is other then ‘home’
execute CURL command (only one execute).

before the automation i want to make sure the curl working preperly from HA.

curl --digest -u admin:pass -g '[0].Covers[].EncodeBlend=false'' 

Tried to execute with shell_command - not working, i verified simple TOUCH command working,i tried also escape all special characters .
rest_command - same


set_on: 'curl --digest -u admin:pass -g '[0].Covers[].EncodeBlend=true'
set_off: 'curl --digest -u admin:pass -g '[0].Covers[].EncodeBlend=false'

I guess some1 did something similar - would be thankful if u can share .

It’s very likely you’ll need to specify the full path to curl:

/usr/bin/curl --digest

Thanks FredTheFrong ,
if my command_line.yaml
looks like:

  - platform: command_line
        command_on: '/usr/bin/curl --digest -u user/pass -g '[0].Covers[].EncodeBlend=true''
        command_off: '/usr/bin/curl --digest -u  user/pass  -g '[0].Covers[].EncodeBlend=false''

How do i execute it from automation ?
i started with :

 - alias: 'Set mask OFF salon IPC'
   initial_state: 'on'
     platform: state
     entity_id: 'device_tracker.avi' 
     to: 'not_home'
     **- service: <--- Not sure for this part**
     - service: notify.telegram
         message: 'Masking camera salon'

again, i need this to be executed once the status changed (‘home’ -->‘not_home’).
what is the proper way to make this automation?
dont really like the hard coded curl commands ,
cause it actually same command with either true/false.

Use the switch name as an object, and specify the turn_on action:

action: switch.lounge_ac_test.turn_on

Thanks FredTheFrog ,
I set the command_line.yaml as following

  - platform: command_line
        command_on: "/usr/bin/curl --digest -u user/pass -g '[0].Covers[].EncodeBlend=true'"
        command_off: "/usr/bin/curl --digest -u user/pass -g '[0].Covers[].EncodeBlend=false'"

This part pass validation ,
The problem is with automation.yaml:

 - alias: 'Set mask OFF salon IPC'
   initial_state: 'on'
     platform: state
     entity_id: '' 
     to: 'not_home'

I tried also:

 action: switch.salon_masking.turn_on

getting error:

Invalid config for [automation]: expected a dictionary @ data['action'][0]. Got None. (See /config/configuration.yaml, line 174). Please check the docs at

I apologize, I was running too many things together (thinking in another computer language at the time!)

  - entity_id: switch.salon_masking
    service: homeassistant.turn_on

Thanks @FredTheFrog

I set debug on :

  default: debug

Execute the command from developer tools
the command seems correct but nothing happened:

2019-09-03 09:17:00 INFO (SyncWorker_4) [homeassistant.components.command_line.switch] Running command: curl --digest -u admin:passs -g '[0].Covers[].EncodeBlend=false'
2019-09-03 09:17:00 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.140469103335440] Sending {'id': 22, 'type': 'result', 'success': True, 'result': None}

i also tried executing the curl command as:

also as /sbin/curl
as when running in terminal
[~] # which curl

When i execute the command in terminal it working properly ,
I’m running HA 0.97.2 on a docker( qnap NAS ),
I read somewhere(can’t find it now) that in some cases it may work if execute cur; commands as python command but not sure how implement/try that .