1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-06 05:12:21 +01:00

Add uart.write action (#567)

* Add uart.write action

* Lint
This commit is contained in:
Otto Winter
2019-05-29 19:32:18 +02:00
committed by GitHub
parent f35f6d2348
commit 31ddd3f668
6 changed files with 85 additions and 18 deletions

View File

@@ -1210,13 +1210,14 @@ def validate_registry(name, registry):
return ensure_list(validate_registry_entry(name, registry))
def maybe_simple_value(*validators):
def maybe_simple_value(*validators, **kwargs):
key = kwargs.pop('key', CONF_VALUE)
validator = All(*validators)
def validate(value):
if isinstance(value, dict) and CONF_VALUE in value:
if isinstance(value, dict) and key in value:
return validator(value)
return validator({CONF_VALUE: value})
return validator({key: value})
return validate