# Telldus API - async

**URL:** https://discourse.nodered.org/t/telldus-api-async/19037
**Category:** General
**Created:** [11 December 2019 18:36 UTC](https://discourse.nodered.org/t/telldus-api-async/19037 "2019-12-11T18:36:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ncedia](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ncedia/32/14544_2.png) [@Ncedia](https://discourse.nodered.org/u/Ncedia)
#### Post date: [11 December 2019 18:36 UTC](https://discourse.nodered.org/t/telldus-api-async/19037/1 "2019-12-11T18:36:40Z")

</div>

Hi!

I'm using [https://github.com/mifi/telldus-api](https://github.com/mifi/telldus-api) to control my Nexa/Telldus units with Node Red.  
Now I would like to read sensor data with the same library but are struggling with getting the data from a async function in the function node and return it in the payload.

The code below (placed in a function node), will only return a "[object Promise]" in the payload.

const { LiveApi } = global.get('telldusModule');

const api = new LiveApi({  
key: 'xxx', // publicKey  
secret: 'xxx', // privateKey  
tokenKey: 'xxx', // token  
tokenSecret: 'xxx', // tokenSecret  
});

var data = api.getSensorInfo(12345678);

msg.payload = data;

return msg;

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [11 December 2019 19:12 UTC](https://discourse.nodered.org/t/telldus-api-async/19037/2 "2019-12-11T19:12:52Z")

</div>

The call is asynchronous and returns a promise so you need to await for that to complete before you return the answer... see their readme page for an example.

> **[telldus-api](https://www.npmjs.com/package/telldus-api)**
>
> Node API for Telldus Live and Telldus Local devices
