P1 smartmeter (API)

No, it never worked, only a dash sign. See the screenshot i made.

I have the same (similar?) problem, using V3.1.2 I don’t see the current use for electricity, same for V3.1.4

If I also install the “Slimme meter (verouderd)” device when using the 3.1.2 app, that does show the current use so I am guessing that the script is at least sending out the data but not correctly for the new device in Homey?

The ‘Slimme meter (verouderd)’ isn’t supported anymore. There is one capability: ‘elektriciteit huidige verbruik/teruglevering’ that is used.

You have to add the new device

Hi koktail, Do you have an update for us? Can i test something or do we have to be patiënt? :slight_smile: Thanks

I think there are values missing in the post data from your P1. I cannot reproduce your issue.

Hi Koktail, these are the values from the P1 script:

dsmr@dsmr-reader:~$ sudo cu -l /dev/ttyUSB0 -s 115200
Connected.
/XMX5LGF0000444081168

1-3:0.2.8(50)
0-0:1.0.0(200622135714S)
0-0:96.1.1(4530303531303034343038313136383138)
1-0:1.8.1(002224.280*kWh)
1-0:1.8.2(002908.808*kWh)
1-0:2.8.1(000000.311*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0002)
1-0:1.7.0(00.557*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00017)
0-0:96.7.9(00004)
1-0:99.97.0(3)(0-0:96.7.19)(181029081549W)(0000001311*s)(181029084407W)(0000001688*s)(200119090253W)(0000005158*s)
1-0:32.32.0(00007)
1-0:32.36.0(00005)
0-0:96.13.0()
1-0:32.7.0(235.2*V)
1-0:31.7.0(003*A)
1-0:21.7.0(00.557*kW)
1-0:22.7.0(00.000*kW)
0-1:24.1.0(003)
0-1:96.1.0(4730303339303031393034363434303139)
0-1:24.2.1(200622135506S)(01107.129*m3)
!0357
/XMX5LGF0000444081168

1-3:0.2.8(50)
0-0:1.0.0(200622135715S)
0-0:96.1.1(4530303531303034343038313136383138)
1-0:1.8.1(002224.280*kWh)
1-0:1.8.2(002908.808*kWh)
1-0:2.8.1(000000.311*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0002)
1-0:1.7.0(00.563*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00017)
0-0:96.7.9(00004)
1-0:99.97.0(3)(0-0:96.7.19)(181029081549W)(0000001311*s)(181029084407W)(0000001688*s)(200119090253W)(0000005158*s)
1-0:32.32.0(00007)
1-0:32.36.0(00005)
0-0:96.13.0()
1-0:32.7.0(235.2*V)
1-0:31.7.0(003*A)
1-0:21.7.0(00.563*kW)
1-0:22.7.0(00.000*kW)
0-1:24.1.0(003)
0-1:96.1.0(4730303339303031393034363434303139)
0-1:24.2.1(200622135506S)(01107.129*m3)
!2205
/XMX5LGF0000444081168

1-3:0.2.8(50)
0-0:1.0.0(200622135716S)
0-0:96.1.1(4530303531303034343038313136383138)
1-0:1.8.1(002224.280*kWh)
1-0:1.8.2(002908.808*kWh)
1-0:2.8.1(000000.311*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0002)
1-0:1.7.0(00.574*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00017)
0-0:96.7.9(00004)
1-0:99.97.0(3)(0-0:96.7.19)(181029081549W)(0000001311*s)(181029084407W)(0000001688*s)(200119090253W)(0000005158*s)
1-0:32.32.0(00007)
1-0:32.36.0(00005)
0-0:96.13.0()
1-0:32.7.0(235.2*V)
1-0:31.7.0(003*A)
1-0:21.7.0(00.574*kW)
1-0:22.7.0(00.000*kW)
0-1:24.1.0(003)
0-1:96.1.0(4730303339303031393034363434303139)
0-1:24.2.1(200622135506S)(01107.129*m3)
!CB31
/XMX5LGF0000444081168

What P1 script do you use on what version. Do you have an export of the JSON file?

I use your version of the script. Here is the export of the json file:

    "name": "com.p1.smartmeter-dsmr.reader",
    "version": "1.0.0",
    "description": "Script to parse DSMR data into the com.p1.smartmeter Homey app",
    "main": "src/p1.js",
    "scripts": {
            "test": "echo \"Error: no test specified\" && exit 1"
    },
    "bin": {
            "p1": "src/p1.js"
    },
    "engines": {
            "node": "*"
    },
    "repository": {
            "type": "git",
            "url": "git+https://github.com/koktaildotcom/com.p1.smartmeter-dsmr.reader.git"
    },
    "author": "Leendert de Kok",
    "license": "MIT",
    "bugs": {
            "url": "https://github.com/koktaildotcom/com.p1.smartmeter-dsmr.reader/issues"
    },
    "homepage": "https://github.com/koktaildotcom/com.p1.smartmeter-dsmr.reader#readme",
    "dependencies": {
            "bluebird": "^3.7.2",
            "node-dsmr": "^0.1.4",
            "node-fetch": "^2.6.0"
    }

This is the export of the p1.js file:

const dsmr = require('node-dsmr')
const fetch = require('node-fetch')
const logger = require('winston')

logger.add(new logger.transports.Console({
    level: 'info',
}))

/**
 * 1: Goto: http://developer.athom.com
 * 2: Login into Homey
 * 3: Open the inspector (chrome f12)
 * 4: Click the `network` tab
 * 5: Refresh the page (you see couple of webpages being called)
 * 6: Copy the `homeyId` from the url: https://[localId].homey.homeylocal.com/api/manager/system/ping?id=[homeyId]
 */
const homeyId = '*************************'

const usbPort = '/dev/ttyUSB0'
const bps = 115200
const bits = 8
const parity = 'none'

const homeyEndpoint = '/api/app/com.p1/update'
const homeyHosts = [
    'https://' + homeyId + '.connect.athom.com'
]

function publishToHomey (output) {
    const data = {
        'meterType': output.meterModel,
        'version': output.dsmrVersion,
        'timestamp': output.dsmrVersion,
    }

    if (output.power) {
        data.electricity = {
            'received': {
                'tariff1': {
                    'reading': output.power.totalConsumed1,
                    'unit': 'kWh',
                },
                'tariff2': {
                    'reading': output.power.totalConsumed2,
                    'unit': 'kWh',
                },
                'actual': {
                    'reading': output.power.actualConsumed,
                    'unit': 'kW',
                },
            },
            'delivered': {
                'tariff1': {
                    'reading': output.power.totalProduced1,
                    'unit': 'kWh',
                },
                'tariff2': {
                    'reading': output.power.totalProduced2,
                    'unit': 'kWh',
                },
                'actual': {
                    'reading': output.power.actualProduced,
                    'unit': 'kW',
                },
            },
            'tariffIndicator': output.power.activeTariff,
            'switchPosition': output.power.switchPosition,
            'voltageSags': {
                'L1': output.power.voltageSagsL1,
                'L2': output.power.voltageSagsL2,
                'L3': output.power.voltageSagsL3,
            },
            'voltageSwell': {
                'L1': output.power.voltageSwellsL1,
                'L2': output.power.voltageSwellsL2,
                'L3': output.power.voltageSwellsL3,
            },
            'instantaneous': {
                'current': {
                    'L1': {
                        'reading': output.power.instantaneousCurrentL1,
                        'unit': 'A',
                    },
                    'L2': {
                        'reading': output.power.instantaneousCurrentL2,
                        'unit': 'A',
                    },
                    'L3': {
                        'reading': output.power.instantaneousCurrentL3,
                        'unit': 'A',
                    },
                },
                'power': {
                    'positive': {
                        'L1': {
                            'reading': output.power.instantaneousProducedElectricityL1,
                            'unit': 'kW',
                        },
                        'L2': {
                            'reading': output.power.instantaneousProducedElectricityL2,
                            'unit': 'kW',
                        },
                        'L3': {
                            'reading': output.power.instantaneousProducedElectricityL3,
                            'unit': 'kW',
                        },
                    },
                    'negative': {
                        'L1': {
                            'reading': output.power.instantaneousConsumedElectricityL1,
                            'unit': 'kW',
                        },
                        'L2': {
                            'reading': output.power.instantaneousConsumedElectricityL2,
                            'unit': 'kW',
                        },
                        'L3': {
                            'reading': output.power.instantaneousConsumedElectricityL3,
                            'unit': 'kW',
                        },
                    },
                },
            },
        }
    }

    // backwards compatibility
    data.gas = {
        'reading': null,
    }

    if (output.gas) {
        data.gas = {
            'deviceType': '003',
            'equipmentId': output.gas.equipmentId,
            'timestamp': output.gas.timestamp,
            'reading': output.gas.totalConsumed,
            'unit': 'm3',
            'valvePosition': output.gas.valvePosition,
        }
    }

    for (const homeyHost of homeyHosts) {
        fetch(homeyHost + homeyEndpoint, {
            method: 'post',
            body: JSON.stringify(data),
            headers: {'Content-Type': 'application/json'},
        }).then(() => {
            logger.info('posted successfully to: ' + homeyHost + homeyEndpoint)
        }).catch((error) => {
            logger.error(error)
        })
    }
}

const p1Meter = new dsmr({
    port: usbPort,
    baudrate: bps,
    bits: bits,
    parity: parity,
})
p1Meter.on('connected', () => {
    logger.info('p1 smartmeter is connected!')
})

p1Meter.on('telegram', telegram => {
    if (telegram.hasOwnProperty('gas')) {
        logger.info('p1 smartmeter update gas')
        publishToHomey(telegram)
    }
    if (telegram.hasOwnProperty('power')) {
        logger.info('p1 smartmeter update power')
        publishToHomey(telegram)
    }
})

p1Meter.on('disconnected', () => {
    logger.info('p1 smartmeter is disconnected')
})

p1Meter.connect()

The data is collected by de com.p1.smartmeter-dsmr.reader and pushed to Homey. I would like to see that data so i can analyse if its the pusher or the receiver.

You can try to log the data by adding this line:
console.log(JSON.stringify(data));

Before the line:
143 for (const homeyHost of homeyHosts) {

Hi Koktail, here is the output, hope you can find something.

dsmr@dsmr-reader:~/com.p1.smartmeter-dsmr.reader-master/src$ sudo node p1.js
{"message":"p1 smartmeter is connected!","level":"info"}
{"message":"p1 smartmeter update gas","level":"info"}
{"electricity":{"received":{"tariff1":{"unit":"kWh"},"tariff2":{"unit":"kWh"},"actual":{"unit":"kW"}},"delivered":{"tariff1":{"unit":"kWh"},"tariff2":{"unit":"kWh"},"actual":{"unit":"kW"}},"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.577,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"p1 smartmeter update power","level":"info"}
{"electricity":{"received":{"tariff1":{"unit":"kWh"},"tariff2":{"unit":"kWh"},"actual":{"unit":"kW"}},"delivered":{"tariff1":{"unit":"kWh"},"tariff2":{"unit":"kWh"},"actual":{"unit":"kW"}},"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.577,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"p1 smartmeter update gas","level":"info"}
{"meterType":"XMX5LGF00004440*****","version":5,"timestamp":5,"electricity":{"received":{"tariff1":{"reading":2229.616,"unit":"kWh"},"tariff2":{"reading":2932.193,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"delivered":{"tariff1":{"reading":1.042,"unit":"kWh"},"tariff2":{"reading":23.427,"unit":"kWh"},"actual":{"reading":2.576,"unit":"kW"}},"tariffIndicator":2,"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.576,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"p1 smartmeter update power","level":"info"}
{"meterType":"XMX5LGF00004440*****","version":5,"timestamp":5,"electricity":{"received":{"tariff1":{"reading":2229.616,"unit":"kWh"},"tariff2":{"reading":2932.193,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"delivered":{"tariff1":{"reading":1.042,"unit":"kWh"},"tariff2":{"reading":23.427,"unit":"kWh"},"actual":{"reading":2.576,"unit":"kW"}},"tariffIndicator":2,"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.576,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"p1 smartmeter update gas","level":"info"}
{"meterType":"XMX5LGF00004440*****","version":5,"timestamp":5,"electricity":{"received":{"tariff1":{"reading":2229.616,"unit":"kWh"},"tariff2":{"reading":2932.193,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"delivered":{"tariff1":{"reading":1.042,"unit":"kWh"},"tariff2":{"reading":23.428,"unit":"kWh"},"actual":{"reading":2.574,"unit":"kW"}},"tariffIndicator":2,"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.574,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"p1 smartmeter update power","level":"info"}
{"meterType":"XMX5LGF00004440*****","version":5,"timestamp":5,"electricity":{"received":{"tariff1":{"reading":2229.616,"unit":"kWh"},"tariff2":{"reading":2932.193,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"delivered":{"tariff1":{"reading":1.042,"unit":"kWh"},"tariff2":{"reading":23.428,"unit":"kWh"},"actual":{"reading":2.574,"unit":"kW"}},"tariffIndicator":2,"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.574,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"p1 smartmeter update gas","level":"info"}
{"meterType":"XMX5LGF00004440*****","version":5,"timestamp":5,"electricity":{"received":{"tariff1":{"reading":2229.616,"unit":"kWh"},"tariff2":{"reading":2932.193,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"delivered":{"tariff1":{"reading":1.042,"unit":"kWh"},"tariff2":{"reading":23.429,"unit":"kWh"},"actual":{"reading":2.575,"unit":"kW"}},"tariffIndicator":2,"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.575,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"p1 smartmeter update power","level":"info"}
{"meterType":"XMX5LGF00004440*****","version":5,"timestamp":5,"electricity":{"received":{"tariff1":{"reading":2229.616,"unit":"kWh"},"tariff2":{"reading":2932.193,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"delivered":{"tariff1":{"reading":1.042,"unit":"kWh"},"tariff2":{"reading":23.429,"unit":"kWh"},"actual":{"reading":2.575,"unit":"kW"}},"tariffIndicator":2,"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.575,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"p1 smartmeter update gas","level":"info"}
{"meterType":"XMX5LGF00004440*****","version":5,"timestamp":5,"electricity":{"received":{"tariff1":{"reading":2229.616,"unit":"kWh"},"tariff2":{"reading":2932.193,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"delivered":{"tariff1":{"reading":1.042,"unit":"kWh"},"tariff2":{"reading":23.43,"unit":"kWh"},"actual":{"reading":2.567,"unit":"kW"}},"tariffIndicator":2,"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.567,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"p1 smartmeter update power","level":"info"}
{"meterType":"XMX5LGF00004440*****","version":5,"timestamp":5,"electricity":{"received":{"tariff1":{"reading":2229.616,"unit":"kWh"},"tariff2":{"reading":2932.193,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"delivered":{"tariff1":{"reading":1.042,"unit":"kWh"},"tariff2":{"reading":23.43,"unit":"kWh"},"actual":{"reading":2.567,"unit":"kW"}},"tariffIndicator":2,"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.567,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"p1 smartmeter update gas","level":"info"}
{"meterType":"XMX5LGF00004440*****","version":5,"timestamp":5,"electricity":{"received":{"tariff1":{"reading":2229.616,"unit":"kWh"},"tariff2":{"reading":2932.193,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"delivered":{"tariff1":{"reading":1.042,"unit":"kWh"},"tariff2":{"reading":23.43,"unit":"kWh"},"actual":{"reading":2.568,"unit":"kW"}},"tariffIndicator":2,"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.568,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"p1 smartmeter update power","level":"info"}
{"meterType":"XMX5LGF00004440*****","version":5,"timestamp":5,"electricity":{"received":{"tariff1":{"reading":2229.616,"unit":"kWh"},"tariff2":{"reading":2932.193,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"delivered":{"tariff1":{"reading":1.042,"unit":"kWh"},"tariff2":{"reading":23.43,"unit":"kWh"},"actual":{"reading":2.568,"unit":"kW"}},"tariffIndicator":2,"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.568,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"p1 smartmeter update gas","level":"info"}
{"meterType":"XMX5LGF00004440*****","version":5,"timestamp":5,"electricity":{"received":{"tariff1":{"reading":2229.616,"unit":"kWh"},"tariff2":{"reading":2932.193,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"delivered":{"tariff1":{"reading":1.042,"unit":"kWh"},"tariff2":{"reading":23.431,"unit":"kWh"},"actual":{"reading":2.566,"unit":"kW"}},"tariffIndicator":2,"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.566,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"p1 smartmeter update power","level":"info"}
{"meterType":"XMX5LGF00004440*****","version":5,"timestamp":5,"electricity":{"received":{"tariff1":{"reading":2229.616,"unit":"kWh"},"tariff2":{"reading":2932.193,"unit":"kWh"},"actual":{"reading":0,"unit":"kW"}},"delivered":{"tariff1":{"reading":1.042,"unit":"kWh"},"tariff2":{"reading":23.431,"unit":"kWh"},"actual":{"reading":2.566,"unit":"kW"}},"tariffIndicator":2,"voltageSags":{"L1":7},"voltageSwell":{"L1":5},"instantaneous":{"current":{"L1":{"reading":11,"unit":"A"},"L2":{"unit":"A"},"L3":{"unit":"A"}},"power":{"positive":{"L1":{"reading":0,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}},"negative":{"L1":{"reading":2.566,"unit":"kW"},"L2":{"unit":"kW"},"L3":{"unit":"kW"}}}}},"gas":{"deviceType":"003","equipmentId":"G0039001904644019","timestamp":1593096299,"reading":1109.366,"unit":"m3"}}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}
{"message":"posted successfully to: https://5ae80b**************9f9.connect.athom.com/api/app/com.p1/update","level":"info"}

You are not sending readings.

{
   "electricity":{
      "received":{
         "tariff1":{
            "reading": 1  // <-- you miss this
            "unit":"kWh"
         }
     }
}

I think you are not getting the good values from the p1 meter or they cannot be parsed by the node-dsmr parser.

I’m facing the same issue and have similar values as @VvBemmel and started debugging.

It seems like this is because the “reading” key does not exist for L2 and L3 in the keys “data.electricity.instantaneous.positive” and “data.electricity.instantaneous.negative”. These keys return “undefined” which makes the calculate result in NaN and breaks the values of the device.

I’ve commented out the following part in :

let measurePowerConsumed = device.round(
(data.electricity.instantaneous.power.positive.L1.reading +
data.electricity.instantaneous.power.positive.L2.reading +
data.electricity.instantaneous.power.positive.L3.reading) * 1000)
let lastMeasurePowerProduced = device.round(
(data.electricity.instantaneous.power.negative.L1.reading +
data.electricity.instantaneous.power.negative.L2.reading +
data.electricity.instantaneous.power.negative.L3.reading) * 1000)

and replaced it with:

let measurePowerConsumed = device.round(data.electricity.instantaneous.power.positive.L1.reading * 1000)
let lastMeasurePowerProduced = device.round(data.electricity.instantaneous.power.negative.L1.reading * 1000)

This gives me some results:

However when i produce less power than i use, it does not show me how much i’m producing.
Does this still sound like a node-dsmr parser issue to you @Koktail? if so i will dive a layer deeper :slight_smile:

The app is designed that it gets that reading with a numeric value. (If the P1 doesn’t support it use the reading: 0).

Somebody who can make a step-by-step guide to install this on a Raspberry pi? Still getting an error when trying to run the p1.js, I’m doing something wrong… :face_with_hand_over_mouth:

If you start with this just start also at start off this topic and follow the link to the github page’s:

https://github.com/koktaildotcom/com.p1.smartmeter/blob/master/README.md.

You need some basic knowledge of Raspberry Pi.

1 Like

I already did read the git pages, I just think my RPI knowledge is too basic. Steps like “install…” can be explained with a bit more steps. Sorry for being a noob on this topic.

Hi all,

I am having some issues getting the p1 to work with my homey.

When is use minicom on the rpi and use the following settings I will receive the data from the meter:


9600 7 even

When I use the same settings in the p1 config and start the p1 script it doesn’t look like it receives any data:

When i change the settings to 9600 7 none the following will happen when starting the p1 script:

Whice looks much better but the data in homey is not updated (Although it says its updated a second ago) and when using the 9600 7 none setting in minicom I am getting this misformed data:

Any idea if i am doing something wrong as i cant seem to find a solution. I have tried a new different pi with a newer os. Newest version of node and npm. Different serial cable but nothing seem to help.

Hope you can help me out.

Thanks

Hi All,

Anybody knows what it can be?

You could add the following line before this one to see what exactly gets posted back to your Homey:

console.log(data)
1 Like