diff --git a/webhook.py b/webhook.py index 88abf07..f66571a 100644 --- a/webhook.py +++ b/webhook.py @@ -19,7 +19,7 @@ async def webhook_info(): Endpoints: GET/POST /{durchwahl}/callstart - Anruf gestartet (WLED -> Rot) - GET/POST /{durchwahl}/callend - Anruf beendet (WLED -> zurueck auf Teams-Status) + GET/POST /{durchwahl}/callend - Anruf beendet (WLED -> zurueck auf Zeiterfassungs-Status) Beispiel: curl http://localhost:8081/123/callstart @@ -108,14 +108,14 @@ async def call_end(extension: str): if aida not in ("anwesend", "homeoffice"): return f"Ignored: {user['display_name']} not in office" - # Farbe zuruecksetzen basierend auf aktuellem Status - teams = user["last_teams_status"] or "" - if aida == "homeoffice": - color = _get_color("homeoffice", conn) - elif teams: - color = _get_color(teams, conn) - else: + # Farbe zuruecksetzen auf Zeiterfassungs-Status + # (Teams-Farbe kommt automatisch beim naechsten Polling) + if aida == "anwesend": color = _get_color("available", conn) + elif aida == "homeoffice": + color = _get_color("homeoffice", conn) + else: + color = _get_color("abwesend", conn) url = build_wled_url( user["hostname"], color["r"], color["g"], color["b"], @@ -131,7 +131,7 @@ async def call_end(extension: str): log_activity( user["azure_id"], user["display_name"], - aida, f"phone_end -> {teams}", url, result_text, + aida, "phone_end", url, result_text, ) logger.info("Webhook callend: %s -> %s (%s)", user["display_name"], result_text, teams)