Http request tuya

Hello everyone,

I would like to retrieve a value in Tuya, I have this request :slight_smile:

curl  --request GET "https://openapi.tuyaeu.com/v2.0/cloud/thing/XXXXXX/shadow/properties" --header "sign_method: HMAC-SHA256" --header "client_id: m83ffyg8rnhtpaeehum8" --header "t: 1691407832536" --header "mode: cors" --header "Content-Type: application/json" --header "sign: A582031913926966F2F658329CDE32F16B78189BBCC" --header "access_token: 09a207c817ae722c325322" 

And this answer

{
  "result": {
    "properties": [
      {
        "code": "Temp",
        "custom_name": "",
        "dp_id": 101,
        "time": 1691400091874,
        "value": 18
      },
      {
        "code": "Moisure",
        "custom_name": "",
        "dp_id": 102,
        "time": 1691400091938,
        "value": 33
      },
      {
        "code": "Flow",
        "custom_name": "",
        "dp_id": 103,
        "time": 1691401804045,
        "value": 1
      },
      {
        "code": "Rain",
        "custom_name": "",
        "dp_id": 104,
        "time": 1691399102097,
        "value": false
      },
      {
        "code": "BatteryCapacity",
        "custom_name": "",
        "dp_id": 105,
        "time": 1691399126451,
        "value": "2"
      },
      {
        "code": "WorkStatus",


I would like to store the value of Moisure in a variable but I don't know how.

Could you help me ?

        "custom_name": "",
        "dp_id": 106,
        "time": 1691401776444,
        "value": "0"
      },
      {
        "code": "ManualTimer",
        "custom_name": "",
        "dp_id": 107,
        "time": 1691399126642,
        "value": 59
      },
      {
        "code": "ManualSwitch",
        "custom_name": "",
        "dp_id": 108,
        "time": 1691401776380,
        "value": true
      },
      {
        "code": "LeftTime",
        "custom_name": "",
        "dp_id": 109,
        "time": 1691399102097,
        "value": 0
      },
      {
        "code": "Timer1",
        "custom_name": "",
        "dp_id": 110,
        "time": 1691400899261,
        "value": "ABUeABT+AAAAAAA="
      },
      {
        "code": "Timer2",
        "custom_name": "",
        "dp_id": 111,
        "time": 1691400999016,
        "value": "AAAAAAAAAAAAAAA="
      },
      {
        "code": "Timer3",
        "custom_name": "",
        "dp_id": 112,
        "time": 1691400535291,
        "value": "AAAAAAAAAAAAAAA="
      },
      {
        "code": "TimerDelay",
        "custom_name": "",
        "dp_id": 113,
        "time": 1691399126820,
        "value": "0"
      },
      {
        "code": "TimeFormat",
        "custom_name": "",
        "dp_id": 114,
        "time": 1691399102097,
        "value": "12"
      },
      {
        "code": "AddMoisureSensor",
        "custom_name": "",
        "dp_id": 115,
        "time": 1691399440267,
        "value": true
      },
      {
        "code": "AddRainSensor",
        "custom_name": "",
        "dp_id": 116,
        "time": 1691399127058,
        "value": false
      },
      {
        "code": "MoisurePowerStatus",
        "custom_name": "",
        "dp_id": 117,
        "time": 1691399460122,
        "value": true
      },
      {
        "code": "RainPowerStatus",
        "custom_name": "",
        "dp_id": 118,
        "time": 1691399102097,
        "value": false
      },
      {
        "code": "TempFormat",
        "custom_name": "",
        "dp_id": 119,
        "time": 1691399102097,
        "value": "1"
      },
      {
        "code": "AlarmStatus",
        "custom_name": "",
        "dp_id": 120,
        "time": 1691399126707,
        "value": 0
      },
      {
        "code": "FlowCount",
        "custom_name": "",
        "dp_id": 121,
        "time": 1691406036584,
        "value": "AAAAAAAAAAAAAAAAAAAAAAAAAAA="
      },
      {
        "code": "TempCount",
        "custom_name": "",
        "dp_id": 122,
        "time": 1691406444107,
        "value": "Ehf/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"
      },
      {
        "code": "MoisureCount",
        "custom_name": "",
        "dp_id": 123,
        "time": 1691406444211,
        "value": "IQf/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"
      },
      {
        "code": "RainCount",
        "custom_name": "",
        "dp_id": 124,
        "time": 1691399102097
      },
      {
        "code": "Stopirrigation",
        "custom_name": "",
        "dp_id": 125,
        "time": 1691399126579,
        "value": false
      },
      {
        "code": "SYS_TIME",
        "custom_name": "",
        "dp_id": 126,
        "time": 1691399102097
      },
      {
        "code": "MCU_Version",
        "custom_name": "",
        "dp_id": 127,
        "time": 1691399519339,
        "value": "W433H101-098-054-000"
      },
      {
        "code": "next_time",
        "custom_name": "",
        "dp_id": 128,
        "time": 1691407764508,
        "value": "AAAAAAA="
      }
    ]
  },
  "success": true,
  "t": 1691407834333,
  "tid": "d2d810b8351511eebce64a9bf16c60a7"
}

I would like to store the value of Moisure in a variable but I don’t know how.

Could you help me ?

I tested this

let data;

fetch('https://openapi.tuyaeu.com/v2.0/cloud/thing/bf2e9d867ceacda506bu4r/shadow/properties?codes=Moisure', {
  headers: {
        'sign_method': 'HMAC-SHA256',
        'client_id': 'jyjyujryjryuj',
        't': '1691421950571',
        'mode': 'cors',
        'Content-Type': 'application/json',
        'sign': 'jujytujytujyu',
        'access_token': 'f700f011d1d8d5cef981f8f9ujyujuyjyu0bb4913a'
  }
})
    .then((response) => response.json())
    .then(_data => {
        data = _data;
    })
    .catch(error => {
        console.error(error);
    });

and i have this answer :slight_smile:

image

while in command prompt I have a response :slight_smile:

I bought six Danfoss Allys about a year ago. They have been constantly messing up. They make up values. You can’t trust them at all. Now I have bought a Tuya TRV06 to try by Homey 2023 pro. The thread above describes how to get the unit in, if I understand it correctly. This is very complex. Is there any kind soul who can write step by step instructions?

These can be found in Post 1 of the Tuya Cloud app topic. It’s quite a bit, but when you read and perform all steps to the letter, you should succeed.

The script(s) above can be replaced by using RAW Commands, as mentioned in the same post.

But maybe you can add the TRV’s as ‘thermostat’ device just give it a go.

If not, use the workarounds called tap-to-run scenes (to control devices) and/or the aforementioned workaround RAW Commands (to control devices, and to receive device data, like room temperature)

Thank you for answering. I will try to follow the steps.

1 Like

I feel like a loser in the competition of smart thinking. I had hoped for step-by-step instructions. I still haven’t managed to get permission from Tuya Cloud. I’m giving up. It is very disappointing. To get the flow going in the underfloor heating, I have to lower the TRVs when the boiler temperature increases. For that reason, I bought Homey Pro and six Danfoss Ally units. How can one sell things that don’t work at all? Now I have ordered Sonoff TRV and hope that it will work, but I have little hope.