import voluptuous as vol from zigpy.config import ( # noqa: F401 pylint: disable=unused-import CONF_DEVICE, CONF_DEVICE_PATH, CONFIG_SCHEMA, SCHEMA_DEVICE, cv_boolean, ) from .ezsp import EZSP_SCHEMA CONF_DEVICE_BAUDRATE = "baudrate" CONF_EZSP_CONFIG = "ezsp_config" CONF_PARAM_SRC_RTG = "source_routing" SCHEMA_DEVICE = SCHEMA_DEVICE.extend( {vol.Optional(CONF_DEVICE_BAUDRATE, default=57600): int} ) CONFIG_SCHEMA = CONFIG_SCHEMA.extend( { vol.Required(CONF_DEVICE): SCHEMA_DEVICE, vol.Optional(CONF_PARAM_SRC_RTG, default=False): cv_boolean, vol.Optional(CONF_EZSP_CONFIG, default={}): vol.Schema(EZSP_SCHEMA), } )
import voluptuous as vol from zigpy.config import ( # noqa: F401 pylint: disable=unused-import CONF_DEVICE, CONF_DEVICE_PATH, CONFIG_SCHEMA, SCHEMA_DEVICE, ) CONF_WATCHDOG_TTL = "watchdog_ttl" CONF_WATCHDOG_TTL_DEFAULT = 600 CONFIG_SCHEMA = CONFIG_SCHEMA.extend({ vol.Optional(CONF_WATCHDOG_TTL, default=CONF_WATCHDOG_TTL_DEFAULT): vol.All(int, vol.Range(min=180)) })
CONF_DEVICE_BAUDRATE = "baudrate" CONF_EZSP_CONFIG = "ezsp_config" CONF_EZSP_POLICIES = "ezsp_policies" CONF_PARAM_SRC_RTG = "source_routing" CONF_PARAM_UNK_DEV = "handle_unknown_devices" CONF_FLOW_CONTROL = "flow_control" CONF_FLOW_CONTROL_DEFAULT = "software" SCHEMA_DEVICE = SCHEMA_DEVICE.extend( { vol.Optional(CONF_DEVICE_BAUDRATE, default=57600): int, vol.Optional(CONF_FLOW_CONTROL, default=CONF_FLOW_CONTROL_DEFAULT): vol.In( ("hardware", "software") ), }, ) CONFIG_SCHEMA = CONFIG_SCHEMA.extend( { vol.Required(CONF_DEVICE): SCHEMA_DEVICE, vol.Optional(CONF_PARAM_SRC_RTG, default=False): cv_boolean, vol.Optional(CONF_PARAM_UNK_DEV, default=False): cv_boolean, vol.Optional(CONF_EZSP_CONFIG, default={}): dict, vol.Optional(CONF_EZSP_POLICIES, default={}): vol.Schema( {vol.Optional(str): int} ), } ) cv_uint16 = vol.All(int, vol.Range(min=0, max=65535))
VolPositiveNumber = vol.All(numbers.Real, vol.Range(min=0)) CONF_DEVICE_BAUDRATE = "baudrate" CONF_DEVICE_FLOW_CONTROL = "flow_control" SCHEMA_DEVICE = SCHEMA_DEVICE.extend({ vol.Optional(CONF_DEVICE_BAUDRATE, default=115_200): int, vol.Optional(CONF_DEVICE_FLOW_CONTROL, default=None): vol.In(("hardware", "software", None)), }) CONF_ZNP_CONFIG = "znp_config" CONF_TX_POWER = "tx_power" CONF_SREQ_TIMEOUT = "sync_request_timeout" CONF_AUTO_RECONNECT_RETRY_DELAY = "auto_reconnect_retry_delay" CONFIG_SCHEMA = CONFIG_SCHEMA.extend({ vol.Required(CONF_DEVICE): SCHEMA_DEVICE, vol.Optional(CONF_ZNP_CONFIG, default={}): vol.Schema({ vol.Optional(CONF_TX_POWER, default=None): vol.Any(None, vol.All(int, vol.Range(min=-22, max=19))), vol.Optional(CONF_SREQ_TIMEOUT, default=5): VolPositiveNumber, vol.Optional(CONF_AUTO_RECONNECT_RETRY_DELAY, default=5): VolPositiveNumber, }), })
import voluptuous as vol from zigpy.config import ( # noqa: F401 pylint: disable=unused-import CONF_DATABASE, CONF_DEVICE, CONF_DEVICE_PATH, CONFIG_SCHEMA, cv_boolean, ) CONF_DEVICE_BAUDRATE = "baudrate" CONF_DEVICE_BAUDRATE_DEFAULT = 115200 CONF_FLOW_CONTROL = "flow_control" CONF_FLOW_CONTROL_DEFAULT = None SCHEMA_DEVICE = vol.Schema({ vol.Required(CONF_DEVICE_PATH): vol.Any(vol.PathExists(), "auto"), vol.Optional(CONF_DEVICE_BAUDRATE, default=CONF_DEVICE_BAUDRATE_DEFAULT): int, vol.Optional(CONF_FLOW_CONTROL, default=CONF_FLOW_CONTROL_DEFAULT): vol.In(("hardware", "software", None)), }) CONFIG_SCHEMA = CONFIG_SCHEMA.extend( {vol.Required(CONF_DEVICE): SCHEMA_DEVICE})