ruudverheijden / node-p1-reader

Node.js package for reading and parsing data from the P1 port of a Dutch or Belgian Smart Meter.
MIT License
25 stars 25 forks source link

No Smartmeter found #16

Open tdwesten opened 4 years ago

tdwesten commented 4 years ago

Hi Ruud, Thanks for building this package!

I have a problem finding our smartmeter. When I use your example code this is the output;

[2020-05-09T13:15:25.853Z] DEBUG MODE ENABLED
[2020-05-09T13:15:27.816Z] Available serial ports with possible configurations:
[
    {
        "port": "/dev/ttyAMA0",
        "baudRate": 115200,
        "parity": "none",
        "dataBits": 8,
        "stopBits": 1
    },
    {
        "port": "/dev/ttyAMA0",
        "baudRate": 115200,
        "parity": "even",
        "dataBits": 7,
        "stopBits": 1
    },
    {
        "port": "/dev/ttyUSB0",
        "baudRate": 115200,
        "parity": "none",
        "dataBits": 8,
        "stopBits": 1
    },
    {
        "port": "/dev/ttyUSB0",
        "baudRate": 115200,
        "parity": "even",
        "dataBits": 7,
        "stopBits": 1
    }
]
[2020-05-09T13:15:27.834Z] Trying to connect to Smart Meter via port: /dev/ttyAMA0 (BaudRate: 115200, Parity: none, Databits: 8Stopbits: 1)
[2020-05-09T13:15:27.910Z] Smart Meter not found yet, trying another port / configuration...
[2020-05-09T13:15:27.913Z] Trying to connect to Smart Meter via port: /dev/ttyAMA0 (BaudRate: 115200, Parity: even, Databits: 7Stopbits: 1)
[2020-05-09T13:15:27.929Z] Smart Meter not found yet, trying another port / configuration...
[2020-05-09T13:15:27.932Z] Trying to connect to Smart Meter via port: /dev/ttyUSB0 (BaudRate: 115200, Parity: none, Databits: 8Stopbits: 1)
[2020-05-09T13:15:27.959Z] Serial connection established
[2020-05-09T13:15:57.950Z] Smart Meter not found yet, trying another port / configuration...
[2020-05-09T13:15:57.954Z] Trying to connect to Smart Meter via port: /dev/ttyUSB0 (BaudRate: 115200, Parity: even, Databits: 7Stopbits: 1)
Could not find a Smart Meter

When I use ls -l /dev/ttyUSB* i got this, I think this mean there is a USB connected; crw-rw---- 1 root dialout 188, 0 May 9 14:07 /dev/ttyUSB0

And when I connect via cu -l /dev/ttyUSB0 -s 9600 --parity=none i can "read" the smartmeter;

Connected.
/XMX5XMXABCE100108053

0-0:96.1.1(4B414145303031343131373232313133)
1-0:1.8.1(03432.896*kWh)
1-0:1.8.2(03492.086*kWh)
1-0:2.8.1(02243.242*kWh)
1-0:2.8.2(05196.924*kWh)
0-0:96.14.0(0001)
1-0:1.7.0(0000.00*kW)
1-0:2.7.0(0001.34*kW)
0-0:96.13.1()
0-0:96.13.0()
0-1:96.1.0(3238303131303038333237303137303133)
0-1:24.1.0(03)
0-1:24.3.0(200509150000)(08)(60)(1)(0-1:24.2.0)(m3)
(05933.694)
!

I hope this makes sense ;) and hopefully you have any tips how to fix this.

ruudverheijden commented 4 years ago

Hi Thomas,

Based on your "cu" command I see you are using a baud rate of 9600, which is not in the config so it won't auto discover your smart meter.

Can you try adding

{
        "port": "/dev/ttyUSB0",
        "baudRate": 9600,
        "parity": "none",
        "dataBits": 7,
        "stopBits": 1
    }

to the "serialPort" array in /config/config.json file?

tdwesten commented 4 years ago

Hi Ruud, Thanks for your response. After adding the smartmeter to the config.json i got this response;

[2020-05-11T18:41:26.115Z] Available serial ports with possible configurations:
[
    {
        "port": "/dev/ttyAMA0",
        "baudRate": 115200,
        "parity": "none",
        "dataBits": 8,
        "stopBits": 1
    },
    {
        "port": "/dev/ttyAMA0",
        "baudRate": 115200,
        "parity": "even",
        "dataBits": 7,
        "stopBits": 1
    },
    {
        "port": "/dev/ttyAMA0",
        "baudRate": 9600,
        "parity": "none",
        "dataBits": 7,
        "stopBits": 1
    },
    {
        "port": "/dev/ttyUSB0",
        "baudRate": 115200,
        "parity": "none",
        "dataBits": 8,
        "stopBits": 1
    },
    {
        "port": "/dev/ttyUSB0",
        "baudRate": 115200,
        "parity": "even",
        "dataBits": 7,
        "stopBits": 1
    },
    {
        "port": "/dev/ttyUSB0",
        "baudRate": 9600,
        "parity": "none",
        "dataBits": 7,
        "stopBits": 1
    }
]
[2020-05-11T18:41:26.133Z] Trying to connect to Smart Meter via port: /dev/ttyAMA0 (BaudRate: 115200, Parity: none, Databits: 8Stopbits: 1)
[2020-05-11T18:41:26.211Z] Smart Meter not found yet, trying another port / configuration...
[2020-05-11T18:41:26.215Z] Trying to connect to Smart Meter via port: /dev/ttyAMA0 (BaudRate: 115200, Parity: even, Databits: 7Stopbits: 1)
[2020-05-11T18:41:26.229Z] Smart Meter not found yet, trying another port / configuration...
[2020-05-11T18:41:26.231Z] Trying to connect to Smart Meter via port: /dev/ttyAMA0 (BaudRate: 9600, Parity: none, Databits: 7Stopbits: 1)
[2020-05-11T18:41:26.237Z] Smart Meter not found yet, trying another port / configuration...
[2020-05-11T18:41:26.239Z] Trying to connect to Smart Meter via port: /dev/ttyUSB0 (BaudRate: 115200, Parity: none, Databits: 8Stopbits: 1)
[2020-05-11T18:41:26.265Z] Serial connection established
[2020-05-11T18:41:56.257Z] Smart Meter not found yet, trying another port / configuration...
[2020-05-11T18:41:56.260Z] Trying to connect to Smart Meter via port: /dev/ttyUSB0 (BaudRate: 115200, Parity: even, Databits: 7Stopbits: 1)
[2020-05-11T18:41:56.276Z] Smart Meter not found yet, trying another port / configuration...
[2020-05-11T18:41:56.279Z] Trying to connect to Smart Meter via port: /dev/ttyUSB0 (BaudRate: 9600, Parity: none, Databits: 7Stopbits: 1)
Could not find a Smart Meter

Still no luck..

ruudverheijden commented 4 years ago

Hi Thomas,

Hmm strange, I guess your smart meter has a different combination of BaudRate, Parity, DataBits and StopBits, that is not in the config list. When I look at your output via "cu" I see it DSMR2.2 version meter. That was one of the first generations of Smart Meters. I'm still working on improving support for that older version, but it's very difficult to find any good docs or details about those ones.

Someone else already created a nice overview of different meters with their serial port configs: http://domoticx.com/p1-poort-slimme-meter-hardware/

Can you check what meter brand and type you have? Hopefully that helps in finding the correct serial port config.

And if you find it, try adding it as the first item in the array, so it starts with that one first :)

ruudverheijden commented 4 years ago

Hi Thomas,

I've just finished version 2.0 in which I removed the auto-discover option since more people were having issue with that and it only adds complexity. And I've added some more stuff in version 2.0 :)

Can you try that version and let me know if it works?

Regards,

Ruud