Issue with reading smart meter P1 in Home assistant

Moderator: leecollings

Post Reply
Richo999
Posts: 3
Joined: Thursday 14 November 2019 17:17
Target OS: Linux
Domoticz version:
Contact:

Issue with reading smart meter P1 in Home assistant

Post by Richo999 »

Hello Everyone! hopefully anyone is able to help me with a issue I am having with reading out my smart meter.
I own a Landis E350 with a smart meter cable from https://www.sossolutions.nl/slimme-meter-kabell its a verified cable for my smart meter. It is connected to my ESXI server in the basement (I extended the RJ-11). on the ESXI I have a Ubuntu64 with Home assistant for logging the data. I had some issues setting up home assistant, because of a known bug with Nginx in the configurator which I resolved by editing the config.yaml through SSH.
I used the following code:

sensor:
- platform: dsmr
port: /dev/ttyUSB0
dsmr_version: 4

group:
meter_readings:
name: Meter readings
entities:
- sensor.power_consumption_low
- sensor.power_consumption_normal
- sensor.power_production_low
- sensor.power_production_normal
- sensor.gas_consumption

As far as I can tell there is a connection, I verified this in SSH with the following command line:
cu -l /dev/ttyUSB0 -s 115200 --parity=none -E q

At first I got a Permission denied but with this following code I resolved the issue.

chmod 666 /dev/ttyUSB0

At this point I am able to establish a connection however not much more beside the following:

cu -l /dev/ttyUSB0 -s 115200 --parity=none -E q
Connected.

it should output data but it times out after some time. Anyone got a idea how to resolve this issue?
User avatar
FireWizard
Posts: 1967
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Issue with reading smart meter P1 in Home assistant

Post by FireWizard »

Hi,

It is good to know that this forum supports Domoticz and so it might be, that active users here, have less knowledge about Hass then active users in the Hass forum. However this topic is not only a Hass issue.

First.
Since, at least, 2017, the Landis & Gyr E350 supports DSMR 5. So maybe you have to change your config file to dsmr_version: 5.

Second.

You said
(I extended the RJ-11)
This is a serial cable and you cannot extend this cable unlimited.
The RS-232 standard has been specified in 1960.The RS-232C dates from 1969. The maximum length has been specified as 15 meters (50 feet) for transmission speeds of up to 19.200 Bd. The standard has been developed for speeds up to 20kbps.
However it is often used for higher speeds, but this has effect on the maximum length.
In this case you should use the following maximum cable length:

Bit Rate Bus Length
115200 bit/s 2.5 m
57600 bit/s 5.0 m
38400 bit/s 7.5 m
19200 bit/s 15 m
9600 bit/s 30 m

So check the connection first, with a laptop and a terminal program, within 2.5m from your smart meter. If this works you can continue.
The serial connection might work on longer distances, but there is no guarantee.
Please post your results,

Regards
Richo999
Posts: 3
Joined: Thursday 14 November 2019 17:17
Target OS: Linux
Domoticz version:
Contact:

Re: Issue with reading smart meter P1 in Home assistant

Post by Richo999 »

FireWizard wrote: Thursday 14 November 2019 18:39First.
Since, at least, 2017, the Landis & Gyr E350 supports DSMR 5. So maybe you have to change your config file to dsmr_version: 5.

Second.

You said
(I extended the RJ-11)
This is a serial cable and you cannot extend this cable unlimited.
The RS-232 standard has been specified in 1960.The RS-232C dates from 1969. The maximum length has been specified as 15 meters (50 feet) for transmission speeds of up to 19.200 Bd. The standard has been developed for speeds up to 20kbps.
However it is often used for higher speeds, but this has effect on the maximum length.
In this case you should use the following maximum cable length:

Bit Rate Bus Length
115200 bit/s 2.5 m
57600 bit/s 5.0 m
38400 bit/s 7.5 m
19200 bit/s 15 m
9600 bit/s 30 m

The cable itself is 1.8m and the extension RJ-11 is 2,5m
So check the connection first, with a laptop and a terminal program, within 2.5m from your smart meter. If this works you can continue.
The serial connection might work on longer distances, but there is no guarantee.
Please post your results,

Regards
connected directly to a laptop with the smart meter cable (without the extension), I get proper read out. can I presume the cable just doesn't like to get extended? It borrowed this laptop from a friend some time ago to do some other stuff. the only thing I changed to was plug in the smart meter cable and used:
chmod 666 /dev/ttyUSB0
cu -l /dev/ttyUSB0 -s 115200 --parity=none -E q
User avatar
FireWizard
Posts: 1967
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Issue with reading smart meter P1 in Home assistant

Post by FireWizard »

Hi,

I understand that without the extension cable, you see the P1 smart meter protocol.
So let' s focus on the extension cable.

You cannot assume that the smart meter cable cannot be extended.

Check your extension cable, regarding the following:
1. Is the RJ-11/12 extension cable a straight cable and are all 6 wires connected?
2. The Landys & Gyr E350 requires a 1 kohm pull-up resistor, between Vcc and RxD.
Your P1 cable will have that, but if your extension cable is incomplete, you have a problem.

Measure the RJ-11/12 cable with a multimeter.
See: https://www.google.com/search?q=P1+smar ... Kj2uUrM%3A

Regards
Last edited by FireWizard on Friday 15 November 2019 19:06, edited 1 time in total.
Richo999
Posts: 3
Joined: Thursday 14 November 2019 17:17
Target OS: Linux
Domoticz version:
Contact:

Re: Issue with reading smart meter P1 in Home assistant

Post by Richo999 »

FireWizard wrote: Thursday 14 November 2019 22:29 Hi,

I understand that without the extension cable, you see the P1 smart meter protocol.
So let' s focus on the extension cable.

You cannot assume that the smart meter cable cannot be extended.

Check your extension cable, regarding the following:
1. Is the RJ-11/12 extension cable a straight cable and are all 6 wires connected?
2. The Landyd & Gyr E350 requires a 1 kohm pull-up resistor, between Vcc and RxD.
Your P1 cable will have that, but if your extension cable is incomplete, you have a problem.

Measure the RJ-11/12 cable with a multimeter.
See: https://www.google.com/search?q=P1+smar ... Kj2uUrM%3A

Regards
after reading this I figured that the 1kohm resistor might be a possible culprit so I went through my old cable "storage" (garbage) pile and discovered a 2m usb 2.0 extender, this solved my whole issue. thanks for the help!
User avatar
PA5UL
Posts: 2
Joined: Tuesday 26 January 2021 9:42
Target OS: -
Domoticz version:
Contact:

Re: Issue with reading smart meter P1 in Home assistant

Post by PA5UL »

Hi, similar challenge here. My E350 has an 8-pin P1 port. I need to connect it (either via USB or via the home network) to the NUC PC running Home Assistant, which is situated at a distance of some 5m in a straight line or about 10m if I run a cable in a way my wife will accept. What options do I have?
2021-01-26 11.29.36.jpg
2021-01-26 11.29.36.jpg (84.1 KiB) Viewed 3219 times
"Try and leave the world a little better than you found it" [BP]
"Improve the world, start with yourself..." [saying]
"... but don't stop there and help others improve too! [me]
73 de PA5UL
User avatar
erem
Posts: 230
Joined: Tuesday 27 March 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Amsterdam/netherlands
Contact:

Re: Issue with reading smart meter P1 in Home assistant

Post by erem »

@PA5UL

one option is using a Wemos D1 in combination with ESPEasy to move the data to domoticz via wifi/ethernet

https://www.pe1rqm.nl/slimme-meter-uitl ... a-systeem/

it's dutch, but google translate is your friend if you do not speak dutch
Regards,

Rob
User avatar
PA5UL
Posts: 2
Joined: Tuesday 26 January 2021 9:42
Target OS: -
Domoticz version:
Contact:

Re: Issue with reading smart meter P1 in Home assistant

Post by PA5UL »

By chance I happened on this old post. Mni tnx om Tjalling but in the mean time I've found another option that works very wel for me. I use a P1 dongle by Home Wizard (€25) which integrates really well into Home Assistant. I can monitor in real time for all 3 phases separately what I use or produce. This info helps met toggle smart switches for several 'dumb' users so I can optimise the amount of energy I use from my solar panels.
"Try and leave the world a little better than you found it" [BP]
"Improve the world, start with yourself..." [saying]
"... but don't stop there and help others improve too! [me]
73 de PA5UL
manjh
Posts: 859
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Issue with reading smart meter P1 in Home assistant

Post by manjh »

I've run into some questions with the P1 meter plugins.
Until now I have used a simple ESP unit with an RJ11 cable attached, connecting to "P1 smart meter with LAN interface" in Domoticz.
A little while ago I have bought the HomeWIzard P1 dongle, and attached it with a simple RJ11 splitter, connection to the HomwWIzard WiFi P1 meter plugin.
I now have both running and am comparing some of the values.

The L1 power usage (phase 1) power usage shows 215 Watt in the ESP unit, and 2160 in the HomeWIzard. So it's a factor 10 off. Looks like some other values are off as well.
Does this sound familiar?
I have not compared all values yet.
Hans
manjh
Posts: 859
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Issue with reading smart meter P1 in Home assistant

Post by manjh »

Anyone?
I use the values to determine if there is any power left to charge my car, for instance. So it is essential that I have the values correct.

The array that comes out of both units shows 6 entries: four meter readings, going in and out, in two time ranges, then two showing current.
The sixth value is a factor 10 higher in the HomeWizard unit compared to the "P1 meter with LAN interface" unit.
Purely based on my instinct, I think the lower value is correct (so the HomeWizard value is too high).

Does anyone have an opinion on this?

Once I am sure, it is not difficult to make the correction, of course.
Hans
User avatar
waltervl
Posts: 6677
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Issue with reading smart meter P1 in Home assistant

Post by waltervl »

When you press on the green button on your real smart meter in your home, you can see the real values real time on the meters display. You can compare those with the values read by homewizard and Domoticz
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
manjh
Posts: 859
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Issue with reading smart meter P1 in Home assistant

Post by manjh »

Thanks, that is an excellent suggestion, should have done that in the first place!
Comparing the values to what I can see in Domoticz, I found out that the actual usage from the HomwWizard dongle is indeed a factor 10 too high.
This is my setup:
Smartmeter-->ESPunit-P1-->P1 smart meter with LAN interface--> Domoticz device: value matches the reading on the meter
Smartmeter-->HomeWizard dongle-->HomeWIzard Wifi P1 meter-->Domoticz device: value is a factor 10 too high
I downloaded the HomeWizard Android app and checked: here the value is correct, matching the meter readout.
So I think the error is in the plugin... agree?
Hans
User avatar
waltervl
Posts: 6677
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Issue with reading smart meter P1 in Home assistant

Post by waltervl »

Agree, that seems to be an issue in the HomeWizard plugin
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest