Comments (4)
Hi Nigel, can you possibly also add an example how to parse a string-based telegram into a dictionary? Using Dennis' DSMR-reader I've split the datalogger-part using his API-example, so I can use the raw data also towards another system, but his implementation delivers a string with the telegram. Thanks!
from dsmr_parser.
I read my smartmeter over TCP. I do this using a small script that has two coroutines. The first connects to a socket and pushes the parsed telegram onto queue. The second coroutine pushes the data that I find relevant onto a MQTT broker.
This might be a helpful example for @dajappie and others.
It could use some cleanup. The current version of that script is available in a gist
from dsmr_parser.
In the tests are various examples, is that what you mean?
https://github.com/ndokter/dsmr_parser/blob/master/test/test_parse_v5.py
Snippet of it:
# It's a single string, just formatted differently for readability
telegram_str = (
'/ISk5\2MT382-1004\r\n'
'\r\n'
'0-0:96.1.1(00000000000000)\r\n'
'1-0:1.8.1(00001.001*kWh)\r\n'
'1-0:1.8.2(00001.001*kWh)\r\n'
'1-0:2.8.1(00001.001*kWh)\r\n'
'1-0:2.8.2(00001.001*kWh)\r\n'
'0-0:96.14.0(0001)\r\n'
'1-0:1.7.0(0001.01*kW)\r\n'
'1-0:2.7.0(0000.00*kW)\r\n'
'0-0:17.0.0(0999.00*kW)\r\n'
'0-0:96.3.10(1)\r\n'
'0-0:96.13.1()\r\n'
'0-0:96.13.0()\r\n'
'0-1:24.1.0(3)\r\n'
'0-1:96.1.0(000000000000)\r\n'
'0-1:24.3.0(161107190000)(00)(60)(1)(0-1:24.2.1)(m3)\r\n'
'(00001.001)\r\n'
'0-1:24.4.0(1)\r\n'
'!\r\n'
)
parser = TelegramParser(telegram_specifications.V2_2)
result = parser.parse(telegram_str)
Currently theres no auto version detection so youll have to supply a 'specification' dict for the DSMR version that tells the parser how to parse it.
I've expiremented with detecting it (https://github.com/ndokter/dsmr_parser/blob/issue_22/dsmr_parser/parsers.py#L97), but haven't finished it yet.
If you have troubles in building the telegram string itself from the serial stream, then check out the TelegramBuffer object. It's a small helper class that you can put data into and get complete telegram strings out of. Theres a small usage example in SerialReader.read
from dsmr_parser.
Cool, that's it! Thanks! No real need for autodetection, standard DSMR 4 output so it'll be fine
from dsmr_parser.
Related Issues (20)
- OBIS reference filter help HOT 7
- Possible bug in FileReader HOT 1
- dsmr_parser.exceptions.ParseError: ("Invalid '%s' line for '%s'", '1-1:31.4.0(100.0*A,-100.0*A)\r\n', HOT 4
- serial.py HOT 2
- HOURLY_GAS_METER_READING is really 5-minute reading with DSMR 5
- Support new OBIS 1.6.0 Belgium Flanders HOT 3
- No support for Belgium variant
- Hourly Gas Consumption is not available / Ignore line with signature \d-\d:24\.2\.1.+?\r\n, because parsing failed. HOT 8
- Telegram __str__() and to_json() broken HOT 1
- typo in readme example HOT 1
- "TypeError: 'str' object is not callable" in filereader.py HOT 2
- Parser recompiles regex every loop HOT 15
- Adding digital water meter reading and quarter-hourly peak data (Belgium) HOT 1
- DSMR 2.2 with FT232 P1-kabel: connects, then nothing HOT 1
- Request support for HAN-NVE (a.k.a. Norwegian RJ45 HAN-port standard) interface over M-Bus
- Support for Logarex HOT 4
- Invalid telegram. The CRC checksum '17805' does not match the expected '12832' HOT 27
- Naming clashes in obis_name_mappings.py HOT 8
- Support DSMR data read via RFXtrx with integrated P1 reader HOT 11
- aurum warmtelink support (GJ) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dsmr_parser.