From 7e3b8fd346b3cf91d7bf9b0be73ec4584e9a3f60 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Sat, 15 May 2021 17:02:52 +1200 Subject: [PATCH] Allow RC522 components to have multiple configurations (#1782) --- esphome/components/rc522/__init__.py | 1 - esphome/components/rc522_i2c/__init__.py | 2 +- esphome/components/rc522_spi/__init__.py | 1 + tests/test1.yaml | 13 +++++++++---- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/esphome/components/rc522/__init__.py b/esphome/components/rc522/__init__.py index 970b867e79..7858213f06 100644 --- a/esphome/components/rc522/__init__.py +++ b/esphome/components/rc522/__init__.py @@ -7,7 +7,6 @@ from esphome.core import coroutine CODEOWNERS = ["@glmnet"] AUTO_LOAD = ["binary_sensor"] -MULTI_CONF = True CONF_RC522_ID = "rc522_id" diff --git a/esphome/components/rc522_i2c/__init__.py b/esphome/components/rc522_i2c/__init__.py index 532adfce79..081536b6b1 100644 --- a/esphome/components/rc522_i2c/__init__.py +++ b/esphome/components/rc522_i2c/__init__.py @@ -6,7 +6,7 @@ from esphome.const import CONF_ID CODEOWNERS = ["@glmnet"] DEPENDENCIES = ["i2c"] AUTO_LOAD = ["rc522"] - +MULTI_CONF = True rc522_i2c_ns = cg.esphome_ns.namespace("rc522_i2c") RC522I2C = rc522_i2c_ns.class_("RC522I2C", rc522.RC522, i2c.I2CDevice) diff --git a/esphome/components/rc522_spi/__init__.py b/esphome/components/rc522_spi/__init__.py index 6ae163bcb4..2e5630f46d 100644 --- a/esphome/components/rc522_spi/__init__.py +++ b/esphome/components/rc522_spi/__init__.py @@ -6,6 +6,7 @@ from esphome.const import CONF_ID CODEOWNERS = ["@glmnet"] DEPENDENCIES = ["spi"] AUTO_LOAD = ["rc522"] +MULTI_CONF = True rc522_spi_ns = cg.esphome_ns.namespace("rc522_spi") RC522Spi = rc522_spi_ns.class_("RC522Spi", rc522.RC522, spi.SPIDevice) diff --git a/tests/test1.yaml b/tests/test1.yaml index 5695183f74..c2a79085b5 100644 --- a/tests/test1.yaml +++ b/tests/test1.yaml @@ -1982,10 +1982,15 @@ rc522_spi: ESP_LOGD("main", "Found tag %s", x.c_str()); rc522_i2c: - update_interval: 1s - on_tag: - - lambda: |- - ESP_LOGD("main", "Found tag %s", x.c_str()); + - update_interval: 1s + on_tag: + - lambda: |- + ESP_LOGD("main", "Found tag %s", x.c_str()); + + - update_interval: 1s + on_tag: + - lambda: |- + ESP_LOGD("main", "Found tag %s", x.c_str()); gps: uart_id: uart0