From f8ce597918e9b4bd0e3da9a01d72e9726d5afcfe Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 25 Oct 2022 13:47:48 +1300 Subject: [PATCH] Fix error with require_framework_version and rp2040 (#3923) --- esphome/config_validation.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/esphome/config_validation.py b/esphome/config_validation.py index 19d4747575..afc800f3f2 100644 --- a/esphome/config_validation.py +++ b/esphome/config_validation.py @@ -44,6 +44,7 @@ from esphome.const import ( KEY_CORE, KEY_FRAMEWORK_VERSION, KEY_TARGET_FRAMEWORK, + KEY_TARGET_PLATFORM, ) from esphome.core import ( CORE, @@ -1734,6 +1735,7 @@ def require_framework_version( esp_idf=None, esp32_arduino=None, esp8266_arduino=None, + rp2040_arduino=None, max_version=False, extra_message=None, ): @@ -1761,8 +1763,23 @@ def require_framework_version( msg += f". {extra_message}" raise Invalid(msg) required = esp8266_arduino + elif CORE.is_rp2040 and framework == "arduino": + if rp2040_arduino is None: + msg = "This feature is incompatible with RP2040" + if extra_message: + msg += f". {extra_message}" + raise Invalid(msg) + required = rp2040_arduino else: - raise NotImplementedError + raise Invalid( + f""" + Internal Error: require_framework_version does not support this platform configuration + platform: {core_data[KEY_TARGET_PLATFORM]} + framework: {framework} + + Please report this issue on GitHub -> https://github.com/esphome/issues/issues/new?template=bug_report.yml. + """ + ) if max_version: if core_data[KEY_FRAMEWORK_VERSION] > required: