Comments (11)
Hey, yes i have to manually make a new release. Will do it soon. Thanks for the contribution!
from dsmr_parser.
Implemented a proof-of-concept, which works on my RFXtrx setup (with an additional single-line hack on the protocol level: changing DSMRProtocol into RFXtrxDSMRProtocol).
I can add the DSMR integration in Home Assistant without any problems after loading this change in my Home Assistant test environment, and the measured values are getting updated.
To finish the PR we would need to decide on what the external API should be:
- Add additional functions to the API (e.g.
create_rfxtrx_dsmr_reader
andcreate_rfxtrx_tcp_dsmr_reader
) - Add an additional parameter that specifies the whether or not to use the RFXtrx wrapper (could default to False)
from dsmr_parser.
Would it be possible to put the RFX specific part into a (new?) client module? It could inherit from the DSMRProtocol if needed i think. This way the RFX specific code is contained in it's own module and the default library is unaffected.
from dsmr_parser.
Yes, I think that could be possible.
Do you have any suggestions for the file structure and API you'd like to see?
E.g. something like rfxtrx_protocol.py containing create_rfxtrx_dsmr_reader
, create_rfxtrx_tcp_dsmr_reader
and create_rfxtrx_dsmr_protocol
would make sense to me.
This would probably give a small bit of code duplication that could be avoided by using an additional parameter.
Maybe we could keep the external API the same and create some private functions with that extra parameter to keep the duplication minimal?
from dsmr_parser.
Those names sound good! What part would need to be duplicated?
from dsmr_parser.
In the current implementation only line 48 needs to be changed from DSMRProtocol into RFXtrxDSMRProtocol to make it work. Creating a private create_dsmr_protocol passing this as parameter would avoid duplication there.
The other two functions would need to call that with the appropriate parameter.
from dsmr_parser.
Maybe you can add a 'protocol' parameter?
def create_dsmr_protocol(dsmr_version, telegram_callback, loop=None, protocol=DSMRProtocol , **kwargs):
Which then is overrided only in the create_rfx.. function? Then the other methods won't work with the RFXtrxDSMRProtocol object which might be confusing?
from dsmr_parser.
I updated the (draft) Pull Request. Slightly differently than what you suggested. If you prefer, I can easily update it.
from dsmr_parser.
Nice! Same line of thought :)
from dsmr_parser.
I tried following your suggestion, but somehow Python will not let me use protocol=DSMRProtocol
in the function declaration. I do not know enough Python to understand why.
Is there anything I should change/add before you would accept the PR?
from dsmr_parser.
Great to see the Pull Request getting merged. Thanks!
Do you plan to release this as a new version too?
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
- 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.