manzolo / PyTuyaGetDevicesLocalKey

Python utility to retrieve localkey from a list of tuya device
0 stars 0 forks source link

Invalid Sign with energy consumption request #1

Closed MaierJuerg closed 2 months ago

MaierJuerg commented 2 months ago

HI Manzolo
Thanks a lot for your example python code. I almost gave up finding my own solution for such a query.
I can run your example code and can successfully query the device info :-)
What I actually want to get is the electricity statictics-trend of my device and there my hourly values of my solar panels. So I tried to use your code and thought it would be sufficient to replace your example URL with my energy-query:

URL = f"/v1.0/iot-03/energy/electricity/devices/statistics-trend?statisticsType=hour&startTime=2024041506&endTime=2024041510&deviceId=bf6289b178d61e64c00000"

The RequestResponse however is the feared 'code': 1004
Any suggestion what might have gone wrong?
Or do I maybe try to query something that is not accessible and the response is a misleading path?
Regards, Juerg

MaierJuerg commented 2 months ago

Hi Andrea Received feedback from tuya support about the 1004 error. With signed requests the parameters need to be alphabetically ordered and not in the sequence the API description shows. With this change the error code has changed - I get now 'permission deny" :-( Regards, Juerg