[![codebeat badge](]( [![Build Status](]( [![](]( [![](](

# P1 Parser

Parses telegram's as they are output through the P1 serial port of a smartmeter

Note that this only applies to Dutch smartmeters. 

## Installation

def deps do
    {:p1_parser, "~> 0.1.9"}

## Usage 

Get a usb to p1 cable and plug it in, you should see it appear as a serial device

On an raspberry pi it will show up as `/dev/ttyUSB0`, now the smartmeter will ouput a telegram every 10 seconds

use a serial libray like `nerves_uart` to connect to it and receive telegrams

each line in the telegram can now be parsed like this
iex> P1.parse!("1-0:1.8.1(123456.789*kWh)") |> P1.to_struct
Which will result in
%P1.Telegram.TotalEnergy{direction: :consume, tariff: :low, unit: "kWh", value: 123456.789}

## Documentation 

The docs can be found at [](

## Contribute

`|> fork |> feature branch |> pull request`

## Reference 

I used as a reference

## Todo's

 - ~~Parse units~~
 - ~~Parse Summer/Winter time information in timestamp~~
 - ~~return structs~~
 - ~~Convert timestamps to proper date/times~~
 - Parse entire telegram
 - Validate checksum