1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-01 19:02:18 +01:00

Add support for LN882X Family (with LibreTiny) (#8954)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
lamauny
2025-06-30 06:20:36 +02:00
committed by GitHub
parent 9890659f61
commit d86f319d66
33 changed files with 495 additions and 15 deletions

View File

@@ -0,0 +1,4 @@
sensor:
- platform: adc
pin: PA0
name: Basic ADC Test

View File

@@ -0,0 +1,2 @@
packages:
common: !include common.yaml

View File

@@ -0,0 +1 @@
<<: !include common.yaml

View File

@@ -0,0 +1,2 @@
packages:
common: !include common.yaml

View File

@@ -0,0 +1 @@
<<: !include common.yaml

View File

@@ -0,0 +1 @@
<<: !include common.yaml

View File

@@ -0,0 +1,2 @@
packages:
common: !include common.yaml

View File

@@ -0,0 +1 @@
<<: !include common.yaml

View File

@@ -0,0 +1,2 @@
packages:
common: !include common.yaml

View File

@@ -0,0 +1,15 @@
esphome:
name: componenttestespln882x
friendly_name: $component_name
ln882x:
board: generic-ln882hki
logger:
level: VERY_VERBOSE
packages:
component_under_test: !include
file: $component_test_file
vars:
component_test_file: $component_test_file

View File

@@ -20,6 +20,7 @@ from esphome.const import (
PLATFORM_ESP32,
PLATFORM_ESP8266,
PLATFORM_HOST,
PLATFORM_LN882X,
PLATFORM_RP2040,
PLATFORM_RTL87XX,
)
@@ -214,7 +215,8 @@ def hex_int__valid(value):
("arduino", PLATFORM_RP2040, None, "20", "20", "20", "20"),
("arduino", PLATFORM_BK72XX, None, "21", "21", "21", "21"),
("arduino", PLATFORM_RTL87XX, None, "22", "22", "22", "22"),
("host", PLATFORM_HOST, None, "23", "23", "23", "23"),
("arduino", PLATFORM_LN882X, None, "23", "23", "23", "23"),
("host", PLATFORM_HOST, None, "24", "24", "24", "24"),
],
)
def test_split_default(framework, platform, variant, full, idf, arduino, simple):
@@ -244,7 +246,8 @@ def test_split_default(framework, platform, variant, full, idf, arduino, simple)
"rp2040": "20",
"bk72xx": "21",
"rtl87xx": "22",
"host": "23",
"ln882x": "23",
"host": "24",
}
idf_mappings = {

View File

@@ -8,6 +8,7 @@ import pytest
from esphome.components.bk72xx.boards import BK72XX_BOARD_PINS
from esphome.components.esp32.boards import ESP32_BOARD_PINS
from esphome.components.esp8266.boards import ESP8266_BOARD_PINS
from esphome.components.ln882x.boards import LN882X_BOARD_PINS
from esphome.components.rtl87xx.boards import RTL87XX_BOARD_PINS
from esphome.core import CORE
import esphome.wizard as wz
@@ -187,6 +188,27 @@ def test_wizard_write_defaults_platform_from_board_bk72xx(
assert "bk72xx:" in generated_config
def test_wizard_write_defaults_platform_from_board_ln882x(
default_config, tmp_path, monkeypatch
):
"""
If the platform is not explicitly set, use "LN882X" if the board is one of LN882X boards
"""
# Given
del default_config["platform"]
default_config["board"] = [*LN882X_BOARD_PINS][0]
monkeypatch.setattr(wz, "write_file", MagicMock())
monkeypatch.setattr(CORE, "config_path", os.path.dirname(tmp_path))
# When
wz.wizard_write(tmp_path, **default_config)
# Then
generated_config = wz.write_file.call_args.args[1]
assert "ln882x:" in generated_config
def test_wizard_write_defaults_platform_from_board_rtl87xx(
default_config, tmp_path, monkeypatch
):