mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 23:37:34 +00:00
[remote_base] Cover transmit action names in the protocol source test and assert the rc_switch table layout
This commit is contained in:
@@ -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},
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user