New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modbus: Add support for Holding Registers to Binary Sensor #80460
Conversation
Update handling of binary sensors to support reading from holding registers (command 0x03).
Update prser to accept holding registers as input type for binary sensors
Hi Nippey It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
Hey there @adamchengtkc, @janiversen, @vzahradnik, mind taking a look at this pull request as it has been labeled with an integration ( |
Will take a look later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test are missing, please amend the relevant test_file with tests that control the new functionality.
@@ -21,6 +21,8 @@ | |||
DataUpdateCoordinator, | |||
) | |||
|
|||
from .const import CALL_TYPE_COIL, CALL_TYPE_DISCRETE, CALL_TYPE_REGISTER_HOLDING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please solve the pylint/flake8 warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the heads-up!
Removed CALL_TYPE_REGISTER_HOLDING
, as not implicitly used.
Comply with pylint output
As for Coil and Discrete, Holding should just evaluate the lowest bit of the register
I just found and checked the test file. |
@janiversen: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good apart from the CI error in isort, please solve.
Sorry, tried to rename the branch to something more meaningful. Solved 'isort' error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Breaking change
Proposed change
I have a 32-channel input ("N4DIM32") for modbus. This device exposes its internal states via holding registers.
(If required, I can attach the interface description provided by the seller.)
As binary_sensor currently only supports CALL_TYPE_COIL, CALL_TYPE_DISCRETE:
ADDED: Support for CALL_TYPE_REGISTER_HOLDING.
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
.To help with the load of incoming pull requests: