[Feature]: Bind Home Assistant sensors to storage locations (dryboxes/bins) (#2827)

This commit is contained in:
MagicMelody84
2026-08-25 12:17:23 +02:00
committed by GitHub
parent 5dd7bd213f
commit 54af3146a3
75 changed files with 8146 additions and 342 deletions
@@ -0,0 +1,26 @@
"""Every event_type in EVENT_VARIABLES needs a matching SAMPLE_DATA entry.
Regression: location_ha_sensor_alert (#2824) was added to EVENT_VARIABLES but
never given a SAMPLE_DATA entry. The template preview endpoint falls back to
an empty sample dict for an event type it has no data for, so every
{placeholder} in the template silently disappears — "{location}: {sensor} is
{state}" rendered as just ": is " with nothing to say what did what.
"""
from backend.app.schemas.notification_template import EVENT_VARIABLES, SAMPLE_DATA
def test_every_event_type_has_sample_data():
missing = sorted(set(EVENT_VARIABLES) - set(SAMPLE_DATA))
assert missing == [], f"EVENT_VARIABLES entries with no SAMPLE_DATA: {missing}"
def test_sample_data_covers_every_variable_its_event_type_declares():
# A partial sample (declared variable missing a sample value) produces
# the same silent-blank symptom as a missing sample entirely.
incomplete = {
event_type: sorted(set(variables) - set(SAMPLE_DATA.get(event_type, {})))
for event_type, variables in EVENT_VARIABLES.items()
}
incomplete = {k: v for k, v in incomplete.items() if v}
assert incomplete == {}, f"Event types with variables missing from their sample data: {incomplete}"