From b0e6b48c50b46dac443dd36c4c33743f7e3d9ccd Mon Sep 17 00:00:00 2001 From: puuu Date: Fri, 10 May 2019 20:48:50 +0900 Subject: [PATCH] Allow rx_only mode of sds011 component (#534) fixes the following error if rx_only was defined and update_interval was not present: Failed config sensor.sds011: [source sds011.yaml:62] update_interval has no effect in rx_only mode. Please remove it. --- esphome/components/sds011/sensor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/esphome/components/sds011/sensor.py b/esphome/components/sds011/sensor.py index 5b34b2dbbd..0f750810a6 100644 --- a/esphome/components/sds011/sensor.py +++ b/esphome/components/sds011/sensor.py @@ -33,7 +33,7 @@ CONFIG_SCHEMA = cv.All(cv.Schema({ sensor.sensor_schema(UNIT_MICROGRAMS_PER_CUBIC_METER, ICON_CHEMICAL_WEAPON, 1), cv.Optional(CONF_RX_ONLY, default=False): cv.boolean, - cv.Optional(CONF_UPDATE_INTERVAL, default='0min'): cv.positive_time_period_minutes, + cv.Optional(CONF_UPDATE_INTERVAL): cv.positive_time_period_minutes, }).extend(cv.COMPONENT_SCHEMA).extend(uart.UART_DEVICE_SCHEMA), validate_sds011_rx_mode) @@ -42,7 +42,8 @@ def to_code(config): yield cg.register_component(var, config) yield uart.register_uart_device(var, config) - cg.add(var.set_update_interval_min(config[CONF_UPDATE_INTERVAL])) + if CONF_UPDATE_INTERVAL in config: + cg.add(var.set_update_interval_min(config[CONF_UPDATE_INTERVAL])) cg.add(var.set_rx_mode_only(config[CONF_RX_ONLY])) if CONF_PM_2_5 in config: