Fix KeyError in ESPHome 2024.6.X

This commit is contained in:
ghisch 2024-06-20 18:41:00 +02:00 committed by GitHub
parent 980271337a
commit 31ed3068fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,7 @@ from esphome.const import (
CONF_MODE,
CONF_FAN_MODE,
CONF_SWING_MODE,
PLATFORM_ESP8266
)
from esphome.core import CORE, coroutine
@ -63,7 +64,7 @@ CONFIG_SCHEMA = climate.CLIMATE_SCHEMA.extend(
@coroutine
def to_code(config):
serial = HARDWARE_UART_TO_SERIAL[config[CONF_HARDWARE_UART]]
serial = HARDWARE_UART_TO_SERIAL[PLATFORM_ESP8266][config[CONF_HARDWARE_UART]]
var = cg.new_Pvariable(config[CONF_ID], cg.RawExpression(f"&{serial}"))
if CONF_BAUD_RATE in config: