0

Shelly Cloud Connetion Error

Francisco Oliveira 8 months ago in Devices / Http updated by Jürgen Jürgenson 7 months ago 3

Trying to connect to shelly cloud and can't understand what i'm making wrong.

with curl i'm using :

curl -X POST https://shelly-24-eu.Shelly.cloud/device/status -d "auth_key=XPTO&id=c45bbe6a3221"

and i got the json answer.

How can i program it in comfortclick?
Thanks

Hello All,

I'm programming the equivalent to this : curl -X POST https://shelly-24-eu.Shelly.cloud/device/status -d "auth_key=XPTO&id=c45bbe6a3221"

Image 4871

Image 4872

The result is:

Image 4873

If I run the curl it works.

Can anyone give me some light? Thanks

The only solution till now that i arranged was creating a relay to simplify the post. i've created a python to do the job and installed on a small server inside a container:

from flask import Flask, request, Response
import requests

app = Flask(__name__)

@app.route('//status', methods=['POST'])
def relay(id):
# Target URL to which the modified request will be sent
target_url = 'https://shelly-24-eu.shelly.cloud/device/status'

# Data to be sent to the target URL
data = {
'id': id,
'auth_key': 'XPTO'
}

# Sending the modified POST request to the target URL
response = requests.post(target_url, data=data, stream=True) # Using stream to handle transfer-encoding properly

# Prepare headers for forwarding, excluding certain headers that might cause issues
excluded_headers = ['content-length', 'content-encoding', 'transfer-encoding']
headers = [(name, value) for (name, value) in response.raw.headers.items()
if name.lower() not in excluded_headers]

# Stream the response back to the client without decoding
return Response(response.raw, response.status_code, headers)

if __name__ == '__main__':
app.run(debug=False, host='0.0.0.0')

------------------------------------------------------

different ideas would be great.

Hey,

From Shelly manual: Communication through HTTP and Websocket channels is secured by a digest authentication mechanism using the SHA256 hmac algorithm as defined in RFC7616.

When enabled, all communication is protected except:

  • Communication over MQTT
  • Communication over UART
  • Communication over Outbound Websocket
  • the RPC method Shelly.GetDeviceInfo
  • the HTTP endpoint /shelly


As of now the bOS http driver does not support digest auth. So we need to wait for its update. You could use MQTT/http locally.