From 798400908e8aef85ee447b14054339495714feda Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 11 Sep 2026 08:26:26 -0500 Subject: [PATCH] [remote_base] Cover transmit action names in the protocol source test and assert the rc_switch table layout --- esphome/components/remote_base/rc_switch_protocol.h | 4 +++- tests/component_tests/remote_receiver/test_slot_counts.py | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/esphome/components/remote_base/rc_switch_protocol.h b/esphome/components/remote_base/rc_switch_protocol.h index 151294c6a2..5885df180d 100644 --- a/esphome/components/remote_base/rc_switch_protocol.h +++ b/esphome/components/remote_base/rc_switch_protocol.h @@ -68,7 +68,9 @@ class RCSwitchBase { uint32_t inverted_{}; // bool widened so every field is a word: the table is read from flash }; -// Constant-initialized and kept in flash on every platform +// Constant-initialized and kept in flash on every platform; ESP8266 reads it in place, which only +// works while every field is a whole word +static_assert(sizeof(RCSwitchBase) == 7 * sizeof(uint32_t), "RCSwitchBase must stay word-only for flash reads"); inline constexpr RCSwitchBase RC_SWITCH_PROTOCOLS[] PROGMEM = { {0, 0, 0, 0, 0, 0, false}, {350, 10850, 350, 1050, 1050, 350, false}, diff --git a/tests/component_tests/remote_receiver/test_slot_counts.py b/tests/component_tests/remote_receiver/test_slot_counts.py index b59513bd77..55d963fa99 100644 --- a/tests/component_tests/remote_receiver/test_slot_counts.py +++ b/tests/component_tests/remote_receiver/test_slot_counts.py @@ -5,6 +5,7 @@ from pathlib import Path import pytest +from esphome.automation import ACTION_REGISTRY from esphome.components import remote_base import esphome.config_validation as cv @@ -59,7 +60,13 @@ def test_every_registry_name_maps_to_a_protocol_source() -> None: set(remote_base.BINARY_SENSOR_REGISTRY) | set(remote_base.DUMPER_REGISTRY) | {key.removeprefix("on_") for key in remote_base.TRIGGER_REGISTRY} + | { + key.removeprefix("remote_transmitter.transmit_") + for key in ACTION_REGISTRY + if key.startswith("remote_transmitter.transmit_") + } ) + assert len(names) > 40 for name in names: assert remote_base._protocol_stem(name) in remote_base._PROTOCOL_STEMS, name