Add DSMR config options for EasyMeter/Q3D#63669
Conversation
|
Hey there @RobBie1221, @frenck, mind taking a look at this pull request as it has been labeled with an integration ( |
|
As mentioned in the comment of #60088 you need to add tests for the config flow because it requires 100% coverage. It would also be good to add a smoke test to |
frenck
left a comment
There was a problem hiding this comment.
As per comment above, please add tests 👍
|
#63529 contains a good example of how to extend tests if you need some guidance. |
|
Added a test for a Q3D telegram. Given the very minimal changes expanding the protocol version just by one entry, the test is not really improving coverage. But this was my first test ever written. So I hope it's sufficient. Otherwise I would appreciate details of how I may improve the PR to an acceptable level. |
|
The test you added is fine for the smoke test. It doesn't improve coverage that much, but it ensures setting up the integration with the new option will work (and will keep working). The config flow actually needs 100% coverage, lines 49 and 50 you added in To test these, you can reuse a lot. So add in below file/function a statement to add for core/tests/components/dsmr/conftest.py Lines 51 to 67 in 8860549 Then copy below function, name it something like |
|
@frenck I noticed coverage of |
I actually tried something like that yesterday, playing around with the version in the existing test_setup functions. Following your tipps I'm running into the same problem where I gave up yesterday: As soon as config_flow lines 48 (for 5L) or 50 (for Q3D) get coverage I get AssertionErrors: assert 'form' == 'create_entry' in the final assertation. Gone when I change back to "5", "5S", or "2.2". Couldn't get to the bottom of it. Should I commit the half baked code for visibility? |
Yes, I'll check what's wrong. |
RobBie1221
left a comment
There was a problem hiding this comment.
This should fix it. Don't forget to add import in conftest.py.
Just a general question looking at the obis references, what is the difference between Q3_EQUIPMENT_IDENTIFIER and Q3_EQUIPMENT_SERIALNUMBER? Is the equipment identifier unique for your device? Or should we actually use here serial number?
Furthermore, you need to add a documentation pull request. I saw you had it in your initial PR. You can reopen that one or make a new one (maybe easier because the original needs to be rebased on next).
| entry_data = { | ||
| "port": port.device, | ||
| "dsmr_version": "Q3D", | ||
| } |
There was a problem hiding this comment.
| entry_data = { | |
| "port": port.device, | |
| "dsmr_version": "Q3D", | |
| } | |
| entry_data = { | |
| "port": port.device, | |
| "dsmr_version": "Q3D", | |
| "serial_id": "12345678", | |
| "serial_id_gas": None, | |
| } |
|
They are more or less the same. S/N has a prefix. Q3D_EQUIPMENT_IDENTIFIER = r'\d-\d:0.0.0.+?\r\n' # Logical device name
|
Co-authored-by: Rob Bierbooms <mail@robbierbooms.nl>
Co-authored-by: Rob Bierbooms <mail@robbierbooms.nl>
|
Happy to add doc. The test should be working now and also included a 5L test to bump up converage by another %. |
|
Doc PR is home-assistant/home-assistant.io#21113 Please let me know if I can do anything else. |
|
The link points to wrong repo, you should copy the link from home-assistant.io github repo. Also, add it to the PR description in the template. |
Proposed change
Adding support dsmr EasyMeter Q3D
(re-submitting expired PR #60088, apologies)
Type of change
Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: