P1 electrical smart meter reader
-
About one month ago I got a new electrical meter in the house. The new meter is a "smart" meter equipped with a data port. It is more or less the same type of meter that is used in a number of European countries, e.g. The Netherlands, Belgium, Sweden etc.
Norway has selected a different version with a RJ45 port with another protocol.The dataport is a serial "P1" port in the form of a RJ12 contact that sends quite a lot of data every 10 seconds:
The data will show both consumption and production if you e.g. have solar panels at home.
My initial though was to use the Tasmota P1 Smart Meter with Mqtt. I tried this and it works, but unfortunately I got some serial data errors every 5-10th message for some reason so I decided to try another solution.
I found a few other alternatives and tested one of them. The upside with this version is that it is adapted to the Swedish data fomat that differs from the Dutch a bit and that it delivers the data in Mqtt form:
The hardware is pretty simple. For the Tasmota variant and most of the other solutions you need a ESP8266, e.g. a Wemos mini and then a transistor and two resistors (image below). The version I use is even simpler since it does not need the transistor.
For a lot of the meters delivered (DSMR 5 versions if I am right) you can power the ESP from the 5V provided in the RJ12 port, very handy.It is also possible to buy a readymade P1 meter, this one looks quite nice, although I have not tested it.
In order to get a good overview of the data from the meter I have started creating a dashboard in Grafana that gets data from Historian in OpenLuup. It is quite useful to be able to see the load over time per phase etc.
I also managed to grab the hourly prices in json format and display that in the dashboard via some lua code in a scene.
At the moment I have built no logic around this, but it opens up posibilities for sure. In Sweden the electrical tarrifs will change from daily rates to being higher when demand is higher, perhaps then this can be used.
All in all a fun DIY project that provides some useful data out of the electrical meter.
-
@archers Wow, this will be my next project. Getting live data directly from the meter instead of polling a cloud api for my solar panels that only shows current production, not knowing if we use, sell or buy extra.
Thank you for sharing!
-
@crille said in P1 electrical smart meter reader:
instead of polling a cloud api for my solar panels that only shows current production, not knowing if we use, sell or buy extra.
Yes that would be pretty easy to see with the data from the P1 port, and especially useful if you have solar panels.
You need to get your provider to activate the port, for me it was just a telephone call and then it was active a few hours later.I do not use Home Assistant (yet!), but if you do there are a number what seems like quite nice integrations for energy.
To grab data into Home Assistant from the P1 port I would try this software.
You can get the prices from Nordpool with ready built integrations.
Also there is a quite nice graphic representation of consumption vs production in the form of a power wheel that could be suitable for solar panels.A nice source of information for us that speak Swedish is available in this forum thread.
-
Hi,
There is a plugin for this already. See https://github.com/reneboer/Vera-Dutch-Smartmeter . In the user Guide you can find details on the cable you need and how to install on openLuup. This only reads the data for you, the graphs is a separate to-do.
Cheers Rene
-
@mrfarmer you are of course correct!
Sorry for missing out on that in my post.
In my case I choose not to use the plugin because I have the electrical meter cabinet on the outside of the house, so the 5V parasite power from the meter together with wifi was the easiest way for me to set it up.
However if one would have the electrical meter inside the house the cable solution and your plugin seems really nice and easy! -
Even if you got the interface slightly different, the plugin should work with little or no changes.
-
Thanks guys, Yes I read the thread in the Swedish forum yesterday and are about to order some hardware. My meter and provider seems easy and helpful to connect/activate the port.
I'm also not using Home Assistant yet so I'll see how I'm going to do the integration/presentation later. -
A small status update on the smart meter reading project.
I have been running the solution above together with OpenLuup and Grafana and in general it works nicely. It has crashed on a few occations, not sure why.
This week I decided to test Home Assistant just to see how it works. When up and running I thought I could just as well try playing around a bit with the P1 meter reporting also.
I managed to set up Home Assistant to use the Mqtt broker on OpenLuup by adding this into the Configuration.yaml:
mqtt: broker: ipaddress port: 1883 username: user password: passwd
After restarting HA it is easy to check that it works by going to the Mqtt integration where it you can listen to topics and publish packets on the server. Use MqttExplorer to see what happens on the server.
Next step is to add the sensors for the P1 meter data into the Configuration.yaml file, just to copy-paste from the github repo. To keep down the load I only added the sensors I use.
Then just create graphs etc on the dashboard.
Since I had HA up and running I also decided to try out an ESPHome solution that is very popular in Sweden. I managed to install this on my second ESP and when connected to the meter it imediately started to report data into HA. No configuration required for this one, all sensors are added automatically, nice.
Next thing I wanted to test was the HA integration for grabbing hourly prices from Nordpool.
For this I discovered I needed to set up "HACS", a good instruction is here.With this in place just add the Nordpool integration and restart.
Next step how to get some nice graphs? I found a good guide here.
We will see what solution I will use, one possibility is to run both ESP's via a splitter on the meter.
-