ParseP1

Build Status

Basic parser for P1 Companion Standard used by Dutch Smart Meters.

Library is by no means complete (yet), it is now implemented only on one real example of a so called Dutch smart meter, in this case a Iskra MT382.

Example of P1 data


/ABc1\\1AB123-4567

0-0:96.1.1(1A123456789012345678901234567890)  
1-0:1.8.1(00136.787*kWh)  
1-0:1.8.2(00131.849*kWh)  
1-0:2.8.1(00000.000*kWh)  
1-0:2.8.2(00000.000*kWh)  
0-0:96.14.0(0002)  
1-0:1.7.0(0003.20*kW)  
1-0:2.7.0(0000.00*kW)  
0-0:17.0.0(0999.00*kW)  
0-0:96.3.10(1)  
0-0:96.13.1()  
0-0:96.13.0()  
0-1:24.1.0(3)  
0-1:96.1.0(1234567890123456789012345678901234)  
0-1:24.3.0(120502150000)(00)(60)(1)(0-1:24.2.1)(m3)  
(00092.112)  
0-1:24.4.0(1)  
!

Usage


p1 = ParseP1::Base.new(p1_string)

p1.electra_meter_id                                  #-> 1A123456789012345678901234567890
p1.electricity(:type => :import, :tariff => :normal) #-> 116.34 (kWH)
p1.electricity(:type => :import, :actual => :true)   #-> 1245   (watt)

or with the direct methods: electra_import_normal, electra_import_low, electra_export_normal and electra_export_low

and for gas:

p1.gas_usage                                         #-> 91.224 (m3)

See tests for futher available methods

Running tests

First install libraries with:


bundle

Test with


bundle exec rake test 

or


bundle exec guard

Caveats

  • Library is by no means complete (yet), it is now implemented only on one real example of a so called Dutch smart meter. In this case a Iskra MT382 (see docs and (manuals)) delivered by Liander.
  • See ReadP1 Arduino library, which is used for posted the P1 data to a Ruby on Rails application.
  • Although P1 should be a standard, it is known there are different implementations in the Netherlands alone.
  • The library is implemented on the base of one long string received by a Ruby on Rails application. Parsing a text file will fail!

Documentation

See Datalogging van "slimme meters" in Dutch

See P1 Companion Standard Version 2.2 April 18th 2008 from Enbin (also in docs directory)

See Representation of P1 telegram P1 Companion Standard Version 4.0 from Netbeheer Nederland (also in docs directory)

Contributing to ParseP1

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2012 Frank Oxener - Agile Dovadi BV. See LICENSE.txt for further details.