Add test coverage for modbus switch (coil part)#40696
Add test coverage for modbus switch (coil part)#40696ctalkington merged 4 commits intohome-assistant:devfrom janiversen:test2_modbus
Conversation
push entity_id to conftest, to make it common for all devices. Add device to base_setup.
|
Hey there @adamchengtkc, @vzahradnik, mind taking a look at this pull request as its been labeled with an integration ( |
|
@vzahradnik This PR is the reason I did not ask for test cases in your latest PR (light/fan), I tested with your PR and did not see any conflicts. I am working on a more extensive test of switch (with verify etc), but currently it conflicts with your PR, so I isolated this part. I look forward to the moment where we have test cases for all devices. |
|
@janiversen I look forward to the moment, where we have:
Lots of work ahead of us. |
|
Yes, but together we will manage. I had your list apart from the data flow on my list. If you want to and have time, please continue with the configuration and make a “reasonable central configuration”. Async modbus now works for tcp (both normal and rtuovertcp) but there are still problems with serial. I will shortly bump the pymodbus version (2.3.0 -> 2.4.0) as a preparation. Btw. Bronze no longer exist, but we are close on Silver https://developers.home-assistant.io/docs/integration_quality_scale_index/ |
OK, after I get my open PRs merged, I will continue with that. My idea was already proposed as a breaking change inside My idea is to have a structure like this: modbus:
hubs:
- name: hub1
type: tcp
host: 127.0.0.1
port: 5020
covers:
- name: Door1
slave: 1
...
sensors:
- name: Sensor1
...
binary_sensors:
- name: BinarySensor1
...
climates:
- name: Climate1
...
fans:
- name: Fan1
...
lights:
- name: Light1
...
This way, we'll list all the |
|
I like that config, however I am not sure I understand how you will manage to list e.g. all Covers in one place, if you have multiple hubs ?? Change defaults is something I have wanted for a while, especially hub name, so please go ahead. |
|
@vzahradnik I have opened issue #40705, so lets continue the discussion there. Can you please review this PR. |
|
Sure, I'll try to do it tomorrow. |
|
@janiversen your code looks good to me. In theory, we should be able to re-use switch tests for Fan and Light. One question: how does the |
|
@janiversen the coverage could be improved if we want to enable testing of coverage. Im seeing that your tests only cover about 47% of switch code. https://codecov.io/gh/home-assistant/core/pull/40696/tree/homeassistant/components/modbus |
|
It is correct, which is why the title states (coil) the whole register part is coming. I pushed this part of the test coverage to enable the new devices cover/fan/light to easily add some test cases. I am working on the rest and hope to push a new PR with that in cerca 2 weeks. |
|
ok i see. Ive disabled switch coverags until round 2. Ill merge this once tests finish from that change. |
|
Thanks a lot I saw your commit, which is why I did not add the same commit. |
Breaking change
Proposed change
Add test cases for modbus switch (coil), this includes making the test harness ready for
more complex devices.
Type of change
Example entry for
configuration.yaml:# Example configuration.yamlAdditional 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: