Hello Everyone,
I have been struggling with a cURL command that I use to issue from a switch to enable/disable PUSH notifications in a Reolink NVR. It has been working with no issues since I started to use it more than a year ago. However, last week, I realized that the command was not working. I have been doing some tests and I am not able to move forward from the point I am at.
This is the command that used to work. It is included in secrets.yaml and called from a command_line platform coded in switches.yaml. This command passes HA validation, but it no longer works. Do note the two '
characters before and after the brackets after the -d
option.
curl -H "Content-Type: application/json" -X POST -d ''[{"cmd":"SetPushV20","param":{"Push":{"enable":1}}}]'' "https://[NVR_IP]/api.cgi?cmd=SetPushV20&user=admin&password=[PASSWORD]" --insecure
Since last week, the response is the following:
curl: (3) bad range in URL position 2:
[param:{Push:{enable:1}}]
^
Today, I just noticed that issuing the command as below works (with a single '
character before and after the brackets mentioned above):
curl -H "Content-Type: application/json" -X POST -d '[{"cmd":"SetPushV20","param":{"Push":{"enable":1}}}]' "https://[NVR_IP]/api.cgi?cmd=SetPushV20&user=admin&password=[PASSWORD]" --insecure
Command response (the expected and right one):
[
{
"cmd" : "SetPushV20",
"code" : 0,
"value" : {
"rspCode" : 200
}
}
]
However, such valid command does not pass HA validation despite it works. This is validation response:
Error loading /config/configuration.yaml: while parsing a block mapping
in "/config/secrets.yaml", line 6, column 1
expected <block end>, but found '['
in "/config/secrets.yaml", line 39, column 79
This is how one of the commands is inserted in secrets.yaml. The one above is the one that works but does not pass validation:
Reolink_PushCommand_On: 'curl -H "Content-Type: application/json" -X POST -d '[{"cmd":"SetPushV20","param":{"Push":{"enable":1}}}]' "https://[NVR_IP]/api.cgi?cmd=SetPushV20&user=admin&password=[PASSWORD]" --insecure'
Any idea of why this is happening? Is there anything I can do to fix this?
Thanks in advanced.
SĂ©sar