本文整理汇总了Python中homeassistant.helpers.config_validation.boolean方法的典型用法代码示例。如果您正苦于以下问题:Python config_validation.boolean方法的具体用法?Python config_validation.boolean怎么用?Python config_validation.boolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类homeassistant.helpers.config_validation
的用法示例。
在下文中一共展示了config_validation.boolean方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_parameters1cv
# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import boolean [as 别名]
def create_parameters1cv(options):
# Panel settings - can only be set on creation
return {
vol.Required(CONF_LANGUAGE, default=create_default(options, CONF_LANGUAGE, "EN") ) : cv.string,
vol.Optional(CONF_EXCLUDE_SENSOR, default=create_default(options, CONF_EXCLUDE_SENSOR, "")) : cv.string,
vol.Optional(CONF_EXCLUDE_X10, default=create_default(options, CONF_EXCLUDE_X10, "")) : cv.string,
vol.Optional(CONF_DOWNLOAD_CODE, default=create_default(options, CONF_DOWNLOAD_CODE, "") ) : cv.string,
vol.Optional(CONF_FORCE_STANDARD, default=create_default(options, CONF_FORCE_STANDARD, False)) : cv.boolean,
vol.Optional(CONF_FORCE_AUTOENROLL, default=create_default(options, CONF_FORCE_AUTOENROLL, False)) : cv.boolean,
vol.Optional(CONF_AUTO_SYNC_TIME, default=create_default(options, CONF_AUTO_SYNC_TIME, True)) : cv.boolean
}
示例2: create_parameters2cv
# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import boolean [as 别名]
def create_parameters2cv(options):
# Panel settings - can be modified/edited
return {
vol.Optional(CONF_MOTION_OFF_DELAY, default=create_default(options, CONF_MOTION_OFF_DELAY, 120) ) : cv.positive_int,
vol.Optional(CONF_SIREN_SOUNDING, default=create_default(options, CONF_SIREN_SOUNDING,["intruder"])) : cv.multi_select(available_siren_values),
vol.Optional(CONF_OVERRIDE_CODE, default=create_default(options, CONF_OVERRIDE_CODE, "") ) : cv.string,
vol.Optional(CONF_ARM_CODE_AUTO, default=create_default(options, CONF_ARM_CODE_AUTO, False)) : cv.boolean,
vol.Optional(CONF_FORCE_KEYPAD, default=create_default(options, CONF_FORCE_KEYPAD, False)) : cv.boolean,
vol.Optional(CONF_INSTANT_ARM_AWAY, default=create_default(options, CONF_INSTANT_ARM_AWAY, False)) : cv.boolean,
vol.Optional(CONF_INSTANT_ARM_HOME, default=create_default(options, CONF_INSTANT_ARM_HOME, False)) : cv.boolean,
vol.Optional(CONF_ENABLE_REMOTE_ARM, default=create_default(options, CONF_ENABLE_REMOTE_ARM, False)) : cv.boolean,
vol.Optional(CONF_ENABLE_REMOTE_DISARM, default=create_default(options, CONF_ENABLE_REMOTE_DISARM, False)) : cv.boolean,
vol.Optional(CONF_ENABLE_SENSOR_BYPASS, default=create_default(options, CONF_ENABLE_SENSOR_BYPASS, False)) : cv.boolean
}
示例3: create_parameters3cv
# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import boolean [as 别名]
def create_parameters3cv(options):
# Log file parameters
return {
vol.Optional(CONF_LOG_EVENT, default=create_default(options, CONF_LOG_EVENT, False)) : cv.boolean,
vol.Optional(CONF_LOG_DONE, default=create_default(options, CONF_LOG_DONE, False)) : cv.boolean,
vol.Optional(CONF_LOG_REVERSE, default=create_default(options, CONF_LOG_REVERSE, False)) : cv.boolean,
vol.Optional(CONF_LOG_CSV_TITLE, default=create_default(options, CONF_LOG_CSV_TITLE, False)) : cv.boolean,
vol.Optional(CONF_LOG_XML_FN, default=create_default(options, CONF_LOG_XML_FN, "")) : cv.string,
vol.Optional(CONF_LOG_CSV_FN, default=create_default(options, CONF_LOG_CSV_FN, "")) : cv.string,
vol.Optional(CONF_LOG_MAX_ENTRIES, default=create_default(options, CONF_LOG_MAX_ENTRIES, 10000)) : cv.positive_int
}
示例4: create_parameters4cv
# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import boolean [as 别名]
def create_parameters4cv(options):
# B0 related parameters (PowerMaster only)
return {
vol.Optional(CONF_B0_ENABLE_MOTION_PROCESSING, default=create_default(options, CONF_B0_ENABLE_MOTION_PROCESSING, False)) : cv.boolean,
vol.Optional(CONF_B0_MAX_TIME_FOR_TRIGGER_EVENT, default=create_default(options, CONF_B0_MAX_TIME_FOR_TRIGGER_EVENT, 5)) : cv.positive_int,
vol.Optional(CONF_B0_MIN_TIME_BETWEEN_TRIGGERS, default=create_default(options, CONF_B0_MIN_TIME_BETWEEN_TRIGGERS, 30)) : cv.positive_int
}
示例5: __init__
# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import boolean [as 别名]
def __init__(self, hass, slug_id, name, initial, entity_config):
"""Initialize a boolean input."""
self.hass = hass
self.entity_id = async_generate_entity_id(ENTITY_ID_FORMAT, slug_id, hass=hass)
self._name = name
self._state = initial
self._entity_config = entity_config
示例6: async_setup
# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import boolean [as 别名]
def async_setup(hass, config):
"""Set up an input boolean."""
component = hass.data[DOMAIN] = EntityComponent(_LOGGER, DOMAIN, hass)
entities = []
for object_id, cfg in config[DOMAIN].items():
if not cfg:
cfg = {}
name = cfg.get(CONF_NAME)
initial = cfg.get(CONF_INITIAL)
icon = cfg.get(CONF_ICON)
entities.append(InputBoolean(object_id, name, initial, icon))
if not entities:
return False
component.async_register_entity_service(
SERVICE_TURN_ON, SERVICE_SCHEMA,
'async_turn_on'
)
component.async_register_entity_service(
SERVICE_TURN_OFF, SERVICE_SCHEMA,
'async_turn_off'
)
component.async_register_entity_service(
SERVICE_TOGGLE, SERVICE_SCHEMA,
'async_toggle'
)
await component.async_add_entities(entities)
return True
示例7: __init__
# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import boolean [as 别名]
def __init__(self, object_id, name, initial, icon):
"""Initialize a boolean input."""
self.entity_id = ENTITY_ID_FORMAT.format(object_id)
self._name = name
self._state = initial
self._icon = icon
示例8: name
# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import boolean [as 别名]
def name(self):
"""Return name of the boolean input."""
return self._name