From e5ac747225de272bfe92d34ec2ce7f98e50370b8 Mon Sep 17 00:00:00 2001 From: brisk Date: Sun, 29 Sep 2024 22:19:14 +0930 Subject: [PATCH] pulse_counter_ulp: Validate platform properly Only available on ESP32 with ESP-IDF --- esphome/components/pulse_counter_ulp/sensor.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/esphome/components/pulse_counter_ulp/sensor.py b/esphome/components/pulse_counter_ulp/sensor.py index dd2be479e6..805abf332a 100644 --- a/esphome/components/pulse_counter_ulp/sensor.py +++ b/esphome/components/pulse_counter_ulp/sensor.py @@ -8,7 +8,6 @@ from esphome.const import ( CONF_COUNT_MODE, CONF_DEBOUNCE, CONF_FALLING_EDGE, - CONF_NUMBER, CONF_PIN, CONF_RISING_EDGE, CONF_SLEEP_DURATION, @@ -16,7 +15,6 @@ from esphome.const import ( STATE_CLASS_MEASUREMENT, UNIT_PULSES_PER_MINUTE, ) -from esphome.core import CORE pulse_counter_ulp_ns = cg.esphome_ns.namespace("pulse_counter_ulp") CountMode = pulse_counter_ulp_ns.enum("CountMode", is_class=True) @@ -35,10 +33,6 @@ PulseCounterUlpSensor = pulse_counter_ulp_ns.class_( def validate_pulse_counter_pin(value): value = pins.internal_gpio_input_pin_schema(value) - if CORE.is_esp8266 and value[CONF_NUMBER] >= 16: - raise cv.Invalid( - "Pins GPIO16 and GPIO17 cannot be used as pulse counters on ESP8266." - ) return value @@ -86,6 +80,8 @@ CONFIG_SCHEMA = cv.All( }, ) .extend(cv.polling_component_schema("60s")), + cv.only_on_esp32, + cv.only_with_esp_idf, )