We have moved at community.getvera.com

Author Topic: New plugin for reading the gas and electricity usage from a Dutch Smart meter  (Read 104746 times)

Offline bfromdruten

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
I just finished a basic plugin for Vera to read electricity and gas usage using the P1 port found on the new Dutch smart meters.

To use the plugin you have to connect the P1 port to your Vera. This can be done with a  5 Volt cable from FTDI (TTL-232R-5V-WE) which can he bought here http://www.antratek.nl/USB-adapter.html

The P1 port uses a reversed serial protocol so your need to reverse the RX pin. This can be done using the FTDI tool known as FT_PROG  found here http://www.ftdichip.com/Support/Utilities.htm (thanks to Verkenner on the domoticaforum). Don't  forget to Cycle port after programming.

Connect a RJ11 plug to the FTDI cable using the layout:
pin2=Red(Request=+5Volt)
pin3=black (GND)
pin5=Yellow(Data)

Upload the following files using the UI5 GUI (apps=>develop apps=>Luup files):
   - D_dutchSmartMeter.json
   - D_dutchSmartMeter.xml
   - I_dutchSmartMeter.xml
   - S_dutchSmartMeter.xml
Create a new device using apps=>develop apps=>Create device. Use D_dutchSmartMeter.xml as Upnp Device Filename and enter the device name at the field Description (e.g. meterkast). Click create device and wait till the device shows on the dashboard.

After the device is created you have to configure the serial port. First attach the cable. Go to apps=>develop apps=>serial port configuration and select the correct USB device. Set the serial parameters to 9600,even,7bits,1stop bit
In the dropdown box select the name you used creating your device.

After a short while the plugin should show the electricity and gas meter values and actual usage.

For more information see:
http://www.maartendamen.com/2012/04/new-smart-meter-installed-iskra-me382-and-landis-gyr-gasmeter-e06140/
http://www.domoticaforum.eu/viewtopic.php?f=71&t=6104&hilit=smart+meter+p1&start=30

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3260
  • Karma: +192/-9
Awesome work.  (I wish the smart meters here were as easy to interface with!)

This looks like a Linux tool that you might be able to use to configure the Invert RXD bit in the EEPROM of the FTDI chip.

Offline Thiemen

  • Jr. Member
  • **
  • Posts: 85
  • Karma: +0/-0
Nice work!

I already read the post on the blog, now all i have to do is wait for a new smartmeter to be installed ;-)

Offline cmbeek

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
This sounds very promissing. So I can connect the dutch smartmeter to my veralight usb-port?
RJ11 usually has 4 wires. How can I connect it to pins 2,3 and 5?
Is in/reverting the RX pin difficult? Manual looks complicated for a non-electrician.....

Thanks for sharing this feature!!!



Offline cmbeek

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
Two questions that crossed my mind:
How does the plugin handle production of (solar) energy?
How does the plugin handle Dutch double meters?

Offline bfromdruten

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
@cmbeek:
You have to make one-end of the cable yourself, but using the cable mentioned this is an easy job. You only need 3 wires because nothing is done with tx

Besides the gas meter, the plugin actualy reads four different electric meter values. The amount used and the amount delivered back to the net. Both the low-rate values and high-rate values (so four in total). Currently the plugin creates one total and displays/stores this value. In future versions it would be nice to split the four meters. The plugin currently also knows if it is using the low-rate or high-rate, but nothing is done with it. If the plugin would know the kwh price, it could calculate your electricity bill.

Now only have to wait for the new UI5 datamine plugin to make some nice charts!

Offline cmbeek

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
@bfromdruten: You have convinced me!. I have just ordered the required cable. Hopefully by next week i will be abel to see my electricity and gas meter values on my vera. Can't wait......

Offline Jackpost

  • Sr. Newbie
  • *
  • Posts: 46
  • Karma: +0/-0
Received cable today...Works Great....

This is a cheaper and more accurate solution than my Envir.

Any chance modifying the plugin to show the 4 individual values instead of 1 total?

Thanks

Offline cmbeek

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
I received the cable today. Reversing serial protocol was easy. The plugin is now showing watts and kWh's.
The gas value is still showing zero m3's.

To be clear: The plugin is showing the sum of to values of electricity intake from the net. It does not subtract(or show) the  (solar)electricity delivered to the net.

A plugin showing the 4 seperate values of take-in and production would indeed be a welcome improvement.
I studied the code myself, but I could not make anything of it.



Offline bfromdruten

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
@cmbeek I will try this week to modify the plugin by creating child devices for each value.
Is your gas meter connected to your electrical meter? Can you send me your plugin logging?

Offline cmbeek

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
@bfromdruten The gas meter is not connected to the electrical meter by wire, but they "communicate" wireless.
As soon as a I figure out how to get tot the logfiles i will send you my plugin logging.

Offline cmbeek

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
@bfromdruten
Below is the data I finally found in de logfiles. The current plugin displays de sum of the two values in bold.
I would be very pleased if there would be a plugin creating device(s) displaying all available values.

50   "   06/13/12"   8:59:12.07   "3   luup_log:60: MeterType: [XMX5XMXABCE000018061] <0x2e935680>"   
50   "   06/13/12"   8:59:12.12   "3   luup_log:60: Meter data: ""0-0:96.1.1(39373936353039382020202020202020)"" <0x2e935680>"   
50   "   06/13/12"   8:59:12.16   "4   luup_log:60: Power meter import rate 1: 180.577000 <0x2e935680>"   
50   "   06/13/12"   8:59:12.17   "3   luup_log:60: Power meter import rate 2: 122.484000 <0x2e935680>"   
50   "   06/13/12"   8:59:12.21   "0   luup_log:60: Power meter export rate 1: 133.324000 <0x2e935680>"   
50   "   06/13/12"   8:59:12.23   "3   luup_log:60: Power meter export rate 2: 232.075000 <0x2e935680>"   
50   "   06/13/12"   8:59:12.25   "3   luup_log:60: Currently active tariff: [0002] <0x2e935680>"   
50   "   06/13/12"   8:59:12.27   "3   luup_log:60: CurrentWatts: [00000.00] <0x2e935680>"   
50   "   06/13/12"   8:59:12.32   "2   luup_log:60: Meter data: ""1-0:2.7.0(00000.00*kW)"" <0x2e935680>"   
50   "   06/13/12"   8:59:12.32   "4   luup_log:60: Meter data: ""0-0:17.0.0(999*A)"" <0x2e935680>"   
50   "   06/13/12"   8:59:12.33   "3   luup_log:60: Meter data: ""0-0:96.3.10(1)"" <0x2e935680>"   
50   "   06/13/12"   8:59:12.35   "3   luup_log:60: Meter data: ""0-0:96.13.1()"" <0x2e935680>"   
50   "   06/13/12"   8:59:12.37   "3   luup_log:60: Meter data: ""0-0:96.13.0()"" <0x2e935680>"   
50   "   06/13/12"   8:59:12.37   "3   luup_log:60: Meter data: ""!"" <0x2e935680>"   

Offline bfromdruten

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
@cmbeek: looking at your log, it looks like the gas reading is not send to your meter. I will create a new plugin version with more logging.

Offline bfromdruten

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Hi all,

Attached a new version. With this version separate PowerMeter devices are created for each tariff (import / export). Using the active tariff the current usage is distributed. Gas usage is still registered at the ' master'  device. Good luck.


Offline cmbeek

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
@bfromdruten: Thanks a million!! Works the way I want it to work. Excellent job!!
I spend half of yesterday studying the code myself, but it would have taken weeks before I would have gotten as far a you did.