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 write_register accept integer and list #18425
Conversation
Updated voluptuous schema to accept integer and list. That way the correct function code modbus function code is called (0x06 for integer (single register), 0x10 for list (multiple registers)).
homeassistant/components/modbus.py
Outdated
@@ -60,7 +60,7 @@ | |||
SERVICE_WRITE_REGISTER_SCHEMA = vol.Schema({ | |||
vol.Required(ATTR_UNIT): cv.positive_int, | |||
vol.Required(ATTR_ADDRESS): cv.positive_int, | |||
vol.Required(ATTR_VALUE): vol.All(cv.ensure_list, [cv.positive_int]) | |||
vol.Required(ATTR_VALUE): vol.Any(cv.positive_int, vol.All(cv.ensure_list, [cv.positive_int])) |
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.
line too long (98 > 79 characters)
homeassistant/components/modbus.py
Outdated
@@ -60,7 +60,9 @@ | |||
SERVICE_WRITE_REGISTER_SCHEMA = vol.Schema({ | |||
vol.Required(ATTR_UNIT): cv.positive_int, | |||
vol.Required(ATTR_ADDRESS): cv.positive_int, | |||
vol.Required(ATTR_VALUE): vol.All(cv.ensure_list, [cv.positive_int]) | |||
vol.Required(ATTR_VALUE): vol.Any( | |||
cv.positive_int, |
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.
trailing whitespace
Could not find a related documentation PR, adding |
Besides documentation also requires an update to |
This PR seems to have gone stale. Closing it. |
Updated voluptuous schema to accept integer and list. That way the correct function code modbus function code is called (0x06 for integer (single register), 0x10 for list (multiple registers)).
Description:
Related issue (if applicable): fixes #
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
. Your PR cannot be merged unless tests pass