Improve learning discovery and dashboard i18n
This commit is contained in:
@@ -87,7 +87,7 @@ def _service(
|
||||
|
||||
|
||||
def test_reconciliation_auto_assigns_and_trains_numeric_model(tmp_path: Path) -> None:
|
||||
start = datetime(2026, 6, 1, tzinfo=timezone.utc)
|
||||
start = datetime.now(timezone.utc) - timedelta(days=1)
|
||||
entities = [
|
||||
HaEntitySummary(
|
||||
entity_id="light.abstellkammer",
|
||||
@@ -352,6 +352,100 @@ def test_fan_prefers_humidity_over_power_sensor(tmp_path: Path) -> None:
|
||||
assert record.assignment.selected_numeric_entity_id == "sensor.bad_luftfeuchtigkeit"
|
||||
|
||||
|
||||
def test_lidl_light_uses_room_presence_not_brand_overlap(tmp_path: Path) -> None:
|
||||
entities = [
|
||||
HaEntitySummary(
|
||||
entity_id="light.lidl_kuche",
|
||||
domain="light",
|
||||
friendly_name="Lidl Küche",
|
||||
),
|
||||
HaEntitySummary(
|
||||
entity_id="light.lidl_wohnzimmer",
|
||||
domain="light",
|
||||
friendly_name="Lidl Wohnzimmer",
|
||||
),
|
||||
HaEntitySummary(
|
||||
entity_id="binary_sensor.pir_kuche_motion_detection",
|
||||
domain="binary_sensor",
|
||||
device_class="motion",
|
||||
friendly_name="Bewegungsmelder",
|
||||
device_name="PIR_Küche",
|
||||
),
|
||||
HaEntitySummary(
|
||||
entity_id="binary_sensor.pir_wohnzimmer_sensor_state_any",
|
||||
domain="binary_sensor",
|
||||
device_class="motion",
|
||||
friendly_name="Bewegungsmelder",
|
||||
device_name="PIR_Wohnzimmer",
|
||||
),
|
||||
]
|
||||
service = _service(tmp_path, entities, {})
|
||||
|
||||
record = service.configure_actuator("light.lidl_kuche")
|
||||
|
||||
assert record.assignment.selected_context_entity_ids == [
|
||||
"binary_sensor.pir_kuche_motion_detection"
|
||||
]
|
||||
|
||||
|
||||
def test_mailbox_reset_button_uses_cabinet_door_context(tmp_path: Path) -> None:
|
||||
entities = [
|
||||
HaEntitySummary(
|
||||
entity_id="button.smart_mailbox_als_geleert_markieren",
|
||||
domain="button",
|
||||
friendly_name="Smart Mailbox Als geleert markieren",
|
||||
),
|
||||
HaEntitySummary(
|
||||
entity_id="binary_sensor.schrank_strasse_open",
|
||||
domain="binary_sensor",
|
||||
device_class="door",
|
||||
friendly_name="Schrank Straße",
|
||||
),
|
||||
]
|
||||
service = _service(tmp_path, entities, {})
|
||||
|
||||
record = service.configure_actuator("button.smart_mailbox_als_geleert_markieren")
|
||||
|
||||
assert record.assignment.selected_context_entity_ids == [
|
||||
"binary_sensor.schrank_strasse_open"
|
||||
]
|
||||
assert record.assignment.review_required is False
|
||||
|
||||
|
||||
def test_fan_auto_selects_humidity_and_occupancy_context(tmp_path: Path) -> None:
|
||||
start = datetime(2026, 6, 1, tzinfo=timezone.utc)
|
||||
entities = [
|
||||
HaEntitySummary(
|
||||
entity_id="humidifier.gastewc_luftung",
|
||||
domain="humidifier",
|
||||
friendly_name="GästeWC Lüftung",
|
||||
),
|
||||
HaEntitySummary(
|
||||
entity_id="sensor.pir_gastewc_humidity",
|
||||
domain="sensor",
|
||||
device_class="humidity",
|
||||
state_class="measurement",
|
||||
unit_of_measurement="%",
|
||||
friendly_name="Gäste WC Luftfeuchtigkeit",
|
||||
),
|
||||
HaEntitySummary(
|
||||
entity_id="input_boolean.gaste_wc_occupied",
|
||||
domain="input_boolean",
|
||||
friendly_name="gaste_wc_occupied",
|
||||
),
|
||||
]
|
||||
service = _service(
|
||||
tmp_path,
|
||||
entities,
|
||||
{"sensor.pir_gastewc_humidity": _points(8, start, 55.0)},
|
||||
)
|
||||
|
||||
record = service.configure_actuator("humidifier.gastewc_luftung")
|
||||
|
||||
assert record.assignment.selected_numeric_entity_id == "sensor.pir_gastewc_humidity"
|
||||
assert "input_boolean.gaste_wc_occupied" in record.assignment.selected_context_entity_ids
|
||||
|
||||
|
||||
def test_manual_assignment_persists_and_wins_over_automatic_mapping(tmp_path: Path) -> None:
|
||||
start = datetime(2026, 6, 1, tzinfo=timezone.utc)
|
||||
entities = [
|
||||
|
||||
Reference in New Issue
Block a user