-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Fix slave id equal to 0 #136263
Fix slave id equal to 0 #136263
Conversation
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.
Can we add a test for this case?
../Frenck
Looks like the test was accidentally reverted in 8ac274f |
The test was based on the extra_attribute, so that test is not valid anymore after removing that attribute. |
Got it. We should still be able to patch the lib to see whats its sending though instead of verifying the attribute |
I'm a little behind here, but I think we don't need the milestone unless pymodus was already bumped in 2025.1 @crug80 is this issue only present on dev or does it affect stable? |
The linked issue report was against Home Assistant 2025.1, hence me considering this an patch worthy issue. Ref: #134665 If unsure, we can wait, we are close to beta. |
Chatted with @crug80 It looks like we need to adjust
|
Flexit is ok. CONF_ADDRESS is Required and it can assume only values from 0 to 32, so with this fix on modbus we made safe also for flexit use the 0 as slave. |
FAILED tests/components/emulated_roku/test_binding.py::test_events_fired_properly - AssertionError: assert 'keypress' == 'keyup' Test failure is unrelated |
Thanks both! I'll ship this one tomorrow. ../Frenck |
Co-authored-by: J. Nick Koston <[email protected]>
Co-authored-by: Robert Resch <[email protected]> Co-authored-by: J. Nick Koston <[email protected]> Co-authored-by: Matt Doran <[email protected]> Co-authored-by: G Johansson <[email protected]> Co-authored-by: Makrit <[email protected]> Co-authored-by: Claudio Ruggeri - CR-Tech <[email protected]> Co-authored-by: Simon Lamon <[email protected]> Co-authored-by: Yuxin Wang <[email protected]> Co-authored-by: Åke Strandberg <[email protected]> Co-authored-by: Paul Bottein <[email protected]> Co-authored-by: Joost Lekkerkerker <[email protected]> Co-authored-by: Klaas Schoute <[email protected]> Fix slave id equal to 0 (#136263)
Breaking change
Possible breaking change:
The configuration where the slave id or the device_address was not set, now assume a default value equal to 1 (instead of 0).
The situation can be easily fixed by an explicit declaration of the parameter.
Please note that the current bug has already broken those situations.
Proposed change
After having bumped pymodbus 3.7.x an hidden bug belonging the case where the slave id is set to 0 or not set at all became visible.
Before of that change, the underlying library pymodbus in case of missing slave id used a default value equal to 0. From the version 3.7.x, pymodbus changed the defaul slave it to 1, enforcing the fact that the slave id 0 is defined as broadcast according with the ModBus protocol.
This change within the library highlighted a previously hidden bug in the integration where a condition to check if the slave ID was None, actually intercepted even a slave id set to 0,
Fixing the bug, we align also the integration with the Modbus spec and with the pymodbus library setting the default value for the slave id to 1, instead of 0.
Type of change
Additional information
Checklist
ruff format 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
.To help with the load of incoming pull requests: