From b3952b28f4f7dd8a557698f27ac6d2a96a14937d Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Mon, 12 Nov 2018 23:26:12 +0100 Subject: [PATCH] Lint --- esphomeyaml/components/deep_sleep.py | 9 ++++----- esphomeyaml/components/display/max7219.py | 4 ++-- esphomeyaml/components/display/nextion.py | 11 ++++++----- esphomeyaml/components/display/ssd1306_spi.py | 4 ++-- .../components/display/waveshare_epaper.py | 6 +++--- esphomeyaml/components/esp32_ble_beacon.py | 8 ++++---- esphomeyaml/components/fan/binary.py | 4 ++-- esphomeyaml/components/fan/speed.py | 6 +++--- esphomeyaml/components/light/binary.py | 10 +++++----- esphomeyaml/components/light/monochromatic.py | 12 ++++++------ esphomeyaml/components/pcf8574.py | 4 +--- esphomeyaml/components/pn532.py | 4 ++-- esphomeyaml/components/rdm6300.py | 4 ++-- esphomeyaml/components/sensor/__init__.py | 16 +++++++--------- esphomeyaml/components/sensor/cse7766.py | 4 ++-- esphomeyaml/components/sensor/max6675.py | 4 ++-- esphomeyaml/components/sensor/mhz19.py | 4 ++-- esphomeyaml/components/sensor/ms5611.py | 11 ++++++----- esphomeyaml/components/sensor/pmsx003.py | 4 ++-- .../components/sensor/total_daily_energy.py | 4 ++-- esphomeyaml/components/switch/output.py | 10 +++++----- esphomeyaml/components/web_server.py | 10 ++++------ esphomeyaml/config.py | 2 +- esphomeyaml/helpers.py | 1 + 24 files changed, 76 insertions(+), 80 deletions(-) diff --git a/esphomeyaml/components/deep_sleep.py b/esphomeyaml/components/deep_sleep.py index cef05fce51..bcded6c00a 100644 --- a/esphomeyaml/components/deep_sleep.py +++ b/esphomeyaml/components/deep_sleep.py @@ -1,11 +1,11 @@ import voluptuous as vol from esphomeyaml import config_validation as cv, pins -from esphomeyaml.automation import maybe_simple_id, ACTION_REGISTRY +from esphomeyaml.automation import ACTION_REGISTRY, maybe_simple_id from esphomeyaml.const import CONF_ID, CONF_NUMBER, CONF_RUN_CYCLES, CONF_RUN_DURATION, \ - CONF_SLEEP_DURATION, CONF_WAKEUP_PIN, CONF_ACTION_ID -from esphomeyaml.helpers import App, Pvariable, add, gpio_input_pin_expression, esphomelib_ns, \ - TemplateArguments, get_variable, setup_component, Component, Action + CONF_SLEEP_DURATION, CONF_WAKEUP_PIN +from esphomeyaml.helpers import Action, App, Component, Pvariable, TemplateArguments, add, \ + esphomelib_ns, get_variable, gpio_input_pin_expression, setup_component def validate_pin_number(value): @@ -62,7 +62,6 @@ def to_code(config): BUILD_FLAGS = '-DUSE_DEEP_SLEEP' - CONF_DEEP_SLEEP_ENTER = 'deep_sleep.enter' DEEP_SLEEP_ENTER_ACTION_SCHEMA = maybe_simple_id({ vol.Required(CONF_ID): cv.use_variable_id(DeepSleepComponent), diff --git a/esphomeyaml/components/display/max7219.py b/esphomeyaml/components/display/max7219.py index 297f952085..b5bf380c4d 100644 --- a/esphomeyaml/components/display/max7219.py +++ b/esphomeyaml/components/display/max7219.py @@ -25,11 +25,11 @@ PLATFORM_SCHEMA = display.BASIC_DISPLAY_PLATFORM_SCHEMA.extend({ def to_code(config): - for spi in get_variable(config[CONF_SPI_ID]): + for spi_ in get_variable(config[CONF_SPI_ID]): yield for cs in gpio_output_pin_expression(config[CONF_CS_PIN]): yield - rhs = App.make_max7219(spi, cs) + rhs = App.make_max7219(spi_, cs) max7219 = Pvariable(config[CONF_ID], rhs) if CONF_NUM_CHIPS in config: diff --git a/esphomeyaml/components/display/nextion.py b/esphomeyaml/components/display/nextion.py index 17527ec8ce..9f26647f96 100644 --- a/esphomeyaml/components/display/nextion.py +++ b/esphomeyaml/components/display/nextion.py @@ -1,9 +1,10 @@ -import esphomeyaml.config_validation as cv from esphomeyaml.components import display, uart from esphomeyaml.components.uart import UARTComponent +import esphomeyaml.config_validation as cv from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_UART_ID -from esphomeyaml.helpers import App, Pvariable, add, get_variable, process_lambda, setup_component, \ - PollingComponent +from esphomeyaml.helpers import App, PollingComponent, Pvariable, add, get_variable, \ + process_lambda, \ + setup_component DEPENDENCIES = ['uart'] @@ -17,9 +18,9 @@ PLATFORM_SCHEMA = display.BASIC_DISPLAY_PLATFORM_SCHEMA.extend({ def to_code(config): - for uart in get_variable(config[CONF_UART_ID]): + for uart_ in get_variable(config[CONF_UART_ID]): yield - rhs = App.make_nextion(uart) + rhs = App.make_nextion(uart_) nextion = Pvariable(config[CONF_ID], rhs) if CONF_LAMBDA in config: diff --git a/esphomeyaml/components/display/ssd1306_spi.py b/esphomeyaml/components/display/ssd1306_spi.py index e4dbb6a8f9..bf47a5e92a 100644 --- a/esphomeyaml/components/display/ssd1306_spi.py +++ b/esphomeyaml/components/display/ssd1306_spi.py @@ -41,14 +41,14 @@ PLATFORM_SCHEMA = display.FULL_DISPLAY_PLATFORM_SCHEMA.extend({ def to_code(config): - for spi in get_variable(config[CONF_SPI_ID]): + for spi_ in get_variable(config[CONF_SPI_ID]): yield for cs in gpio_output_pin_expression(config[CONF_CS_PIN]): yield for dc in gpio_output_pin_expression(config[CONF_DC_PIN]): yield - rhs = App.make_spi_ssd1306(spi, cs, dc) + rhs = App.make_spi_ssd1306(spi_, cs, dc) ssd = Pvariable(config[CONF_ID], rhs) add(ssd.set_model(MODELS[config[CONF_MODEL]])) diff --git a/esphomeyaml/components/display/waveshare_epaper.py b/esphomeyaml/components/display/waveshare_epaper.py index b3c9ceb0b3..51723440cf 100644 --- a/esphomeyaml/components/display/waveshare_epaper.py +++ b/esphomeyaml/components/display/waveshare_epaper.py @@ -51,7 +51,7 @@ PLATFORM_SCHEMA = vol.All(display.FULL_DISPLAY_PLATFORM_SCHEMA.extend({ def to_code(config): - for spi in get_variable(config[CONF_SPI_ID]): + for spi_ in get_variable(config[CONF_SPI_ID]): yield for cs in gpio_output_pin_expression(config[CONF_CS_PIN]): yield @@ -60,10 +60,10 @@ def to_code(config): model_type, model = MODELS[config[CONF_MODEL]] if model_type == 'a': - rhs = App.make_waveshare_epaper_type_a(spi, cs, dc, model) + rhs = App.make_waveshare_epaper_type_a(spi_, cs, dc, model) epaper = Pvariable(config[CONF_ID], rhs, type=WaveshareEPaperTypeA) elif model_type == 'b': - rhs = App.make_waveshare_epaper_type_b(spi, cs, dc, model) + rhs = App.make_waveshare_epaper_type_b(spi_, cs, dc, model) epaper = Pvariable(config[CONF_ID], rhs, type=WaveshareEPaper) else: raise NotImplementedError() diff --git a/esphomeyaml/components/esp32_ble_beacon.py b/esphomeyaml/components/esp32_ble_beacon.py index 9f356acb5e..2d9e8d37a4 100644 --- a/esphomeyaml/components/esp32_ble_beacon.py +++ b/esphomeyaml/components/esp32_ble_beacon.py @@ -1,9 +1,9 @@ import voluptuous as vol from esphomeyaml import config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_SCAN_INTERVAL, ESP_PLATFORM_ESP32, CONF_UUID, CONF_TYPE -from esphomeyaml.helpers import App, Pvariable, add, esphomelib_ns, RawExpression, ArrayInitializer, \ - setup_component, Component +from esphomeyaml.const import CONF_ID, CONF_SCAN_INTERVAL, CONF_TYPE, CONF_UUID, ESP_PLATFORM_ESP32 +from esphomeyaml.helpers import App, ArrayInitializer, Component, Pvariable, RawExpression, add, \ + esphomelib_ns, setup_component ESP_PLATFORMS = [ESP_PLATFORM_ESP32] @@ -24,7 +24,7 @@ CONFIG_SCHEMA = vol.Schema({ def to_code(config): uuid = config[CONF_UUID].hex - uuid_arr = [RawExpression('0x{}'.format(uuid[i:i+2])) for i in range(0, len(uuid), 2)] + uuid_arr = [RawExpression('0x{}'.format(uuid[i:i + 2])) for i in range(0, len(uuid), 2)] rhs = App.make_esp32_ble_beacon(ArrayInitializer(*uuid_arr, multiline=False)) ble = Pvariable(config[CONF_ID], rhs) if CONF_MAJOR in config: diff --git a/esphomeyaml/components/fan/binary.py b/esphomeyaml/components/fan/binary.py index 533b56b59b..1ce51c2a0b 100644 --- a/esphomeyaml/components/fan/binary.py +++ b/esphomeyaml/components/fan/binary.py @@ -13,12 +13,12 @@ PLATFORM_SCHEMA = cv.nameable(fan.FAN_PLATFORM_SCHEMA.extend({ def to_code(config): - for output in get_variable(config[CONF_OUTPUT]): + for output_ in get_variable(config[CONF_OUTPUT]): yield rhs = App.make_fan(config[CONF_NAME]) fan_struct = variable(config[CONF_MAKE_ID], rhs) - add(fan_struct.Poutput.set_binary(output)) + add(fan_struct.Poutput.set_binary(output_)) if CONF_OSCILLATION_OUTPUT in config: for oscillation_output in get_variable(config[CONF_OSCILLATION_OUTPUT]): yield diff --git a/esphomeyaml/components/fan/speed.py b/esphomeyaml/components/fan/speed.py index 71003fb312..d1259d3ae1 100644 --- a/esphomeyaml/components/fan/speed.py +++ b/esphomeyaml/components/fan/speed.py @@ -22,18 +22,18 @@ PLATFORM_SCHEMA = cv.nameable(fan.FAN_PLATFORM_SCHEMA.extend({ def to_code(config): - for output in get_variable(config[CONF_OUTPUT]): + for output_ in get_variable(config[CONF_OUTPUT]): yield rhs = App.make_fan(config[CONF_NAME]) fan_struct = variable(config[CONF_MAKE_ID], rhs) if CONF_SPEED in config: speeds = config[CONF_SPEED] - add(fan_struct.Poutput.set_speed(output, + add(fan_struct.Poutput.set_speed(output_, speeds[CONF_LOW], speeds[CONF_MEDIUM], speeds[CONF_HIGH])) else: - add(fan_struct.Poutput.set_speed(output)) + add(fan_struct.Poutput.set_speed(output_)) if CONF_OSCILLATION_OUTPUT in config: for oscillation_output in get_variable(config[CONF_OSCILLATION_OUTPUT]): diff --git a/esphomeyaml/components/light/binary.py b/esphomeyaml/components/light/binary.py index c9b6214544..55beec807a 100644 --- a/esphomeyaml/components/light/binary.py +++ b/esphomeyaml/components/light/binary.py @@ -1,9 +1,9 @@ import voluptuous as vol -import esphomeyaml.config_validation as cv from esphomeyaml.components import light, output -from esphomeyaml.const import CONF_MAKE_ID, CONF_NAME, CONF_OUTPUT, CONF_EFFECTS -from esphomeyaml.helpers import App, get_variable, variable, setup_component +import esphomeyaml.config_validation as cv +from esphomeyaml.const import CONF_EFFECTS, CONF_MAKE_ID, CONF_NAME, CONF_OUTPUT +from esphomeyaml.helpers import App, get_variable, setup_component, variable PLATFORM_SCHEMA = cv.nameable(light.LIGHT_PLATFORM_SCHEMA.extend({ cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(light.MakeLight), @@ -13,9 +13,9 @@ PLATFORM_SCHEMA = cv.nameable(light.LIGHT_PLATFORM_SCHEMA.extend({ def to_code(config): - for output in get_variable(config[CONF_OUTPUT]): + for output_ in get_variable(config[CONF_OUTPUT]): yield - rhs = App.make_binary_light(config[CONF_NAME], output) + rhs = App.make_binary_light(config[CONF_NAME], output_) light_struct = variable(config[CONF_MAKE_ID], rhs) light.setup_light(light_struct.Pstate, light_struct.Pmqtt, config) setup_component(light_struct.Pstate, config) diff --git a/esphomeyaml/components/light/monochromatic.py b/esphomeyaml/components/light/monochromatic.py index 4fca6287ac..bed9f65d37 100644 --- a/esphomeyaml/components/light/monochromatic.py +++ b/esphomeyaml/components/light/monochromatic.py @@ -1,10 +1,10 @@ import voluptuous as vol -import esphomeyaml.config_validation as cv from esphomeyaml.components import light, output -from esphomeyaml.const import CONF_DEFAULT_TRANSITION_LENGTH, CONF_GAMMA_CORRECT, CONF_MAKE_ID, \ - CONF_NAME, CONF_OUTPUT, CONF_EFFECTS -from esphomeyaml.helpers import App, get_variable, variable, setup_component +import esphomeyaml.config_validation as cv +from esphomeyaml.const import CONF_DEFAULT_TRANSITION_LENGTH, CONF_EFFECTS, CONF_GAMMA_CORRECT, \ + CONF_MAKE_ID, CONF_NAME, CONF_OUTPUT +from esphomeyaml.helpers import App, get_variable, setup_component, variable PLATFORM_SCHEMA = cv.nameable(light.LIGHT_PLATFORM_SCHEMA.extend({ cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(light.MakeLight), @@ -16,9 +16,9 @@ PLATFORM_SCHEMA = cv.nameable(light.LIGHT_PLATFORM_SCHEMA.extend({ def to_code(config): - for output in get_variable(config[CONF_OUTPUT]): + for output_ in get_variable(config[CONF_OUTPUT]): yield - rhs = App.make_monochromatic_light(config[CONF_NAME], output) + rhs = App.make_monochromatic_light(config[CONF_NAME], output_) light_struct = variable(config[CONF_MAKE_ID], rhs) light.setup_light(light_struct.Pstate, light_struct.Pmqtt, config) setup_component(light_struct.Pstate, config) diff --git a/esphomeyaml/components/pcf8574.py b/esphomeyaml/components/pcf8574.py index d683749fa1..e2f92d763f 100644 --- a/esphomeyaml/components/pcf8574.py +++ b/esphomeyaml/components/pcf8574.py @@ -1,11 +1,9 @@ import voluptuous as vol from esphomeyaml import pins -from esphomeyaml.components import i2c import esphomeyaml.config_validation as cv from esphomeyaml.const import CONF_ADDRESS, CONF_ID, CONF_PCF8575 -from esphomeyaml.helpers import App, Pvariable, esphomelib_ns, setup_component, Component, \ - GPIOInputPin, GPIOOutputPin, io_ns +from esphomeyaml.helpers import App, GPIOInputPin, GPIOOutputPin, Pvariable, io_ns, setup_component DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/pn532.py b/esphomeyaml/components/pn532.py index 046697dc32..a33ac791bd 100644 --- a/esphomeyaml/components/pn532.py +++ b/esphomeyaml/components/pn532.py @@ -28,11 +28,11 @@ CONFIG_SCHEMA = vol.All(cv.ensure_list, [vol.Schema({ def to_code(config): for conf in config: - for spi in get_variable(conf[CONF_SPI_ID]): + for spi_ in get_variable(conf[CONF_SPI_ID]): yield for cs in gpio_output_pin_expression(conf[CONF_CS_PIN]): yield - rhs = App.make_pn532_component(spi, cs, conf.get(CONF_UPDATE_INTERVAL)) + rhs = App.make_pn532_component(spi_, cs, conf.get(CONF_UPDATE_INTERVAL)) pn532 = Pvariable(conf[CONF_ID], rhs) for conf_ in conf.get(CONF_ON_TAG, []): diff --git a/esphomeyaml/components/rdm6300.py b/esphomeyaml/components/rdm6300.py index c6de71553a..0ede8e290f 100644 --- a/esphomeyaml/components/rdm6300.py +++ b/esphomeyaml/components/rdm6300.py @@ -18,9 +18,9 @@ CONFIG_SCHEMA = vol.All(cv.ensure_list_not_empty, [vol.Schema({ def to_code(config): for conf in config: - for uart in get_variable(conf[CONF_UART_ID]): + for uart_ in get_variable(conf[CONF_UART_ID]): yield - rhs = App.make_rdm6300_component(uart) + rhs = App.make_rdm6300_component(uart_) var = Pvariable(conf[CONF_ID], rhs) setup_component(var, conf) diff --git a/esphomeyaml/components/sensor/__init__.py b/esphomeyaml/components/sensor/__init__.py index f11ed35a46..846c08ea81 100644 --- a/esphomeyaml/components/sensor/__init__.py +++ b/esphomeyaml/components/sensor/__init__.py @@ -1,18 +1,18 @@ import voluptuous as vol +from esphomeyaml import automation from esphomeyaml.components import mqtt import esphomeyaml.config_validation as cv -from esphomeyaml import automation from esphomeyaml.const import CONF_ABOVE, CONF_ACCURACY_DECIMALS, CONF_ALPHA, CONF_BELOW, \ CONF_DEBOUNCE, CONF_DELTA, CONF_EXPIRE_AFTER, CONF_EXPONENTIAL_MOVING_AVERAGE, CONF_FILTERS, \ CONF_FILTER_NAN, CONF_FILTER_OUT, CONF_HEARTBEAT, CONF_ICON, CONF_ID, CONF_INTERNAL, \ CONF_LAMBDA, CONF_MQTT_ID, CONF_MULTIPLY, CONF_OFFSET, CONF_ON_RAW_VALUE, CONF_ON_VALUE, \ - CONF_ON_VALUE_RANGE, CONF_OR, CONF_SEND_EVERY, CONF_SLIDING_WINDOW_MOVING_AVERAGE, \ - CONF_THROTTLE, CONF_TRIGGER_ID, CONF_UNIQUE, CONF_UNIT_OF_MEASUREMENT, CONF_WINDOW_SIZE, \ - CONF_SEND_FIRST_AT -from esphomeyaml.helpers import App, ArrayInitializer, Pvariable, add, add_job, esphomelib_ns, \ - float_, process_lambda, setup_mqtt_component, templatable, Nameable, PollingComponent, Trigger, \ - Component + CONF_ON_VALUE_RANGE, CONF_OR, CONF_SEND_EVERY, CONF_SEND_FIRST_AT, \ + CONF_SLIDING_WINDOW_MOVING_AVERAGE, CONF_THROTTLE, CONF_TRIGGER_ID, CONF_UNIQUE, \ + CONF_UNIT_OF_MEASUREMENT, CONF_WINDOW_SIZE +from esphomeyaml.helpers import App, ArrayInitializer, Component, Nameable, PollingComponent, \ + Pvariable, Trigger, add, add_job, esphomelib_ns, float_, process_lambda, setup_mqtt_component, \ + templatable PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ @@ -73,7 +73,6 @@ SensorStateTrigger = sensor_ns.class_('SensorStateTrigger', Trigger.template(flo SensorRawStateTrigger = sensor_ns.class_('SensorRawStateTrigger', Trigger.template(float_)) ValueRangeTrigger = sensor_ns.class_('ValueRangeTrigger', Trigger.template(float_)) - # Filters Filter = sensor_ns.class_('Filter') SlidingWindowMovingAverageFilter = sensor_ns.class_('SlidingWindowMovingAverageFilter', Filter) @@ -90,7 +89,6 @@ DeltaFilter = sensor_ns.class_('DeltaFilter', Filter) OrFilter = sensor_ns.class_('OrFilter', Filter) UniqueFilter = sensor_ns.class_('UniqueFilter', Filter) - SENSOR_SCHEMA = cv.MQTT_COMPONENT_SCHEMA.extend({ cv.GenerateID(CONF_MQTT_ID): cv.declare_variable_id(MQTTSensorComponent), vol.Optional(CONF_UNIT_OF_MEASUREMENT): cv.string_strict, diff --git a/esphomeyaml/components/sensor/cse7766.py b/esphomeyaml/components/sensor/cse7766.py index 917266afed..091c146632 100644 --- a/esphomeyaml/components/sensor/cse7766.py +++ b/esphomeyaml/components/sensor/cse7766.py @@ -35,10 +35,10 @@ PLATFORM_SCHEMA = vol.All(sensor.PLATFORM_SCHEMA.extend({ def to_code(config): - for uart in get_variable(config[CONF_UART_ID]): + for uart_ in get_variable(config[CONF_UART_ID]): yield - rhs = App.make_cse7766(uart) + rhs = App.make_cse7766(uart_) cse = Pvariable(config[CONF_ID], rhs) if CONF_VOLTAGE in config: diff --git a/esphomeyaml/components/sensor/max6675.py b/esphomeyaml/components/sensor/max6675.py index 4a061c9bf2..5bf3907ebb 100644 --- a/esphomeyaml/components/sensor/max6675.py +++ b/esphomeyaml/components/sensor/max6675.py @@ -23,11 +23,11 @@ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ def to_code(config): - for spi in get_variable(config[CONF_SPI_ID]): + for spi_ in get_variable(config[CONF_SPI_ID]): yield for cs in gpio_output_pin_expression(config[CONF_CS_PIN]): yield - rhs = App.make_max6675_sensor(config[CONF_NAME], spi, cs, + rhs = App.make_max6675_sensor(config[CONF_NAME], spi_, cs, config.get(CONF_UPDATE_INTERVAL)) make = variable(config[CONF_MAKE_ID], rhs) max6675 = make.Pmax6675 diff --git a/esphomeyaml/components/sensor/mhz19.py b/esphomeyaml/components/sensor/mhz19.py index 1e71de7e1a..06de766952 100644 --- a/esphomeyaml/components/sensor/mhz19.py +++ b/esphomeyaml/components/sensor/mhz19.py @@ -31,9 +31,9 @@ PLATFORM_SCHEMA = sensor.PLATFORM_SCHEMA.extend({ def to_code(config): - for uart in get_variable(config[CONF_UART_ID]): + for uart_ in get_variable(config[CONF_UART_ID]): yield - rhs = App.make_mhz19_sensor(uart, config[CONF_CO2][CONF_NAME], + rhs = App.make_mhz19_sensor(uart_, config[CONF_CO2][CONF_NAME], config.get(CONF_UPDATE_INTERVAL)) make = variable(config[CONF_MAKE_ID], rhs) mhz19 = make.Pmhz19 diff --git a/esphomeyaml/components/sensor/ms5611.py b/esphomeyaml/components/sensor/ms5611.py index d2310035f0..de176b03db 100644 --- a/esphomeyaml/components/sensor/ms5611.py +++ b/esphomeyaml/components/sensor/ms5611.py @@ -1,11 +1,12 @@ import voluptuous as vol +from esphomeyaml.components import i2c, sensor import esphomeyaml.config_validation as cv -from esphomeyaml.components import sensor, i2c -from esphomeyaml.const import CONF_ADDRESS, CONF_MAKE_ID, CONF_NAME, CONF_PRESSURE, \ - CONF_TEMPERATURE, CONF_UPDATE_INTERVAL, CONF_ID -from esphomeyaml.helpers import App, Application, add, variable, setup_component, PollingComponent, \ - Pvariable +from esphomeyaml.const import CONF_ADDRESS, CONF_ID, CONF_MAKE_ID, CONF_NAME, CONF_PRESSURE, \ + CONF_TEMPERATURE, CONF_UPDATE_INTERVAL +from esphomeyaml.helpers import App, Application, PollingComponent, Pvariable, add, \ + setup_component, \ + variable DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/pmsx003.py b/esphomeyaml/components/sensor/pmsx003.py index 58ec8ffc9f..fe4f2bc089 100644 --- a/esphomeyaml/components/sensor/pmsx003.py +++ b/esphomeyaml/components/sensor/pmsx003.py @@ -60,10 +60,10 @@ PLATFORM_SCHEMA = vol.All(sensor.PLATFORM_SCHEMA.extend({ def to_code(config): - for uart in get_variable(config[CONF_UART_ID]): + for uart_ in get_variable(config[CONF_UART_ID]): yield - rhs = App.make_pmsx003(uart, PMSX003_TYPES[config[CONF_TYPE]]) + rhs = App.make_pmsx003(uart_, PMSX003_TYPES[config[CONF_TYPE]]) pms = Pvariable(config[CONF_ID], rhs) if CONF_PM_1_0 in config: diff --git a/esphomeyaml/components/sensor/total_daily_energy.py b/esphomeyaml/components/sensor/total_daily_energy.py index 0ddf867a05..86f4678a2b 100644 --- a/esphomeyaml/components/sensor/total_daily_energy.py +++ b/esphomeyaml/components/sensor/total_daily_energy.py @@ -20,11 +20,11 @@ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ def to_code(config): - for time in get_variable(config[CONF_TIME_ID]): + for time_ in get_variable(config[CONF_TIME_ID]): yield for sens in get_variable(config[CONF_POWER_ID]): yield - rhs = App.make_total_daily_energy_sensor(config[CONF_NAME], time, sens) + rhs = App.make_total_daily_energy_sensor(config[CONF_NAME], time_, sens) make = variable(config[CONF_MAKE_ID], rhs) total_energy = make.Ptotal_energy diff --git a/esphomeyaml/components/switch/output.py b/esphomeyaml/components/switch/output.py index c0a293af9c..4616c2127e 100644 --- a/esphomeyaml/components/switch/output.py +++ b/esphomeyaml/components/switch/output.py @@ -1,9 +1,9 @@ import voluptuous as vol +from esphomeyaml.components import output, switch import esphomeyaml.config_validation as cv -from esphomeyaml.components import switch, output from esphomeyaml.const import CONF_MAKE_ID, CONF_NAME, CONF_OUTPUT -from esphomeyaml.helpers import App, Application, get_variable, variable, setup_component, Component +from esphomeyaml.helpers import App, Application, Component, get_variable, setup_component, variable MakeOutputSwitch = Application.struct('MakeOutputSwitch') OutputSwitch = switch.switch_ns.class_('OutputSwitch', switch.Switch, Component) @@ -16,12 +16,12 @@ PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({ def to_code(config): - for output in get_variable(config[CONF_OUTPUT]): + for output_ in get_variable(config[CONF_OUTPUT]): yield - rhs = App.make_output_switch(config[CONF_NAME], output) + rhs = App.make_output_switch(config[CONF_NAME], output_) make = variable(config[CONF_MAKE_ID], rhs) switch_ = make.Pswitch_ - + switch.setup_switch(switch_, make.Pmqtt, config) setup_component(switch, config) diff --git a/esphomeyaml/components/web_server.py b/esphomeyaml/components/web_server.py index dc1f7b6d7f..8a3a06436d 100644 --- a/esphomeyaml/components/web_server.py +++ b/esphomeyaml/components/web_server.py @@ -1,12 +1,10 @@ -import logging - import voluptuous as vol -import esphomeyaml.config_validation as cv from esphomeyaml import core -from esphomeyaml.const import CONF_PORT, CONF_JS_URL, CONF_CSS_URL, CONF_ID, ESP_PLATFORM_ESP32 -from esphomeyaml.helpers import App, add, Pvariable, esphomelib_ns, setup_component, Component, \ - StoringController +import esphomeyaml.config_validation as cv +from esphomeyaml.const import CONF_CSS_URL, CONF_ID, CONF_JS_URL, CONF_PORT, ESP_PLATFORM_ESP32 +from esphomeyaml.helpers import App, Component, Pvariable, StoringController, add, esphomelib_ns, \ + setup_component WebServer = esphomelib_ns.class_('WebServer', Component, StoringController) diff --git a/esphomeyaml/config.py b/esphomeyaml/config.py index f891be6f34..9aaefbe860 100644 --- a/esphomeyaml/config.py +++ b/esphomeyaml/config.py @@ -108,7 +108,7 @@ def do_id_pass(result): for id, prefix, config in searching_ids: if id.id is not None: # manually declared - match = next((v[0] for v in declare_ids if v[0].id == id.id ), None) + match = next((v[0] for v in declare_ids if v[0].id == id.id), None) if match is None: # No declared ID with this name result.add_error("Couldn't find ID {}".format(id.id), '.'.join(prefix), config) diff --git a/esphomeyaml/helpers.py b/esphomeyaml/helpers.py index cbcaf54ede..fcd368bbbf 100644 --- a/esphomeyaml/helpers.py +++ b/esphomeyaml/helpers.py @@ -595,6 +595,7 @@ class MockObjClass(MockObj): if not isinstance(paren, MockObjClass): raise ValueError self._parents.append(paren) + # pylint: disable=protected-access self._parents += paren._parents def inherits_from(self, other):