feat(door): add door_event event entity for pass-through timestamps
Validate YAML Configs / Validate YAML Schema (push) Failing after 11m0s

door_status stays at the same value on every pass, so HA never moves
last_changed and the logbook cannot show when the door was actually used.
An event entity's state is the timestamp of the last occurrence, so a repeated
event_type still updates it, and it is not restored across HA restarts — no
stale "entering" coming back after a reboot.

Both entities are derived from the same advertisement: door_status for the
current state, door_event for when it happened. heartbeat: 60s lets the same
event_type fire again after 60s, which is once per pass in practice.

Also teach scripts/validate.py the event platform, mirroring the app's
ConfigValidator rules: event_types required (error), map values missing from
event_types, absent decode.map, numeric metadata, and a publish rule whose
on_change_only suppresses repeats (warnings). The inherited publish rule
(sensor > device > defaults) is now threaded down to sensor validation.

Requires HassBle 1.5.0 or newer — event_types is a new key and older versions
parse config.yaml in strict mode.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
eiggerandClaude Opus 5 committed 2026-09-09 22:40:52 +09:00
1 parent 9b937c8840
commit 9e55c585f9
4 files changed
+63 -9

No files matched your search

+20
View File
@@ -183,6 +183,26 @@ devices:
"1": "entered" # 0x01 인증 완료 (entering과 동일 → 전환 노이즈 제거)
"64": "exiting" # 0x40
"0": "idle" # 0x00
# 통과 "시각"을 남기는 이벤트 엔티티 — 상태값이 마지막 발생 시각이라 같은 event_type이
# 반복돼도 매번 갱신되고, HA 재시작 때 복원되지 않아 묵은 값이 되살아나지 않는다.
# door_status(현재 상태)와 병행: 같은 광고에서 두 엔티티를 뽑는다.
- key: door_event
platform: event
event_types: [entering, entered, exiting, idle]
icon: mdi:door-open
source_field: manufacturer_data
length: 6
publish:
heartbeat: 60s # 같은 event_type이어도 60초 지났으면 재발화 = 통과마다 1회
decode:
offset: 4
length: 1
type: uint8
map:
"65": "entering"
"1": "entered"
"64": "exiting"
"0": "idle"
# ──────────────────────────────────────────────────────────────
# Path C: OBD (ELM327) over BLE