ndokter / dsmr_parser

Library to parse Dutch Smart Meter Requirements (DSMR) telegrams.
MIT License
110 stars 64 forks source link

Improve documentation asyncio #63

Closed mjkl-gh closed 2 years ago

mjkl-gh commented 3 years ago

I would like to add the missing documentation of the missing asyncio part of this library. I had some difficulty figuring this out for myself and would like to add this for the next person if the author likes my proposal

ndokter commented 3 years ago

Looks good. Was it still in draft mode or can i merge it?

mjkl-gh commented 3 years ago

It was a draft. I also wanted to include a way to return an object as serial_reader.read_as_object() but then I noticed create_tcp_dsmr_reader() passes already parsed telegrams to it's callback while the Telegram object requires unparsed telegrams and a parser

I've created something that constructs a mock-parser that returns the already parsed object and uses that create the telegram object. However, it's a bit convoluted. Did I miss something or is the Telegram Object missing a way of constructing objects straight from a dict?

mjkl-gh commented 3 years ago

I've added what I've implemented to read telegrams as objects with asyncio. However, it is not beautiful. If you want it you can keep it in, but it might be better to just drop it.

If that's decided I think it's ready to merge

ndokter commented 3 years ago

Sorry for the late response. I still want to consider the changes, but have to take the time to look at them

ndokter commented 2 years ago

I want to apologize that i forgot your merge request. The documentation is getting a bit long now, but it's a good addition. Thanks for your work