Modbus write_register accept single value and array (#21621)

* Update __init__.py

* Update services.yaml
This commit is contained in:
gertdb 2019-03-10 16:08:29 +01:00 committed by Fabian Affolter
parent 65ff8b727a
commit bab53a1c94
2 changed files with 4 additions and 2 deletions

View file

@ -60,7 +60,9 @@ SERVICE_WRITE_REGISTER_SCHEMA = vol.Schema({
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({

View file

@ -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]}