Hello,
I'm trying to build a script running on a Shelly pro 2, that uses power measurement from a remote Shelly EM.
This shelly EM has a password set to secure its accessibility
I try to use a "Shelly.call" function with digest authentication from the Shelly Pro 2, but fail to connect.
I understood that the digest authentication should be performed following those steps :
1 - A first call to Shelly EM, that recieve 401 error. The device response especially contains a specific value called 'nonce'.
2 - Shelly pro2 shall calculate a SHA-256 value based on Shelly EM username and password, and on the previously got 'nonce' value as well.
3 - The "Shelly.call" request shall be repeated, including this SHA-256 value in its header.
- My issue : That process means that Selly PRO 2 shall calculate SHA-256 in step 2, but I was not able to find this feature : Shelly scripts doesn't seem to hold such a function.... I've tried pure javascript SHA-256 scripts, but none of them works due to lack of some features in shelly script to run them.
- My Questions :
1 / Is there a way to easily calculate SHA-256 in shelly scripts ?
2 / If not possible, What is the suitable way to communicate between shelly devices using authentication ?
Thanks a lot to anybody who can help me,
Thomas