bunch of bugs
This commit is contained in:
@@ -137,6 +137,7 @@ class ArrivalMonitor:
|
||||
]
|
||||
|
||||
def _process_states(self, states: dict[str, bool]) -> None:
|
||||
arrivals: list[dict] = []
|
||||
for device in self.devices:
|
||||
present = states[device["mac"]]
|
||||
LOG.debug(
|
||||
@@ -154,6 +155,8 @@ class ArrivalMonitor:
|
||||
}
|
||||
_record_event(self.config, event, device["mac"])
|
||||
self.on_event(event)
|
||||
if transition == "arrived":
|
||||
arrivals.append(device)
|
||||
|
||||
known_states = [detector.state for detector in self.detectors.values()]
|
||||
if all(state is not None for state in known_states):
|
||||
@@ -167,6 +170,16 @@ class ArrivalMonitor:
|
||||
}
|
||||
_record_event(self.config, event)
|
||||
self.on_event(event)
|
||||
elif self._house_occupied is False and occupied:
|
||||
first = arrivals[0]
|
||||
event = {
|
||||
"sender": "_arrival_detection",
|
||||
"event": "first_arrival",
|
||||
"id": first["id"],
|
||||
"text": "",
|
||||
}
|
||||
_record_event(self.config, event, first["mac"])
|
||||
self.on_event(event)
|
||||
self._house_occupied = occupied
|
||||
|
||||
def _run(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user