Giter Club home page Giter Club logo

Comments (4)

dajappie avatar dajappie commented on August 26, 2024

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.

ties avatar ties commented on August 26, 2024

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.

ndokter avatar ndokter commented on August 26, 2024

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.

dajappie avatar dajappie commented on August 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.