From 23cf120977468cebefd863aa9c6ef6b97b7994f9 Mon Sep 17 00:00:00 2001 From: rspaargaren Date: Wed, 10 Feb 2021 13:20:31 +0100 Subject: [PATCH] Added codeowners (#1487) --- CODEOWNERS | 1 + esphome/components/max7219digit/display.py | 81 +++++++++++++--------- 2 files changed, 50 insertions(+), 32 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index d5df9e8109..0f22c8ace9 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -45,6 +45,7 @@ esphome/components/json/* @OttoWinter esphome/components/ledc/* @OttoWinter esphome/components/light/* @esphome/core esphome/components/logger/* @esphome/core +esphome/components/max7219digit/* @rspaargaren esphome/components/mcp23s08/* @SenexCrenshaw esphome/components/mcp23s17/* @SenexCrenshaw esphome/components/mcp2515/* @danielschramm @mvturnho diff --git a/esphome/components/max7219digit/display.py b/esphome/components/max7219digit/display.py index e9aba13287..4863312b5a 100644 --- a/esphome/components/max7219digit/display.py +++ b/esphome/components/max7219digit/display.py @@ -3,45 +3,61 @@ import esphome.config_validation as cv from esphome.components import display, spi from esphome.const import CONF_ID, CONF_INTENSITY, CONF_LAMBDA, CONF_NUM_CHIPS -DEPENDENCIES = ['spi'] +CODEOWNERS = ["@rspaargaren"] +DEPENDENCIES = ["spi"] -CONF_ROTATE_CHIP = 'rotate_chip' -CONF_SCROLL_SPEED = 'scroll_speed' -CONF_SCROLL_DWELL = 'scroll_dwell' -CONF_SCROLL_DELAY = 'scroll_delay' -CONF_SCROLL_ENABLE = 'scroll_enable' -CONF_SCROLL_MODE = 'scroll_mode' -CONF_REVERSE_ENABLE = 'reverse_enable' +CONF_ROTATE_CHIP = "rotate_chip" +CONF_SCROLL_SPEED = "scroll_speed" +CONF_SCROLL_DWELL = "scroll_dwell" +CONF_SCROLL_DELAY = "scroll_delay" +CONF_SCROLL_ENABLE = "scroll_enable" +CONF_SCROLL_MODE = "scroll_mode" +CONF_REVERSE_ENABLE = "reverse_enable" SCROLL_MODES = { - 'CONTINUOUS': 0, - 'STOP': 1, + "CONTINUOUS": 0, + "STOP": 1, } CHIP_MODES = { - '0': 0, - '90': 1, - '180': 2, - '270': 3, + "0": 0, + "90": 1, + "180": 2, + "270": 3, } -max7219_ns = cg.esphome_ns.namespace('max7219digit') -MAX7219Component = max7219_ns.class_('MAX7219Component', cg.PollingComponent, spi.SPIDevice, - display.DisplayBuffer) -MAX7219ComponentRef = MAX7219Component.operator('ref') +max7219_ns = cg.esphome_ns.namespace("max7219digit") +MAX7219Component = max7219_ns.class_( + "MAX7219Component", cg.PollingComponent, spi.SPIDevice, display.DisplayBuffer +) +MAX7219ComponentRef = MAX7219Component.operator("ref") -CONFIG_SCHEMA = display.BASIC_DISPLAY_SCHEMA.extend({ - cv.GenerateID(): cv.declare_id(MAX7219Component), - cv.Optional(CONF_NUM_CHIPS, default=4): cv.int_range(min=1, max=255), - cv.Optional(CONF_INTENSITY, default=15): cv.int_range(min=0, max=15), - cv.Optional(CONF_ROTATE_CHIP, default='0'): cv.enum(CHIP_MODES, upper=True), - cv.Optional(CONF_SCROLL_MODE, default='CONTINUOUS'): cv.enum(SCROLL_MODES, upper=True), - cv.Optional(CONF_SCROLL_ENABLE, default=True): cv.boolean, - cv.Optional(CONF_SCROLL_SPEED, default='250ms'): cv.positive_time_period_milliseconds, - cv.Optional(CONF_SCROLL_DELAY, default='1000ms'): cv.positive_time_period_milliseconds, - cv.Optional(CONF_SCROLL_DWELL, default='1000ms'): cv.positive_time_period_milliseconds, - cv.Optional(CONF_REVERSE_ENABLE, default=False): cv.boolean, -}).extend(cv.polling_component_schema('500ms')).extend(spi.spi_device_schema(cs_pin_required=True)) +CONFIG_SCHEMA = ( + display.BASIC_DISPLAY_SCHEMA.extend( + { + cv.GenerateID(): cv.declare_id(MAX7219Component), + cv.Optional(CONF_NUM_CHIPS, default=4): cv.int_range(min=1, max=255), + cv.Optional(CONF_INTENSITY, default=15): cv.int_range(min=0, max=15), + cv.Optional(CONF_ROTATE_CHIP, default="0"): cv.enum(CHIP_MODES, upper=True), + cv.Optional(CONF_SCROLL_MODE, default="CONTINUOUS"): cv.enum( + SCROLL_MODES, upper=True + ), + cv.Optional(CONF_SCROLL_ENABLE, default=True): cv.boolean, + cv.Optional( + CONF_SCROLL_SPEED, default="250ms" + ): cv.positive_time_period_milliseconds, + cv.Optional( + CONF_SCROLL_DELAY, default="1000ms" + ): cv.positive_time_period_milliseconds, + cv.Optional( + CONF_SCROLL_DWELL, default="1000ms" + ): cv.positive_time_period_milliseconds, + cv.Optional(CONF_REVERSE_ENABLE, default=False): cv.boolean, + } + ) + .extend(cv.polling_component_schema("500ms")) + .extend(spi.spi_device_schema(cs_pin_required=True)) +) def to_code(config): @@ -61,6 +77,7 @@ def to_code(config): cg.add(var.set_reverse(config[CONF_REVERSE_ENABLE])) if CONF_LAMBDA in config: - lambda_ = yield cg.process_lambda(config[CONF_LAMBDA], [(MAX7219ComponentRef, 'it')], - return_type=cg.void) + lambda_ = yield cg.process_lambda( + config[CONF_LAMBDA], [(MAX7219ComponentRef, "it")], return_type=cg.void + ) cg.add(var.set_writer(lambda_))