@kotov_syndrome What I would recommend is that you save the curl command in a file in /config for example with the extension .sh… You have to change the protection (via a terminal) of that file to 700 (to be executable):
So the file will be:
name: reset1.sh
content of the file:
#!/bin/bash
#
#
curl -d '{"state": "off"}' http://HAHOST:8123/api/states/binary_sensor.main_lock_access_control_lock_jammed -H 'Authorization: Bearer TOKENHERE'
Then from a terminal you can test the execution of the file by typing:
/config/reset1.sh
When you are satified by this shell script you can create your command in the configuration.yaml file (mention that you have the results of the execution in a log file…)
shell_command:
reset1: /bin/bash /config/reset1.sh >&/config/reset.log 2>&1
Just a reminder that your shell script should not exceed the limit of 60 seconds elapsed (this one will surely not), these 60 seconds are a contraint within home assistant… If you want to work around that , you have to create an “ini” shell script which is just spawning the script exceeding the 60 seconds… So in your case (you name it the way you want … ini is just a convention I took):
You create an ini shell script called for instance reset1_ini.sh (don’t forget the file protection to 700 to be executable):
#!/bin/bash
#
#
bash /config/reset1.sh &>> /config/reset1.log &
and the shell command is becoming (no need for a logfile in this case as the ini shell script is just spawning the script you want). Just an additional remark, in this case you can pass arguments to the shell script from home assistant (it is not the case when you redirect the output to have a logfile !, it seems that arguments and redirection “>” are not compatible:
shell_command:
reset1: /bin/bash /config/reset1_ini.sh
If you want to pass arguments to the shell script, the shell command is becoming:
shell_command:
reset1: /bin/bash /config/reset1_ini.sh "{{ arguments }}"
When you use the shell_command, it is becoming:
- service: shell_command.reset1
data_template:
arguments: your_arguments
That’s it… Feel free to ask questions…