feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

Authenticated http Request to Shelly 1 Plus

Open Sniptzler opened this issue 4 months ago • 5 comments

Describe the problem you have/What new integration you would like

I want to directly communicate with a Shelly Plus 1 via an http request with authentication enabled. For that to work i need a way to authenticate via digest wich is currently not supported by the http_request component.

Please describe your use case for this integration and alternatives you've tried:

I thought about constructing the authentication message myself but couldn't find a way to encode in sha256. A way of doing that would resolve my issue. Is there a way i have overlooked?

Additional context

The authentication process is described here.

Sniptzler avatar Mar 18 '24 15:03 Sniptzler

Try like this: https://esphome.io/cookbook/http_request_sensor#id2 Not guaranteed to work though, as the Shelly has its own webserver implementation, but who knows...

nagyrobi avatar Mar 18 '24 16:03 nagyrobi

I have seen this but to my understanding this always sends the same authorization header in the http request which works in the case of the esphome webserver but not normaly because shelly includes the

nonce: number, random or pseudo-random number to prevent replay attacks, taken from the error message. Required

To my understanding this results in an always changing hash value. But this is only my limited understanding. Correct me if I'm wrong.

Sniptzler avatar Mar 18 '24 16:03 Sniptzler

You're understanding correctly.

nagyrobi avatar Mar 18 '24 17:03 nagyrobi

Do you think it is possible to get the SHA256 algorythm to work in esphome on the esp8266? Mybe there are even other use cases for this?

Sniptzler avatar Mar 18 '24 17:03 Sniptzler

https://wokwi.com/projects/328395940175020627

nagyrobi avatar Mar 18 '24 17:03 nagyrobi