1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-07 05:42:20 +01:00

Allow entities to be disabled by default in HA (#2113)

Co-authored-by: Otto Winter <otto@otto-winter.com>
This commit is contained in:
Jesse Hills
2021-08-10 13:45:31 +12:00
committed by GitHub
parent c038cf27a7
commit 93796491af
20 changed files with 224 additions and 13 deletions

View File

@@ -2,6 +2,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import pins
from esphome.const import (
CONF_DISABLED_BY_DEFAULT,
CONF_FREQUENCY,
CONF_ID,
CONF_NAME,
@@ -66,6 +67,7 @@ CONFIG_SCHEMA = cv.Schema(
{
cv.GenerateID(): cv.declare_id(ESP32Camera),
cv.Required(CONF_NAME): cv.string,
cv.Optional(CONF_DISABLED_BY_DEFAULT, default=False): cv.boolean,
cv.Required(CONF_DATA_PINS): cv.All([pins.input_pin], cv.Length(min=8, max=8)),
cv.Required(CONF_VSYNC_PIN): pins.input_pin,
cv.Required(CONF_HREF_PIN): pins.input_pin,
@@ -124,6 +126,7 @@ SETTERS = {
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID], config[CONF_NAME])
cg.add(var.set_disabled_by_default(config[CONF_DISABLED_BY_DEFAULT]))
await cg.register_component(var, config)
for key, setter in SETTERS.items():