# Tigo Energy PV combined API to InfluxDB

**URL:** <https://discourse.nodered.org/t/tigo-energy-pv-combined-api-to-influxdb/46615>\
**Category:** General\
**Created:** [2 June 2021 18:59 UTC](https://discourse.nodered.org/t/tigo-energy-pv-combined-api-to-influxdb/46615 "2021-06-02T18:59:17Z")\
**Posts on this page:** 9\
**Page:** 3

<div class="post-metadata">

**Author:** ![benek984](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/benek984/32/42478_2.png) [@benek984](https://discourse.nodered.org/u/benek984)\
**Post date:** [11 June 2021 17:57 UTC](https://discourse.nodered.org/t/tigo-energy-pv-combined-api-to-influxdb/46615/42 "2021-06-11T17:57:04Z")

</div>

Hi @Colin , could you write me the function what would decode values from below respond:

```auto
{"_msgid":"6e52e585.d00a6c","timestamp":1623433951765,"statusCode":200,"headers":{"date":"Fri, 11 Jun 2021 17:52:32 GMT","server":"Apache","access-control-allow-origin":"*","access-control-allow-headers":"*","vary":"Accept","x-rate-limit-limit":"1000","x-rate-limit-remaining":"999","x-rate-limit-reset":"3","access-control-allow-credentials":"false","set-cookie":["_csrf=d4tZYLe-lb9jnWujx8DIuSIcAWxfm_QB; path=/; secure; httponly"],"x-frame-options":"sameorigin","content-length":"170","connection":"close","content-type":"application/json; charset=UTF-8","x-node-red-request-node":"7e6b7728"},"responseUrl":"https://api2.tigoenergy.com/api/v3/data/summary?system_id=52705","payload":"{\"summary\":{\"lifetime_energy_dc\":\"834644.65666667\",\"ytd_energy_dc\":\"834644.66\",\"daily_energy_dc\":\"14931.71\",\"last_power_dc\":458,\"updated_on\":\"2021-06-11T18:39:00+01:00\"}}","redirectList":[],"responseCookies":{"_csrf":{"path":"/","value":"d4tZYLe-lb9jnWujx8DIuSIcAWxfm_QB"}}}

```

from payload I am looking for:

lifetime\_energy\_dc  
ytd\_energy\_dc  
daily\_energy\_dc  
last\_power\_dc

I am injecting the timestamp so this can be use by InfluxDB to place it in time.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 June 2021 21:13 UTC](https://discourse.nodered.org/t/tigo-energy-pv-combined-api-to-influxdb/46615/43 "2021-06-11T21:13:36Z")

</div>

Sorry, I am away at the moment and unable to contribute.

---

<div class="post-metadata">

**Author:** ![benek984](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/benek984/32/42478_2.png) [@benek984](https://discourse.nodered.org/u/benek984)\
**Post date:** [12 June 2021 09:59 UTC](https://discourse.nodered.org/t/tigo-energy-pv-combined-api-to-influxdb/46615/44 "2021-06-12T09:59:47Z")

</div>

No rush @Colin. Whenever you have a moment.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 June 2021 10:24 UTC](https://discourse.nodered.org/t/tigo-energy-pv-combined-api-to-influxdb/46615/45 "2021-06-12T10:24:06Z")

</div>

Have you tried to work it out yourself?

---

<div class="post-metadata">

**Author:** ![benek984](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/benek984/32/42478_2.png) [@benek984](https://discourse.nodered.org/u/benek984)\
**Post date:** [12 June 2021 10:53 UTC](https://discourse.nodered.org/t/tigo-energy-pv-combined-api-to-influxdb/46615/46 "2021-06-12T10:53:09Z")

</div>

As I mentioned before I have no programming experiences at all. Some simple changes in the code are not the problem but this is a bit too complicated.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [12 June 2021 12:47 UTC](https://discourse.nodered.org/t/tigo-energy-pv-combined-api-to-influxdb/46615/47 "2021-06-12T12:47:28Z")

</div>

Send this thru a `json` node and look at the output

---

<div class="post-metadata">

**Author:** ![benek984](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/benek984/32/42478_2.png) [@benek984](https://discourse.nodered.org/u/benek984)\
**Post date:** [12 June 2021 21:22 UTC](https://discourse.nodered.org/t/tigo-energy-pv-combined-api-to-influxdb/46615/48 "2021-06-12T21:22:04Z")

</div>

I tried to send this to InfluxDB as json but getting error:

receiving in json:

```auto
{"_msgid":"aa87fcac.5b45","timestamp":1623532528259,"statusCode":200,"headers":{"date":"Sat, 12 Jun 2021 21:15:28 GMT","server":"Apache","access-control-allow-origin":"*","access-control-allow-headers":"*","vary":"Accept","x-rate-limit-limit":"1000","x-rate-limit-remaining":"999","x-rate-limit-reset":"3","access-control-allow-credentials":"false","set-cookie":["_csrf=JnmKc8FCTpdEKHGIn6lu-30nWcoj_ABR; path=/; secure; httponly"],"x-frame-options":"sameorigin","content-length":"168","connection":"close","content-type":"application/json; charset=UTF-8","x-node-red-request-node":"479acce0"},"responseUrl":"https://api2.tigoenergy.com/api/v3/data/summary?system_id=52705","payload":{"summary":{"lifetime_energy_dc":"859723.86666667","ytd_energy_dc":"859723.87","daily_energy_dc":"24233.87","last_power_dc":0,"updated_on":"2021-06-12T21:36:00+01:00"}},"redirectList":[],"responseCookies":{"_csrf":{"path":"/","value":"JnmKc8FCTpdEKHGIn6lu-30nWcoj_ABR"}}}

```

getting error:

```auto
TypeError: points.forEach is not a function

```

Please help me to capture values from  
payload -\> Summary -\>  
lifetime\_energy\_dc:  
ytd\_energy\_dc:  
daily\_energy\_dc:

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [12 June 2021 21:35 UTC](https://discourse.nodered.org/t/tigo-energy-pv-combined-api-to-influxdb/46615/49 "2021-06-12T21:35:36Z")

</div>

Sorry, I was refering to your trying to get the data from msg.payload. In the sample data you provided. What you provided msg.payload is a string representation of an object so you need feed it thru a `json` node to turn it into an object. Then you will be able to address the data.

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

[https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 June 2021 21:36 UTC](https://discourse.nodered.org/t/tigo-energy-pv-combined-api-to-influxdb/46615/50 "2021-06-26T21:36:36Z")

</div>

Closed on 26 June 2021 21:36 UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/tigo-energy-pv-combined-api-to-influxdb/46615.md?page=2)
