fw: migrate HA legacy template entities to modern template:, then pin to 2026.6 #137

Open
opened 2026-06-08 00:57:41 +02:00 by dominik.polakovics · 0 comments

Context

fw's Home Assistant is pinned (via fetchGit in hosts/fw/modules/home-assistant/default.nix) to HA 2026.5.4, deliberately held just below 2026.6. HA 2026.6 removed the legacy template entity platforms (- platform: template under sensor:/binary_sensor:/light: with a sensors:/lights: dict). We still use 11 of these, so they must be migrated to the modern top-level template: integration before the pin can move to 2026.6+.

This is the follow-up to the 2025.3.4 → 2026.5.4 bump (PR #138).

Scope

1. Migrate legacy template entities → modern template: integration

Pattern change: value_templatestate:, friendly_namename:, add an unique_id, drop the per-platform sensors:/lights: wrapper. Sites:

  • default.nixbedtime_alarm template sensor
  • battery.nixsensors_lowest_battery_level (sensor) and sensor_low_battery (binary_sensor)
  • ac.nix:104
  • 3dprinter.nix:33, 3dprinter.nix:48
  • locks.nix:121
  • light.nix:461hallway_group_proxy template light (see #3)
  • multimedia.nix:46, multimedia.nix:171
  • electricity.nix:11electricity_price sensor

2. Re-verify legacy light platforms before 2026.6

light.nix uses - platform: switch (Light Switch) and - platform: group (Light Group) entries. These are NOT part of the 2026.6 template removal, but confirm they still load on 2026.6; migrate to switch_as_x / modern group helpers if not.

3. Fix the template-light proxy color temp

light.nix:461-505 (hallway_group_proxy) passes color_temp (mireds) to light.turn_on in its set_temperature script — already broken on 2026.3+ if invoked (mireds param removed). Convert to color_temp_kelvin as part of migrating this entity.

4. Bump the pin to 2026.6+ and verify

Once 1–3 are done, move the default.nix fetchGit rev to a nixos-unstable commit carrying HA ≥ 2026.6 and verify (build + a real login + HA Repairs panel clean).

Notes / nice-to-haves

  • customComponents architecture (root-cause-adjacent): epex_spot (electricity.nix:4) is sourced from the host channel (pkgs.home-assistant-custom-components) while HA itself is pinned. That Python 3.13↔3.14 mismatch is what broke auth loading on the 26.05 bump. Consider sourcing customComponents from the pinned nixpkgs so HA and its components stay version-locked.
  • bermuda: runtime download is v0.7.2 (presense.nix); bump to v0.8.5 (works on 2026.5/2026.6, only a deprecation warning).
  • scheduler: custom-components/scheduler.nix is commented out; if scheduler is used via HACS, ensure the HACS-installed version supports 2026.6.
  • Backup: HA recorder DB migration is one-way — take a fresh HA + hass DB backup before the 2026.6 bump.

Caveat

UI-managed automations in /var/lib/hass/automations.yaml are not in the repo and weren't reviewed. After each bump, check Settings → System → Repairs for legacy-template / color_temp issues there too.

## Context fw's Home Assistant is pinned (via `fetchGit` in `hosts/fw/modules/home-assistant/default.nix`) to **HA 2026.5.4**, deliberately held *just below 2026.6*. HA **2026.6 removed the legacy template entity platforms** (`- platform: template` under `sensor:`/`binary_sensor:`/`light:` with a `sensors:`/`lights:` dict). We still use 11 of these, so they must be migrated to the modern top-level `template:` integration **before** the pin can move to 2026.6+. This is the follow-up to the 2025.3.4 → 2026.5.4 bump (PR #138). ## Scope ### 1. Migrate legacy template entities → modern `template:` integration Pattern change: `value_template` → `state:`, `friendly_name` → `name:`, add an `unique_id`, drop the per-platform `sensors:`/`lights:` wrapper. Sites: - `default.nix` — `bedtime_alarm` template sensor - `battery.nix` — `sensors_lowest_battery_level` (sensor) **and** `sensor_low_battery` (binary_sensor) - `ac.nix:104` - `3dprinter.nix:33`, `3dprinter.nix:48` - `locks.nix:121` - `light.nix:461` — `hallway_group_proxy` template **light** (see #3) - `multimedia.nix:46`, `multimedia.nix:171` - `electricity.nix:11` — `electricity_price` sensor ### 2. Re-verify legacy light platforms before 2026.6 `light.nix` uses `- platform: switch` (Light Switch) and `- platform: group` (Light Group) entries. These are NOT part of the 2026.6 template removal, but confirm they still load on 2026.6; migrate to `switch_as_x` / modern group helpers if not. ### 3. Fix the template-light proxy color temp `light.nix:461-505` (`hallway_group_proxy`) passes `color_temp` (mireds) to `light.turn_on` in its `set_temperature` script — already broken on 2026.3+ if invoked (mireds param removed). Convert to `color_temp_kelvin` as part of migrating this entity. ### 4. Bump the pin to 2026.6+ and verify Once 1–3 are done, move the `default.nix` `fetchGit` rev to a nixos-unstable commit carrying HA ≥ 2026.6 and verify (build + a real login + HA Repairs panel clean). ## Notes / nice-to-haves - **customComponents architecture (root-cause-adjacent):** `epex_spot` (`electricity.nix:4`) is sourced from the *host channel* (`pkgs.home-assistant-custom-components`) while HA itself is pinned. That Python 3.13↔3.14 mismatch is what broke auth loading on the 26.05 bump. Consider sourcing customComponents from the *pinned* nixpkgs so HA and its components stay version-locked. - **bermuda:** runtime download is `v0.7.2` (`presense.nix`); bump to `v0.8.5` (works on 2026.5/2026.6, only a deprecation warning). - **scheduler:** `custom-components/scheduler.nix` is commented out; if scheduler is used via HACS, ensure the HACS-installed version supports 2026.6. - **Backup:** HA recorder DB migration is one-way — take a fresh HA + `hass` DB backup before the 2026.6 bump. ## Caveat UI-managed automations in `/var/lib/hass/automations.yaml` are not in the repo and weren't reviewed. After each bump, check **Settings → System → Repairs** for legacy-template / color_temp issues there too.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/nixos#137
No description provided.