mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
add position reporting to the template cover (#821)
* add position reporting to the template cover * remove duplicate import * use config flag instead Co-authored-by: Samuel Sieb <samuel@sieb.net>
This commit is contained in:
parent
663f84f8b4
commit
39a520f552
1 changed files with 4 additions and 0 deletions
|
@ -16,11 +16,14 @@ RESTORE_MODES = {
|
|||
'RESTORE_AND_CALL': TemplateCoverRestoreMode.COVER_RESTORE_AND_CALL,
|
||||
}
|
||||
|
||||
CONF_HAS_POSITION = 'has_position'
|
||||
|
||||
CONFIG_SCHEMA = cover.COVER_SCHEMA.extend({
|
||||
cv.GenerateID(): cv.declare_id(TemplateCover),
|
||||
cv.Optional(CONF_LAMBDA): cv.returning_lambda,
|
||||
cv.Optional(CONF_OPTIMISTIC, default=False): cv.boolean,
|
||||
cv.Optional(CONF_ASSUMED_STATE, default=False): cv.boolean,
|
||||
cv.Optional(CONF_HAS_POSITION, default=False): cv.boolean,
|
||||
cv.Optional(CONF_OPEN_ACTION): automation.validate_automation(single=True),
|
||||
cv.Optional(CONF_CLOSE_ACTION): automation.validate_automation(single=True),
|
||||
cv.Optional(CONF_STOP_ACTION): automation.validate_automation(single=True),
|
||||
|
@ -56,6 +59,7 @@ def to_code(config):
|
|||
cg.add(var.set_optimistic(config[CONF_OPTIMISTIC]))
|
||||
cg.add(var.set_assumed_state(config[CONF_ASSUMED_STATE]))
|
||||
cg.add(var.set_restore_mode(config[CONF_RESTORE_MODE]))
|
||||
cg.add(var.set_has_position(config[CONF_HAS_POSITION]))
|
||||
|
||||
|
||||
@automation.register_action('cover.template.publish', cover.CoverPublishAction, cv.Schema({
|
||||
|
|
Loading…
Reference in a new issue