I am trying to using Netwatch to call a script that will turn a Shelly relay off and then back on when internet connectivity is lost. This will power-cycle a cable modem.
The Shelly 1 uses an http-post with an ON or an OFF:
I don’t think you should set Content-Type to json in the request, as there is no content at all in the request, the command for Shelly is in the url - only the result of the command comes as a json payload in the 200.
But since it is plaintext http, sniffing should show you what the Shelly actually responds.
What I had in mind was to capture (sniff) the communication with Shelly when the request is sent from the browser and when it is sent from the Tik and use Wireshark to “find 10 differences” between the two cases. “Plaintext” means that the communication is not encrypted (you use http://, not https://); whether you use a username and password or not has no effect on whether the communication is encrypted or not, you can have encrypted communication without credentials and plaintext communication with credentials.
Post the exact CURL command you are using.
No error provided when it fails?
Under Windows, try running.
curl -v -u “user” http://192.168.0.144/..
it should prompt for your password and show more details.
Try also the -anyauth option: https://curl.se/docs/manpage.html#--anyauth
maybe it provides some more info.
Try with the -v (verbose) switch, possibly there will be more details.
Checking the capture of the browser, it mentions “algorithm=SHA-256,” the Shelly1 and 1plus, from what I read should be using basic auth, later devices do actually use a different method of authentication: https://shelly-api-docs.shelly.cloud/gen2/General/Authentication/
There have been issues with sha256 with curl on windows: https://github.com/curl/curl/issues/6302
connected to SSPI, cannot say if they are now solved or if there is a known workaround.
If your Shelly uses digest authentication with SHA256, even if it can be found how to use curl for it, (probably using --digest instead of–user) I doubt that there is a Mikrotik script for it, but cannot say.