[SOLVED] New problem with Curl in the ARM version?

I have been running HomeAssistant on a Raspberry Pi for more than 2 years and I have timed a relay that acts at sunrise and sunset with two lines using Curl.
The lines are:
To turn on:
“/ usr / bin / curl -X GET http://blynk-cloud.com/token/update/v21?value=1
To turn off:
“/ usr / bin / curl -X GET http://blynk-cloud.com/token/update/v21?value=0

I have the problem from a 2 days ago, that Curl, now answers “invalid token”
In raspberry Pi and Orange Pi, if I run the line it always gives invalid token, but on a Windows 10 computer from Bash I run the line "curl -X GET http://blynk-cloud.com/token/update/v21?value = 1 "and it works perfectly.

The Curl version is the same, and I don’t understand why it gives me this error.

1 Like

do you put the token into the URL using variable or is it hardcoded?
if #1, then make sure the variable is really set and if you enclosed the url in quotes, make sure they’re proper doublequotes:

export token=abcdefghijkl
export value=foo
curl "http://blynk-cloud.com/${token}/update/v21?${value}"

also, running curl with -v might shed some light on what’s really sent in the HTTP request

1 Like

Thank you very much pecival, your help with curl -v has been the solution.
I run the code from Windows 10 Bash and it answers:

curl http://blynk-cloud.com/token/update/v21?value=1 -v

  • Trying 139.59.206.133…
  • TCP_NODELAY set
  • Connected to blynk-cloud.com (139.59.206.133) port 80 (#0)

GET /token/update/v21?value=1 HTTP/1.1
Host: blynk-cloud.com
User-Agent: curl/7.58.0
Accept: /

< HTTP/1.1 200 OK
< connection: keep-alive
< access-control-allow-origin: *
< content-length: 0
<

IT WORKS WELL.
I run the code from Raspberry PI (HomeAssistant) and it answers:

pi@raspberrypi:~ $ curl http://blynk-cloud.com/token/update/v21?value=1 -v

  • Trying 45.55.96.146…
  • TCP_NODELAY set
  • Connected to blynk-cloud.com (45.55.96.146) port 80 (#0)

GET /token/update/v21?value=1 HTTP/1.1
Host: blynk-cloud.com
User-Agent: curl/7.52.1
Accept: /

< HTTP/1.1 400 Bad Request
< connection: keep-alive
< content-type: text/plain;charset=utf-8
< access-control-allow-origin: *
< content-length: 14
<

  • Curl_http_done: called premature == 0
  • Connection #0 to host blynk-cloud.com left intact
    Invalid token.pi@raspberrypi:~ $

IT DOES NOT WORK.

FIXED:
My pc queries Google DNS 8.8.8.8
My Raspberry Pi consults the DNS to my Router that is configured to Google 8.8.8.8, but for some mysterious reason, it does not solve the same and gives me another IP for Blynk.
With sudo nano /etc/resolv.conf, removing my router from the configuration and setting: nameserver 8.8.8.8 is solved and the two go to the same ip and I have no errors executing the code.