https://github.com/gertjana/p1_parser
Parses Smartmeter P1 telegrams
https://github.com/gertjana/p1_parser
elixir-lang p1 smartmeter
Last synced: 8 months ago
JSON representation
Parses Smartmeter P1 telegrams
- Host: GitHub
- URL: https://github.com/gertjana/p1_parser
- Owner: gertjana
- License: other
- Created: 2018-10-06T18:45:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-20T10:45:17.000Z (over 6 years ago)
- Last Synced: 2025-10-09T19:32:20.169Z (8 months ago)
- Topics: elixir-lang, p1, smartmeter
- Language: Elixir
- Homepage:
- Size: 72.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://codebeat.co/projects/github-com-gertjana-p1_parser-master) [](https://travis-ci.org/gertjana/p1_parser) [](https://hex.pm/packages/p1_parser) [](https://hex.pm/packages/p1_parser)
# 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
```elixir
def deps do
[
{:p1_parser, "~> 0.2.2"}
]
end
```
## 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 x seconds
use a serial libray like for instance `nerves_uart` to connect to it and receive telegrams
each line in the telegram can now be parsed like this
```elixir
iex> P1.parse!("1-0:1.8.1(123456.789*kWh)")
```
Which will result in
```
[
%P1.Channel{channel: 0, medium: :electricity},
%P1.Tags{tags: [:total, :energy, :consume, :low]},
[%P1.Value{unit: "kWh", value: 123456.789}]
]
```
## Documentation
The docs can be found at [https://hexdocs.pm/p1_parser](https://hexdocs.pm/p1_parser).
## Contribute
`|> fork |> feature branch |> pull request`
## Reference
I used https://www.netbeheernederland.nl/_upload/Files/Slimme_meter_15_a727fce1f1.pdf 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