mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 07:28:10 +01:00
Allow old remote_transmitter repeat schema (#601)
Fixes https://github.com/esphome/issues/issues/389
This commit is contained in:
parent
c97a9d83c6
commit
ec9cc72320
1 changed files with 11 additions and 5 deletions
|
@ -83,14 +83,20 @@ def register_dumper(name, type):
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
def register_action(name, type_, schema):
|
def validate_repeat(value):
|
||||||
validator = templatize(schema).extend({
|
if isinstance(value, dict):
|
||||||
cv.GenerateID(CONF_TRANSMITTER_ID): cv.use_id(RemoteTransmitterBase),
|
return cv.Schema({
|
||||||
cv.Optional(CONF_REPEAT): cv.Schema({
|
|
||||||
cv.Required(CONF_TIMES): cv.templatable(cv.positive_int),
|
cv.Required(CONF_TIMES): cv.templatable(cv.positive_int),
|
||||||
cv.Optional(CONF_WAIT_TIME, default='10ms'):
|
cv.Optional(CONF_WAIT_TIME, default='10ms'):
|
||||||
cv.templatable(cv.positive_time_period_milliseconds),
|
cv.templatable(cv.positive_time_period_milliseconds),
|
||||||
}),
|
})(value)
|
||||||
|
return validate_repeat({CONF_TIMES: value})
|
||||||
|
|
||||||
|
|
||||||
|
def register_action(name, type_, schema):
|
||||||
|
validator = templatize(schema).extend({
|
||||||
|
cv.GenerateID(CONF_TRANSMITTER_ID): cv.use_id(RemoteTransmitterBase),
|
||||||
|
cv.Optional(CONF_REPEAT): validate_repeat,
|
||||||
})
|
})
|
||||||
registerer = automation.register_action('remote_transmitter.transmit_{}'.format(name),
|
registerer = automation.register_action('remote_transmitter.transmit_{}'.format(name),
|
||||||
type_, validator)
|
type_, validator)
|
||||||
|
|
Loading…
Reference in a new issue