d2775e35d9
The HA Companion app needs an external_url for clickable notification deep-links to resolve when the phone is off the home Wi-Fi. Reach is via Tailscale (Headscale tailnet solar.internal), so external_url points at the FQDN jupiter.solar.internal:8123; internal_url stays on the bare hostname for LAN-attached devices. Phase A only: device registration + notify group + smoke-test land in a follow-up commit once Companion has registered real mobile_app_<slug> service names. See docs/superpowers/specs/2026-05-18-ha-push-notifications.md. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
80 lines
2.1 KiB
Nix
80 lines
2.1 KiB
Nix
# manages home automations
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
self,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.my.profiles.home-assistant;
|
|
hostName = config.networking.hostName;
|
|
in
|
|
{
|
|
imports = [
|
|
# services.openthread-border-router isn't in nixos-25.11; pull from
|
|
# nixpkgs-unstable. Package comes from the existing unstable overlay.
|
|
"${self.inputs.nixpkgs-unstable}/nixos/modules/services/home-automation/openthread-border-router.nix"
|
|
];
|
|
|
|
options.my.profiles.home-assistant = with lib; {
|
|
enable = mkEnableOption "Home Automation";
|
|
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services.matter-server.enable = true;
|
|
|
|
services.home-assistant = {
|
|
enable = true;
|
|
openFirewall = true;
|
|
extraComponents = [
|
|
"matter"
|
|
"mobile_app"
|
|
"otbr"
|
|
"thread"
|
|
"xiaomi_miio"
|
|
];
|
|
};
|
|
services.home-assistant.config = {
|
|
homeassistant = {
|
|
name = "Home - Rechberg";
|
|
unit_system = "metric";
|
|
internal_url = "http://${hostName}:8123";
|
|
external_url = "http://jupiter.solar.internal:8123";
|
|
};
|
|
mobile_app = {};
|
|
automation = "!include automations.yaml";
|
|
script = "!include scripts.yaml";
|
|
scene = "!include scenes.yaml";
|
|
};
|
|
|
|
# `!include` targets must exist or HA fails at startup. Create them empty
|
|
# so HA's UI editor can write to them; `f` only acts if the file is absent.
|
|
systemd.tmpfiles.rules = [
|
|
"f /var/lib/hass/automations.yaml 0644 hass hass - []"
|
|
"f /var/lib/hass/scripts.yaml 0644 hass hass - {}"
|
|
"f /var/lib/hass/scenes.yaml 0644 hass hass - []"
|
|
];
|
|
|
|
services.openthread-border-router = {
|
|
enable = true;
|
|
package = pkgs.unstable.openthread-border-router;
|
|
openFirewall = true;
|
|
backboneInterfaces = [ "enp3s0" ];
|
|
radio.device = "/dev/serial/by-id/usb-Nabu_Casa_ZBT-2_DCB4D9149C7C-if00";
|
|
radio.baudRate = 460800;
|
|
};
|
|
|
|
my.homepage.services = [
|
|
{
|
|
group = "Services";
|
|
name = "Home Assistant";
|
|
description = "Home automation";
|
|
href = "http://${hostName}:8123";
|
|
icon = "si-homeassistant";
|
|
}
|
|
];
|
|
};
|
|
}
|