-
I would like to get the temperature from a Sensibo smart air conditioning device, but cannot seem to work out the structure of the json parse statement. I have used the following in the On Success section:
The json data is: Output is "Indoor Temp: undefined C" What have I done wrong? " |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Change the first line to the following: const temperature = JSON.parse(response.body).result[0].temperature; "result" is an array with one element, so you need to select the 0-th element from it before you try to access const result = JSON.parse(response.body).result[0];
const temperature = result.temperature;
const humidity = result.humidity; Also, you probably don't need the second line of your code (where you call |
Beta Was this translation helpful? Give feedback.
Change the first line to the following:
"result" is an array with one element, so you need to select the 0-th element from it before you try to access
temperature
.The same should work for accessing the humidity:
Also, you probably don't need the second line of your code (where you call
setVariable
), unless you actual have a global variable called "temperature" set up in the app which you are using somewhere else in the same shortcut (e.g. in a header) or in some other place. If you only need the …