From fa554c24759c92283b6d582a1b2912303b8fc997 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Thu, 1 Oct 2026 20:26:04 +0200 Subject: [PATCH] add template & mushroom cards Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- server-modules/home-assistant/default.nix | 26 +++++++++++++++++++++++ server-modules/home-assistant/plugins.nix | 1 + 2 files changed, 27 insertions(+) diff --git a/server-modules/home-assistant/default.nix b/server-modules/home-assistant/default.nix index 84b96e46..9e3b2450 100644 --- a/server-modules/home-assistant/default.nix +++ b/server-modules/home-assistant/default.nix @@ -11,6 +11,11 @@ "h" "d" ]; + + motionRooms = [ + "toilet" + "entry" + ]; in { sops.secrets = { @@ -60,6 +65,27 @@ in { automation = "!include automations.yaml"; script = "!include scripts.yaml"; frontend.themes = nixyTheme; + # Timestamp of the last motion detection (trigger-based, survives restarts) + template = + map (room: { + trigger = [ + { + trigger = "state"; + entity_id = "binary_sensor.${room}_motion"; + to = "on"; + } + ]; + sensor = [ + { + name = "${room} last motion"; + unique_id = "${room}_last_motion"; + device_class = "timestamp"; + icon = "mdi:motion-sensor"; + state = "{{ now().isoformat() }}"; + } + ]; + }) + motionRooms; alarm_control_panel = [ { platform = "manual"; diff --git a/server-modules/home-assistant/plugins.nix b/server-modules/home-assistant/plugins.nix index 99098ecb..4f321c81 100644 --- a/server-modules/home-assistant/plugins.nix +++ b/server-modules/home-assistant/plugins.nix @@ -63,5 +63,6 @@ in { multiday-calendar-card pkgs.home-assistant-custom-lovelace-modules.bubble-card pkgs.home-assistant-custom-lovelace-modules.auto-entities + pkgs.home-assistant-custom-lovelace-modules.mushroom ]; }