# Shelly Plus 1PM Nodered Select Data?

**URL:** <https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974>\
**Category:** General\
**Created:** [13 October 2022 10:02 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974 "2022-10-13T10:02:57Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Starfoxfs](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/starfoxfs/32/69119_2.png) [@Starfoxfs](https://discourse.nodered.org/u/Starfoxfs)\
**Post date:** [13 October 2022 10:02 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/1 "2022-10-13T10:02:57Z")

</div>

Hi,

i have bought Shelly Plus 1PM 2Gen. to measure my Solarpower with Grafana on my Raspberry Pi.

I have installed MQTT and Node-Red on my Raspberry and created a Node

ShellyPlus1PM/status/switch:0

I get this Data from the Shelly with a Debug Node:

```auto
{"id":0, "source":"init", "output":false, "apower":0.0, "voltage":233.9, "current":0.000, "aenergy":{"total":0.000,"by_minute":[0.000,0.000,0.000],"minute_ts":1665655079},"temperature":{"tC":52.3, "tF":126.2}}

```

But how can i select a Single Data Source like "voltage" or "apower" ?

I have seen some Tutorials on Youtube with Shelly 1PM (i think 1Gen) it was easyier to select the Single Data.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [13 October 2022 11:22 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/2 "2022-10-13T11:22:02Z")

</div>

Use the debug node and sidebar to get the path, using the copy path button next to voltage. It appears when you hover the mouse to right of property name.  
it should be `msg.payload.voltage`. if you use the copy path method you will get `payload.voltage`, you would then append `msg.` to front if using it in a function node.

---

<div class="post-metadata">

**Author:** ![Starfoxfs](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/starfoxfs/32/69119_2.png) [@Starfoxfs](https://discourse.nodered.org/u/Starfoxfs)\
**Post date:** [13 October 2022 12:14 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/3 "2022-10-13T12:14:10Z")

</div>

I want to get this Data to Influx Database.

```auto
msg.payload.voltage
msg.voltage

```

I gettin undefined in both variants

---

<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:** [13 October 2022 12:35 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/4 "2022-10-13T12:35:32Z")

</div>

Feed the message into a debug node and screenshot so we can check what you have. You can paste an image here. Also show us how you are trying to access it that is getting undefined and how you know it is undefined.

---

<div class="post-metadata">

**Author:** ![Starfoxfs](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/starfoxfs/32/69119_2.png) [@Starfoxfs](https://discourse.nodered.org/u/Starfoxfs)\
**Post date:** [13 October 2022 13:10 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/5 "2022-10-13T13:10:30Z")

</div>

Ok, here we go

 ![1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/a/ca9fca5c1775ea323a168f58c50cbd353d5755e4.jpeg)  
 ![2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/e/5e0b298b8fb3f1aec4aa556f958539a3433fcf4f.jpeg)

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [13 October 2022 13:19 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/6 "2022-10-13T13:19:29Z")

</div>

Just a thought... is your MQTT-In node set to output a parsed JSON object?

![parsed](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/4/a4569b0d4d3a0cfbf38b39fa5c056680e56226dd.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [13 October 2022 13:28 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/7 "2022-10-13T13:28:30Z")

</div>

This is a Gen 2 device so the topics are different to gen 1  
e.g. topic would be something like  
`<shelly-id>/events/rpc`

> **[MQTT | Shelly Technical Documentation](https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Mqtt/)**
>
> The MQTT component handles configuration and status of the outbound MQTT connection. The supported Quality of service level is 1, which guarantees that a message is delivered at least one time to the receiver. Here, you can find how to configure your...

---

<div class="post-metadata">

**Author:** ![Starfoxfs](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/starfoxfs/32/69119_2.png) [@Starfoxfs](https://discourse.nodered.org/u/Starfoxfs)\
**Post date:** [13 October 2022 13:43 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/8 "2022-10-13T13:43:26Z")

</div>

Ok now Debug Output works, but not the InfluxDB Data Output

I have changed the Output to "a parsed JSON Object"

Now i gettin from Influx Database a boolean Error

 ![3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/8/688db551e63ac3cd3ab0c3ea6bb1ebba1ea95cf1.jpeg)

---

<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:** [13 October 2022 14:49 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/9 "2022-10-13T14:49:03Z")

</div>

Change the debug node to show msg.payload, see what is there, then check that the layout of the payload is correct for the influx node. The help text for the influx node tells you what is allowed. Note that nested objects are not allowed in influx. You must decide what fields and tags you want in the database and build the payload accordingly.

---

<div class="post-metadata">

**Author:** ![Starfoxfs](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/starfoxfs/32/69119_2.png) [@Starfoxfs](https://discourse.nodered.org/u/Starfoxfs)\
**Post date:** [13 October 2022 16:32 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/10 "2022-10-13T16:32:40Z")

</div>

Write to InfluxDB now works but no single values only the whole String:

```auto
{"id":0, "source":"init", "output":false, "apower":0.0, "voltage":235.2, "current":0.000, "aenergy":{"total":0.000,"by_minute":[0.000,0.000,0.000],"minute_ts":1665678358},"temperature":{"tC":52.6, "tF":126.7}}

```

How can i preformat it to write Single Datas ?

---

<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:** [13 October 2022 17:12 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/11 "2022-10-13T17:12:52Z")

</div>

> [@Starfoxfs](#):
>
> only the whole String

You should have the parse JSON box ticked in the mqtt node. Then you must decide which fields and tags you want to write.

---

<div class="post-metadata">

**Author:** ![Starfoxfs](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/starfoxfs/32/69119_2.png) [@Starfoxfs](https://discourse.nodered.org/u/Starfoxfs)\
**Post date:** [13 October 2022 17:45 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/12 "2022-10-13T17:45:29Z")

</div>

If i use the parsed JSON Object in MQTT Node and add to the InfluxDB Node Measurement -\> voltage

I get this Error:

```auto
Error: A 400 Bad Request error occurred: {"error":"unable to parse 'voltage aenergy=[object Object],apower=0,current=0,id=0,output=false,source=\"init\",temperature=[object Object],voltage=232.5': invalid boolean"}

```

---

<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:** [13 October 2022 18:05 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/13 "2022-10-13T18:05:37Z")

</div>

That is because you have not formatted the payload as required by the node. Have you read the help text and decided what fields and tags you want? If you don't know what influx fields and tags are then you need to read the influx docs.

---

<div class="post-metadata">

**Author:** ![Starfoxfs](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/starfoxfs/32/69119_2.png) [@Starfoxfs](https://discourse.nodered.org/u/Starfoxfs)\
**Post date:** [14 October 2022 12:42 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/14 "2022-10-14T12:42:52Z")

</div>

Ok thanks i have read a while 😀

In the meantime I managed to get a few values ​​into the database. I'm a complete newbie here.

How can I set time interval for inserting into the influxdb?

---

<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:** [14 October 2022 14:01 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/15 "2022-10-14T14:01:10Z")

</div>

> [@Starfoxfs](#):
>
> How can I set time interval for inserting into the influxdb?

As you have it, it will add a record each time new data arrives via MQTT. If you want to slow that down (or speed it up) then you could change the rate at which the publishing device sends data. Alternatively to slow it down you could configure a Delay node configured in Rate Limit mode, with Drop Intermediate 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:** [28 October 2022 14:01 UTC](https://discourse.nodered.org/t/shelly-plus-1pm-nodered-select-data/68974/16 "2022-10-28T14:01:11Z")

</div>

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