Page 1 of 1
Protocol for P1 over LAN
Posted: Tuesday 02 February 2021 1:56
by willem9136
Where can I find documentation about the protocol to use between the Smartmeter and the P1 over Lan.
In other words what does Domoticz expect to see from the IP and Port as configured in the P1 over LAN sensor.
Re: Protocol for P1 over LAN
Posted: Tuesday 02 February 2021 11:50
by erem
Domoticz expects to see the full P1 telegram.
specs here:
https://www.netbeheernederland.nl/_uplo ... 566986.pdf
Re: Protocol for P1 over LAN
Posted: Tuesday 02 February 2021 22:43
by willem9136
Rob, this is not really my question.
I know what to supply to Domoticz using P1 via USB.
Also I wrote my own program in Python using MQTT and JSON to supply the data to Domoticz.
I changed the physical location of the system where Domoticz is running.
So now I want to use the P1 over LAN feature of Domoticz.
So the question is what should I build in order to supply the data over LAN.
I prefer to use an ESP12 and power it from the P1 port of the meter.
At the moment I have an ESP12 running and it supplies the data using the JSON methods.
So not using the P1 over LAN feature.
I hope you understand my question now.
Willem
Re: Protocol for P1 over LAN
Posted: Wednesday 03 February 2021 1:16
by waaren
willem9136 wrote: ↑Tuesday 02 February 2021 22:43
At the moment I have an ESP12 running and it supplies the data using the JSON methods.
Probably your best chance is to look at the
hardware sourcefiles and search for the P1Meter sources (.cpp and .h)
Just curious; why do you want to use another method then the JSON approach?
Re: Protocol for P1 over LAN
Posted: Wednesday 03 February 2021 10:53
by willem9136
Waaren, the reason I want to use the P1 over LAN is that I think the single sensors like GAS and POWER etc do not process the High and Low tarif.
Before I used the P1 over USB and the graphs showed nicely a 2 color graph for High and Low tarif.
I looked at the website of Thingies or something like that. It scarred me by seeing this very large amount of files they use to interface the data from the meter to the P1 over LAN sensor. There fore I am very curious to find the protocol needed for this.
Re: Protocol for P1 over LAN
Posted: Wednesday 03 February 2021 11:27
by waaren
willem9136 wrote: ↑Wednesday 03 February 2021 10:53
The reason I want to use the P1 over LAN is that I think the single sensors like GAS and POWER etc do not process the High and Low tarif.
If you look at the API call for Electricity P1 smart meter at
Domoticz API/JSON URL's wiki page you will see that High and Low tariff are taken into account.
/json.htm?type=command¶m=udevice&idx=IDX&nvalue=0&svalue=USAGE1;USAGE2;RETURN1;RETURN2;CONS;PROD
IDX = id of your device (This number can be found in the devices tab in the column "IDX")
USAGE1= energy usage meter tariff 1, This is an incrementing counter
USAGE2= energy usage meter tariff 2, This is an incrementing counter
RETURN1= energy return meter tariff 1, This is an incrementing counter
RETURN2= energy return meter tariff 2, This is an incrementing counter
CONS= actual usage power (Watt)
PROD= actual return power (Watt)
USAGE and RETURN are counters (they should only count up).
For USAGE and RETURN supply the data in total Wh with no decimal point.
(So if your meter displays f.i. USAGE1= 523,66 KWh you need to send 523660)
For Gas I am not aware of such a variation in tariff based on time of day
Re: Protocol for P1 over LAN
Posted: Wednesday 03 February 2021 11:29
by FireWizard
Hi,
The protocol is exactly the same as for the P1 meter for USB.
It can be found at:
https://www.netbeheernederland.nl/dossi ... documenten.
E.g. it can be used with ser2net:
https://www.jpaul.me/2019/01/how-to-bui ... h-ser2net/
Read also this:
viewtopic.php?t=17238
Regards
Re: Protocol for P1 over LAN
Posted: Wednesday 03 February 2021 11:49
by erem
Willem,
instead of going the difficult route of writing your own code for the esp12, i would strongly suggest you look into espeasy.
there is a plugin P1 wifi gateway that does exactly what you want.

- 03-02-2021 11-21-31.jpg (101.39 KiB) Viewed 6896 times

- 03-02-2021 11-21-31.jpg (101.39 KiB) Viewed 6896 times
Re: Protocol for P1 over LAN
Posted: Wednesday 03 February 2021 15:29
by willem9136
I’m still not happy with all the answers.
I will try to make my question as simple as possible.
Look at the screen dump Rob send in the previous item. You see there is an IP and a port number.
My question is: What is this 10.0.0.101 port 8888 for kind of thing?
Is it an ESP or PI? What does it do with the data coming from the Meter?
What network protocol is used to send it to Domoticz?
It’s a total black box what is sitting in between Domoticz and the Meter.
I hope I’m clear now....
Willem
Re: Protocol for P1 over LAN
Posted: Wednesday 03 February 2021 15:57
by erem
willem9136 wrote: ↑Wednesday 03 February 2021 15:29
I’m still not happy with all the answers.
I will try to make my question as simple as possible.
Look at the screen dump Rob send in the previous item. You see there is an IP and a port number.
My question is: What is this 10.0.0.101 port 8888 for kind of thing?
Is it an ESP or PI? What does it do with the data coming from the Meter?
What network protocol is used to send it to Domoticz?
It’s a total black box what is sitting in between Domoticz and the Meter.
I hope I’m clear now....
Willem
here we go
My question is: What is this 10.0.0.101 port 8888 for kind of thing? This is a esp8266 running ESPEasy
What network protocol is used to send it to Domoticz? it is based on ser2net, so it takes the serial output from the P1 port and sends it out via the network. domoticz receives that as if text was sent in directly via a P1 usb cable.
since most meters send the output inverted, a simple transistor inverter corrects that.
like this

- P1 Inverter with BC547.gif (9.67 KiB) Viewed 6875 times
Re: Protocol for P1 over LAN
Posted: Wednesday 03 February 2021 16:31
by willem9136
We are getting close.
So, from the meter you go to the inverter. (So do I)
From the inverter you go into ser2net.
On the Domoticz side there is also a ser2net I suppose. (Call it net2ser).
From this ser2net you get serial data.
You can feed this via an FTDI directly into the P1 to USB.
So why are you configuring the P1 over LAN?
Re: Protocol for P1 over LAN
Posted: Wednesday 03 February 2021 18:34
by erem
willem,
from the meter to the inverter
from the inverter to the esp8266 running espeasy, that published the telegram on the chosen port
domoticz receives from the esp8266 ip/port and processes the data
no ftdi, no usb
Re: Protocol for P1 over LAN
Posted: Wednesday 03 February 2021 20:16
by willem9136
Ok! Clear! Now I can work on this.
Thanks Rob.