Skip to content

Commit

Permalink
Modbus write_register accept single value and array (#21621)
Browse files Browse the repository at this point in the history
* Update __init__.py

* Update services.yaml
  • Loading branch information
gertdb authored and fabaff committed Mar 10, 2019
1 parent 65ff8b7 commit bab53a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion homeassistant/components/modbus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
vol.Optional(ATTR_HUB, default=DEFAULT_HUB): cv.string,
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]))
})

SERVICE_WRITE_COIL_SCHEMA = vol.Schema({
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/modbus/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ write_register:
fields:
address: {description: Address of the holding register to write to., example: 0}
unit: {description: Address of the modbus unit., example: 21}
value: {description: Value to write., example: 0}
value: {description: Value (single value or array) to write., example: 0 or [4,0]}

0 comments on commit bab53a1

Please sign in to comment.