mirror of
https://github.com/esphome/esphome.git
synced 2025-09-02 19:32:19 +01:00
preen
This commit is contained in:
@@ -140,32 +140,7 @@ select:
|
|||||||
ESP_LOGI("test", "Main Mode set to %s", x.c_str());
|
ESP_LOGI("test", "Main Mode set to %s", x.c_str());
|
||||||
id(mode_main).state = x;
|
id(mode_main).state = x;
|
||||||
|
|
||||||
# Test sensors for reading entity states
|
# Button to trigger preference logging test
|
||||||
sensor:
|
|
||||||
- platform: template
|
|
||||||
name: Switch State A
|
|
||||||
id: switch_state_a
|
|
||||||
device_id: device_a
|
|
||||||
lambda: |-
|
|
||||||
return id(light_device_a).state ? 1.0 : 0.0;
|
|
||||||
update_interval: 0.5s
|
|
||||||
|
|
||||||
- platform: template
|
|
||||||
name: Switch State B
|
|
||||||
id: switch_state_b
|
|
||||||
device_id: device_b
|
|
||||||
lambda: |-
|
|
||||||
return id(light_device_b).state ? 1.0 : 0.0;
|
|
||||||
update_interval: 0.5s
|
|
||||||
|
|
||||||
- platform: template
|
|
||||||
name: Switch State Main
|
|
||||||
id: switch_state_main
|
|
||||||
lambda: |-
|
|
||||||
return id(light_main).state ? 1.0 : 0.0;
|
|
||||||
update_interval: 0.5s
|
|
||||||
|
|
||||||
# Button to trigger preference save/restore test
|
|
||||||
button:
|
button:
|
||||||
- platform: template
|
- platform: template
|
||||||
name: Test Preferences
|
name: Test Preferences
|
||||||
|
@@ -5,7 +5,7 @@ from __future__ import annotations
|
|||||||
import asyncio
|
import asyncio
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from aioesphomeapi import ButtonInfo, NumberInfo, SelectInfo, SensorInfo, SwitchInfo
|
from aioesphomeapi import ButtonInfo, NumberInfo, SelectInfo, SwitchInfo
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from .types import APIClientConnectedFactory, RunCompiledFunction
|
from .types import APIClientConnectedFactory, RunCompiledFunction
|
||||||
@@ -95,16 +95,6 @@ async def test_multi_device_preferences(
|
|||||||
]
|
]
|
||||||
assert len(selects) == 3, f"Expected 3 'Mode' selects, got {len(selects)}"
|
assert len(selects) == 3, f"Expected 3 'Mode' selects, got {len(selects)}"
|
||||||
|
|
||||||
# Check sensors for switch state monitoring
|
|
||||||
state_sensors = [
|
|
||||||
e
|
|
||||||
for e in entities
|
|
||||||
if isinstance(e, SensorInfo) and "Switch State" in e.name
|
|
||||||
]
|
|
||||||
assert len(state_sensors) == 3, (
|
|
||||||
f"Expected 3 'Switch State' sensors, got {len(state_sensors)}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Find the test button entity to trigger preference logging
|
# Find the test button entity to trigger preference logging
|
||||||
buttons = [e for e in entities if isinstance(e, ButtonInfo)]
|
buttons = [e for e in entities if isinstance(e, ButtonInfo)]
|
||||||
test_button = next((b for b in buttons if b.name == "Test Preferences"), None)
|
test_button = next((b for b in buttons if b.name == "Test Preferences"), None)
|
||||||
|
Reference in New Issue
Block a user