# Need help with p1 smart meter

**URL:** <https://discourse.nodered.org/t/need-help-with-p1-smart-meter/55555>\
**Category:** General\
**Created:** [22 December 2021 11:34 UTC](https://discourse.nodered.org/t/need-help-with-p1-smart-meter/55555 "2021-12-22T11:34:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![old-grumpy](https://avatars.discourse-cdn.com/v4/letter/o/e274bd/32.png) [@old-grumpy](https://discourse.nodered.org/u/old-grumpy)\
**Post date:** [22 December 2021 11:34 UTC](https://discourse.nodered.org/t/need-help-with-p1-smart-meter/55555/1 "2021-12-22T11:34:23Z")

</div>

Fighting to read the results of the p1readernode. The gas gives value the actual electricity stay zero.  
The function i use

```auto
var payload=msg.payload;
var msg1 = {};
var msg2 = {};
var msg3 = {};
var msg4 = {};
msg1.payload = payload.electricity.delivered.tariff1.reading;
msg2.payload = payload.electricity.delivered.tariff2.reading;
msg3.payload = payload.electricity.delivered.actual.reading;
msg4.payload = payload.gas.reading;

return [msg1, msg2, msg3, msg4];

```

The path i get from the debug node, so no idea why it does not work.

---

<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:** [22 December 2021 11:58 UTC](https://discourse.nodered.org/t/need-help-with-p1-smart-meter/55555/2 "2021-12-22T11:58:19Z")

</div>

This is just a hunch, actual is in bold for some reason.  
try

```auto
payload.electricity.delivered["actual"].reading

```

---

<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:** [22 December 2021 11:58 UTC](https://discourse.nodered.org/t/need-help-with-p1-smart-meter/55555/3 "2021-12-22T11:58:41Z")

</div>

Add a `debug` node to the output of the node feeding the `function` node and run it. Then in the sidebar, expand all of the message and copy and past it into a reply so we can see what the data going into the `function` node is.

---

<div class="post-metadata">

**Author:** ![old-grumpy](https://avatars.discourse-cdn.com/v4/letter/o/e274bd/32.png) [@old-grumpy](https://discourse.nodered.org/u/old-grumpy)\
**Post date:** [22 December 2021 12:47 UTC](https://discourse.nodered.org/t/need-help-with-p1-smart-meter/55555/4 "2021-12-22T12:47:03Z")

</div>

```auto
"{"meterType":"ISK5\\2M550E-1012","version":"50","timestamp":"2021-12-19T10:01:24.000Z","equipmentId":"4530303433303036393938303836303137","textMessage":{"codes":null,"message":""},"electricity":{"received":{"tariff1":{"reading":5677.072,"unit":"kWh"},"tariff2":{"reading":5932.27,"unit":"kWh"},"actual":{"reading":0.269,"unit":"kW"}},"delivered":{"tariff1":{"reading":0,"unit":"kWh"},"tariff2":{"reading":0,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"tariffIndicator":1,"threshold":null,"fuseThreshold":null,"switchPosition":null,"numberOfPowerFailures":9,"numberOfLongPowerFailures":2,"longPowerFailureLog":{"count":0,"log":[]},"voltageSags":{"L1":8,"L2":null,"L3":null},"voltageSwell":{"L1":1,"L2":null,"L3":null},"instantaneous":{"current":{"L1":{"reading":1,"unit":"A"},"L2":{"reading":null,"unit":null},"L3":{"reading":null,"unit":null}},"voltage":{"L1":{"reading":228,"unit":"V"},"L2":{"reading":null,"unit":null},"L3":{"reading":null,"unit":null}},"power":{"positive":{"L1":{"reading":0..."
12/19/2021, 10:00:37 AMnode: json-node
msg.payload : string[1371]

The reading event returns the following data structure:

{
    "meterType": "ISk5\2MT382-1000",
    "version": "42",
    "timestamp": "2010-12-09T10:30:20.000Z",
    "equipmentId": "4B384547303034303436333935353037",
    "textMessage": {
        "codes": "3031203631203831",
        "message": "0123456789:;<=>?0123456789:;<=>?0123456789:;<=>?0123456789:;<=>?0123456789:;<=>?"
    },
    "electricity": {
        "received": {
            "tariff1": {
                "reading": 123456.789,
                "unit": "kWh"
            },
            "tariff2": {
                "reading": 123456.789,
                "unit": "kWh"
            },
            "actual": {
                "reading": 1.193,
                "unit": "kW"
            }
        },
        "delivered": {
            "tariff1": {
                "reading": 123456.789,
                "unit": "kWh"
            },
            "tariff2": {
                "reading": 123456.789,
                "unit": "kWh"
            },
            "actual": {
                "reading": 0,
                "unit": "kW"
            }
        },
        "tariffIndicator": 2,
        "threshold": {
            "value": 16.1,
            "unit": "kW"
        },
        "fuseThreshold": {
            "value": 10,
            "unit": "A"
        },
        "switchPosition": "1",
        "numberOfPowerFailures": 4,
        "numberOfLongPowerFailures": 2,
        "longPowerFailureLog": {
            "count": 2,
            "log": [
                {
                    "startOfFailure": "2010-12-08T14:20:15.000Z",
                    "endOfFailure": "2010-12-08T14:24:15.000Z",
                    "duration": 240,
                    "unit": "s"
                },
                {
                    "startOfFailure": "2010-12-08T14:05:03.000Z",
                    "endOfFailure": "2010-12-08T14:10:04.000Z",
                    "duration": 301,
                    "unit": "s"
                }
            ]
        },
        "voltageSags": {
            "L1": 2,
            "L2": 1,
            "L3": 0
        },
        "voltageSwell": {
            "L1": 0,
            "L2": 3,
            "L3": 0
        },
        "instantaneous": {
            "current": {
                "L1": {
                    "reading": 1,
                    "unit": "A"
                },
                "L2": {
                    "reading": 2,
                    "unit": "A"
                },
                "L3": {
                    "reading": 3,
                    "unit": "A"
                }
            },
            "voltage": {
                "L1": {
                    "reading": 231,
                    "unit": "V"
                },
                "L2": {
                    "reading": 232,
                    "unit": "V"
                },
                "L3": {
                    "reading": 233,
                    "unit": "V"
                }
            },
            "power": {
                "positive": {
                    "L1": {
                        "reading": 1.111,
                        "unit": "kW"
                    },
                    "L2": {
                        "reading": 2.222,
                        "unit": "kW"
                    },
                    "L3": {
                        "reading": 3.333,
                        "unit": "kW"
                    }
                },
                "negative": {
                    "L1": {
                        "reading": 4.444,
                        "unit": "kW"
                    },
                    "L2": {
                        "reading": 5.555,
                        "unit": "kW"
                    },
                    "L3": {
                        "reading": 6.666,
                        "unit": "kW"
                    }
                }
            }
        }
    },
    "gas": {
        "deviceType": "003",
        "equipmentId": "3232323241424344313233343536373839",
        "timestamp": "2010-12-09T10:00:00.000Z",
        "reading": 12785.123,
        "unit": "m3",
        "valvePosition": "1"
    }
}

```

@ E1cid i got the path from a debug node,that why i am confused, in the dbug it give the value.

---

<div class="post-metadata">

**Author:** ![old-grumpy](https://avatars.discourse-cdn.com/v4/letter/o/e274bd/32.png) [@old-grumpy](https://discourse.nodered.org/u/old-grumpy)\
**Post date:** [22 December 2021 12:47 UTC](https://discourse.nodered.org/t/need-help-with-p1-smart-meter/55555/5 "2021-12-22T12:47:56Z")

</div>

That is the copy paste its payload.electricity.delivered.actual.reading; in the code.

---

<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:** [22 December 2021 12:55 UTC](https://discourse.nodered.org/t/need-help-with-p1-smart-meter/55555/6 "2021-12-22T12:55:24Z")

</div>

~~I am thinking actual has a meaning in JS , I think JQuery (again a hunch). Have you tried my suggestion? That will eliminate my hunch at least.~~  
re-reading your initial question I think i have miss read, It would seem the reading is payload.electricity.delivered.actual.reading is always 0. Is the electricty use over 1kw? Maybe the value is below 1kw and not being parse correctly.

what is  
payload.electricity.received.actual.reading?

---

<div class="post-metadata">

**Author:** ![old-grumpy](https://avatars.discourse-cdn.com/v4/letter/o/e274bd/32.png) [@old-grumpy](https://discourse.nodered.org/u/old-grumpy)\
**Post date:** [22 December 2021 13:32 UTC](https://discourse.nodered.org/t/need-help-with-p1-smart-meter/55555/7 "2021-12-22T13:32:03Z")

</div>

It is \< 1kw mostly ,in the debugnode it read `"actual":{"reading":0.269,"unit":"kW"`  
now i have more trouble lol `"Connection to P1 meter failed. Error details: Error: Error Resource temporarily unavailable Cannot lock port"` rebooted the pi no help.

Received is if you give back,like having solar panels.

---

<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:** [22 December 2021 13:51 UTC](https://discourse.nodered.org/t/need-help-with-p1-smart-meter/55555/8 "2021-12-22T13:51:47Z")

</div>

Scratch that

---

<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:** [20 February 2022 13:52 UTC](https://discourse.nodered.org/t/need-help-with-p1-smart-meter/55555/9 "2022-02-20T13:52:12Z")

</div>

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