Compare commits
18 Commits
33ba1c7ebe
...
hass
Author | SHA1 | Date | |
---|---|---|---|
2355f9e767
|
|||
f390000e87
|
|||
0c08d3e0bf
|
|||
5fd2649cac
|
|||
493c4ef294
|
|||
66cf91aa78
|
|||
d056cb0cb1
|
|||
c38d93f36f
|
|||
963e99ec8a
|
|||
2ef90f25c5
|
|||
6c7edf43d1
|
|||
fe9fe3ec51
|
|||
99dd5ec1fe
|
|||
378f2d9882
|
|||
f8405bf012
|
|||
922e86a408
|
|||
84cd90325d
|
|||
23c24dc6ad
|
88
flake.lock
generated
88
flake.lock
generated
@ -87,11 +87,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1735644329,
|
||||
"narHash": "sha256-tO3HrHriyLvipc4xr+Ewtdlo7wM1OjXNjlWRgmM7peY=",
|
||||
"lastModified": 1728330715,
|
||||
"narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "f7795ede5b02664b57035b3b757876703e2c3eac",
|
||||
"rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -107,11 +107,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736589330,
|
||||
"narHash": "sha256-y1Y5vcr+9fHV2x1VRYFuJkpfE1cB/5FyeeO4Xwff7mY=",
|
||||
"lastModified": 1735468753,
|
||||
"narHash": "sha256-2dt1nOe9zf9pDkf5Kn7FUFyPRo581s0n90jxYXJ94l0=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "cb6297acebb15ebffef7d36b4b880b9dfe15638e",
|
||||
"rev": "84a5b93637cc16cbfcc61b6e1684d626df61eb21",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -123,11 +123,11 @@
|
||||
"firefox-gnome-theme": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1736257308,
|
||||
"narHash": "sha256-mRE/foGagh2XarMerOXtgldpxiCb/dQa7tHOpPpP2Zw=",
|
||||
"lastModified": 1735511798,
|
||||
"narHash": "sha256-U9WjPisByrvw8Kt6Ufg9kLrvg7uHPsFSyG93GR3I1iE=",
|
||||
"owner": "rafaelmardojai",
|
||||
"repo": "firefox-gnome-theme",
|
||||
"rev": "a5029a0797d9ab4d5a20f223cacddd70e3748dc8",
|
||||
"rev": "097c98cb4a7568f6f83a43e37950c08b575dd126",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -190,11 +190,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1735774679,
|
||||
"narHash": "sha256-soePLBazJk0qQdDVhdbM98vYdssfs3WFedcq+raipRI=",
|
||||
"lastModified": 1733312601,
|
||||
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "f2f7418ce0ab4a5309a4596161d154cfc877af66",
|
||||
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -231,14 +231,18 @@
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1735882644,
|
||||
"narHash": "sha256-3FZAG+pGt3OElQjesCAWeMkQ7C/nB1oTHLRQ8ceP110=",
|
||||
"lastModified": 1734797603,
|
||||
"narHash": "sha256-ulZN7ps8nBV31SE+dwkDvKIzvN6hroRY8sYOT0w+E28=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "a5a961387e75ae44cc20f0a57ae463da5e959656",
|
||||
"rev": "f0f0dc4920a903c3e08f5bdb9246bb572fcae498",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -314,11 +318,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736373539,
|
||||
"narHash": "sha256-dinzAqCjenWDxuy+MqUQq0I4zUSfaCvN9rzuCmgMZJY=",
|
||||
"lastModified": 1735344290,
|
||||
"narHash": "sha256-oJDtWPH1oJT34RJK1FSWjwX4qcGOBRkcNQPD0EbSfNM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "bd65bc3cde04c16755955630b344bc9e35272c56",
|
||||
"rev": "613691f285dad87694c2ba1c9e6298d04736292d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -402,11 +406,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1735956190,
|
||||
"narHash": "sha256-svzx3yVXD5tbBJZCn3Lt1RriH8GHo6CyVUPTHejf7sU=",
|
||||
"lastModified": 1735218083,
|
||||
"narHash": "sha256-MoUAbmXz9TEr7zlKDRO56DBJHe30+7B5X7nhXm+Vpc8=",
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "3feaf376d75d3d58ebf7e9a4f584d00628548ad9",
|
||||
"rev": "bc03f7818771a75716966ce8c23110b715eff2aa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -417,11 +421,11 @@
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1736441705,
|
||||
"narHash": "sha256-OL7leZ6KBhcDF3nEKe4aZVfIm6xQpb1Kb+mxySIP93o=",
|
||||
"lastModified": 1735388221,
|
||||
"narHash": "sha256-e5IOgjQf0SZcFCEV/gMGrsI0gCJyqOKShBQU0iiM3Kg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "8870dcaff63dfc6647fb10648b827e9d40b0a337",
|
||||
"rev": "7c674c6734f61157e321db595dbfcd8523e04e19",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -486,11 +490,11 @@
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1736344531,
|
||||
"narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=",
|
||||
"lastModified": 1735471104,
|
||||
"narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912",
|
||||
"rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -517,11 +521,11 @@
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1736200483,
|
||||
"narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=",
|
||||
"lastModified": 1735669367,
|
||||
"narHash": "sha256-tfYRbFhMOnYaM4ippqqid3BaLOXoFNdImrfBfCp4zn0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751",
|
||||
"rev": "edf04b75c13c2ac0e54df5ec5c543e300f76f1c9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -545,11 +549,11 @@
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1735993984,
|
||||
"narHash": "sha256-Syew+5yuzysUr07SrGD+GRfZjE11h36TSYbxzEHYyyc=",
|
||||
"lastModified": 1735389157,
|
||||
"narHash": "sha256-3co5A7PUEN+Bm7b3/6BxFsmvplg3XYUNR2MzWnheZoE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "6bd1c7c5927fa9fdfdfd68f5aa772e6a62b9d779",
|
||||
"rev": "c8fa65c6ac35dba157de0873d645ab398c370123",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -569,11 +573,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1735854821,
|
||||
"narHash": "sha256-Iv59gMDZajNfezTO0Fw6LHE7uKAShxbvMidmZREit7c=",
|
||||
"lastModified": 1733773348,
|
||||
"narHash": "sha256-Y47y+LesOCkJaLvj+dI/Oa6FAKj/T9sKVKDXLNsViPw=",
|
||||
"owner": "NuschtOS",
|
||||
"repo": "search",
|
||||
"rev": "836908e3bddd837ae0f13e215dd48767aee355f0",
|
||||
"rev": "3051be7f403bff1d1d380e4612f0c70675b44fc9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -592,11 +596,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736549395,
|
||||
"narHash": "sha256-XzwkB62Tt5UYoL1jXiHzgk/qz2fUpGHExcSIbyGTtI0=",
|
||||
"lastModified": 1735049224,
|
||||
"narHash": "sha256-fWUd9kyXdepphJ7cCzOsuSo7l0kbFCkUqfgKqZyFZzE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "plasma-manager",
|
||||
"rev": "a53af7f1514ef4cce8620a9d6a50f238cdedec8b",
|
||||
"rev": "d16bbded0ae452bc088489e7dca3ef58d8d1830b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -709,11 +713,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1735905407,
|
||||
"narHash": "sha256-1hKMRIT+QZNWX46e4gIovoQ7H8QRb7803ZH4qSKI45o=",
|
||||
"lastModified": 1735135567,
|
||||
"narHash": "sha256-8T3K5amndEavxnludPyfj3Z1IkcFdRpR23q+T0BVeZE=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "29806abab803e498df96d82dd6f34b32eb8dd2c8",
|
||||
"rev": "9e09d30a644c57257715902efbb3adc56c79cf28",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -108,111 +108,6 @@
|
||||
pulse.enable = true;
|
||||
};
|
||||
|
||||
age.secrets."files/services/home-assistant/secrets.yaml" = {
|
||||
file = "${self.inputs.secrets}/files/services/home-assistant/secrets.yaml.age";
|
||||
path = "${config.services.home-assistant.configDir}/secrets.yaml";
|
||||
owner = "hass";
|
||||
group = "hass";
|
||||
};
|
||||
|
||||
services.home-assistant = {
|
||||
enable = true;
|
||||
extraComponents = [
|
||||
"api"
|
||||
"alert"
|
||||
"auth"
|
||||
"backup"
|
||||
"command_line"
|
||||
"default_config"
|
||||
"homekit_controller"
|
||||
"homekit"
|
||||
"http"
|
||||
"icloud"
|
||||
"jellyfin"
|
||||
"metoffice"
|
||||
"mqtt"
|
||||
"onkyo"
|
||||
"ping"
|
||||
"proximity"
|
||||
"radio_browser"
|
||||
"scrape"
|
||||
"sensor"
|
||||
"system_health"
|
||||
];
|
||||
config = {
|
||||
default_config = {};
|
||||
backup = {};
|
||||
homeassistant = {
|
||||
name = "Home";
|
||||
latitude = "!secret latitude";
|
||||
longitude = "!secret longitude";
|
||||
country = "GB";
|
||||
temperature_unit = "C";
|
||||
time_zone = config.time.timeZone;
|
||||
unit_system = "metric";
|
||||
};
|
||||
mqtt = { };
|
||||
scene = "!include scenes.yaml";
|
||||
automation = "!include automations.yaml";
|
||||
system_health = { };
|
||||
recorder = {
|
||||
purge_keep_days = 365;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.mosquitto = {
|
||||
enable = true;
|
||||
listeners = [{
|
||||
acl = [ "pattern readwrite #" ];
|
||||
omitPasswordAuth = true;
|
||||
port = 1883;
|
||||
settings = {
|
||||
allow_anonymous = true;
|
||||
};
|
||||
}];
|
||||
};
|
||||
|
||||
age.secrets."files/services/zigbee2mqtt/secret.yaml" = {
|
||||
file = "${self.inputs.secrets}/files/services/zigbee2mqtt/secret.yaml.age";
|
||||
path = "${config.services.zigbee2mqtt.dataDir}/secret.yaml";
|
||||
owner = "zigbee2mqtt";
|
||||
group = "zigbee2mqtt";
|
||||
};
|
||||
|
||||
services.zigbee2mqtt = {
|
||||
package = pkgs.unstable.zigbee2mqtt;
|
||||
enable = true;
|
||||
dataDir = "/var/lib/zigbee2mqtt";
|
||||
settings = {
|
||||
homeassistant = lib.optionalAttrs config.services.home-assistant.enable {
|
||||
discovery_topic = "homeassistant";
|
||||
status_topic = "hass/status";
|
||||
legacy_entity_attributes = true;
|
||||
legacy_triggers = true;
|
||||
};
|
||||
availability = true;
|
||||
frontend = true;
|
||||
device_options = {
|
||||
retain = true;
|
||||
};
|
||||
serial = {
|
||||
port = "/dev/serial/by-id/usb-Silicon_Labs_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0001-if00-port0";
|
||||
};
|
||||
advanced = {
|
||||
channel = 20;
|
||||
network_key = "!secret.yaml network_key";
|
||||
pan_id = 13001;
|
||||
ext_pan_id = [ 79 1 73 47 250 136 124 222 ];
|
||||
transmit_power = 20;
|
||||
};
|
||||
mqtt = {
|
||||
version = 5;
|
||||
server = "mqtt://localhost:1883";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
modules = {
|
||||
networking = {
|
||||
wireless = {
|
||||
@ -223,12 +118,9 @@
|
||||
services = {
|
||||
borgmatic = {
|
||||
enable = true;
|
||||
directories = [
|
||||
"/var/lib/mosquitto"
|
||||
"/var/lib/zigbee2mqtt"
|
||||
];
|
||||
repoPath = "ssh://qcw86s11@qcw86s11.repo.borgbase.com/./repo";
|
||||
};
|
||||
home-assistant.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
./services/gitea
|
||||
./services/gitea-runner
|
||||
./services/headscale
|
||||
./services/home-assistant
|
||||
./services/mail
|
||||
./services/matrix
|
||||
./services/nginx
|
||||
|
@ -36,7 +36,7 @@ with lib;
|
||||
in {
|
||||
inherit name;
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "networkmanager" "wheel" "lxd" ];
|
||||
extraGroups = [ "audio" "networkmanager" "wheel" "lxd" ];
|
||||
description = "Jordan Holt";
|
||||
useDefaultShell = true;
|
||||
openssh.authorizedKeys.keys = [
|
||||
|
298
modules/services/home-assistant/default.nix
Normal file
298
modules/services/home-assistant/default.nix
Normal file
@ -0,0 +1,298 @@
|
||||
{ config, lib, pkgs, self, ... }:
|
||||
|
||||
let
|
||||
cfg = config.modules.services.home-assistant;
|
||||
in {
|
||||
imports = [
|
||||
./floorplan/default.nix
|
||||
./mqtt.nix
|
||||
];
|
||||
|
||||
options.modules.services.home-assistant.enable = lib.mkEnableOption "home-assistant";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
age.secrets."files/services/home-assistant/secrets.yaml" = {
|
||||
file = "${self.inputs.secrets}/files/services/home-assistant/secrets.yaml.age";
|
||||
path = "${config.services.home-assistant.configDir}/secrets.yaml";
|
||||
owner = "hass";
|
||||
group = "hass";
|
||||
};
|
||||
|
||||
services.home-assistant = {
|
||||
enable = true;
|
||||
|
||||
config = {
|
||||
automation = "!include automations.yaml";
|
||||
backup = { };
|
||||
binary_sensor = [ ];
|
||||
default_config = { };
|
||||
http = {
|
||||
server_host = "::1";
|
||||
trusted_proxies = [ "::1" ];
|
||||
use_x_forwarded_for = true;
|
||||
};
|
||||
ffmpeg = { };
|
||||
homeassistant = {
|
||||
name = "Home";
|
||||
latitude = "!secret latitude";
|
||||
longitude = "!secret longitude";
|
||||
country = "GB";
|
||||
temperature_unit = "C";
|
||||
time_zone = config.time.timeZone;
|
||||
unit_system = "metric";
|
||||
auth_providers = [
|
||||
{
|
||||
type = "trusted_networks";
|
||||
trusted_networks = [
|
||||
"100.64.0.0/10"
|
||||
"127.0.0.1"
|
||||
];
|
||||
allow_bypass_login = true;
|
||||
}
|
||||
{
|
||||
type = "homeassistant";
|
||||
}
|
||||
];
|
||||
};
|
||||
logger = {
|
||||
default = "info";
|
||||
logs = { };
|
||||
};
|
||||
lovelace = {
|
||||
resources = [
|
||||
{
|
||||
url = "/local/nixos-lovelace-modulels/mushroom.js";
|
||||
type = "module";
|
||||
}
|
||||
];
|
||||
};
|
||||
media_player = [ ];
|
||||
mobile_app = { };
|
||||
onkyo = { };
|
||||
open_meteo = { };
|
||||
recorder = {
|
||||
purge_keep_days = 365;
|
||||
};
|
||||
scene = "!include scenes.yaml";
|
||||
script = "!include scripts.yaml";
|
||||
sensor = [ ];
|
||||
system_health = { };
|
||||
zeroconf = { };
|
||||
};
|
||||
|
||||
configDir = "/etc/home-assistant";
|
||||
|
||||
extraComponents = [
|
||||
"air_quality"
|
||||
"airly"
|
||||
"alert"
|
||||
"api"
|
||||
"application_credentials"
|
||||
"asuswrt"
|
||||
"auth"
|
||||
"automation"
|
||||
"bayesian"
|
||||
"binary_sensor"
|
||||
# "blackbird"
|
||||
"blueprint"
|
||||
"bluetooth_adapters"
|
||||
"bluetooth_le_tracker"
|
||||
"button"
|
||||
"calendar"
|
||||
"camera"
|
||||
"cast"
|
||||
"cert_expiry"
|
||||
"climate"
|
||||
"co2signal"
|
||||
"color_extractor"
|
||||
"command_line"
|
||||
"compensation"
|
||||
"configurator"
|
||||
"counter"
|
||||
"cover"
|
||||
"cpuspeed"
|
||||
"default_config"
|
||||
"demo"
|
||||
"derivative"
|
||||
"device_automation"
|
||||
"device_sun_light_trigger"
|
||||
"device_tracker"
|
||||
"dlna_dmr"
|
||||
"dlna_dms"
|
||||
"dnsip"
|
||||
"esphome"
|
||||
"fail2ban"
|
||||
"fan"
|
||||
"feedreader"
|
||||
"ffmpeg"
|
||||
"file"
|
||||
"file_upload"
|
||||
"filesize"
|
||||
"folder"
|
||||
"folder_watcher"
|
||||
"forecast_solar"
|
||||
"frontend"
|
||||
"gdacs"
|
||||
"generic"
|
||||
"generic_hygrostat"
|
||||
"generic_thermostat"
|
||||
"geo_json_events"
|
||||
"geo_location"
|
||||
"geo_rss_events"
|
||||
"github"
|
||||
"group"
|
||||
"hardware"
|
||||
"hdmi_cec"
|
||||
"history_stats"
|
||||
"homeassistant"
|
||||
"homekit"
|
||||
"homekit_controller"
|
||||
"html5"
|
||||
"http"
|
||||
"humidifier"
|
||||
"icloud"
|
||||
"image_processing"
|
||||
"input_boolean"
|
||||
"input_button"
|
||||
"input_datetime"
|
||||
"input_number"
|
||||
"input_select"
|
||||
"input_text"
|
||||
"integration"
|
||||
"ios"
|
||||
"jellyfin"
|
||||
"light"
|
||||
"local_calendar"
|
||||
"local_file"
|
||||
"local_ip"
|
||||
"local_todo"
|
||||
"lock"
|
||||
"logentries"
|
||||
"logger"
|
||||
"lovelace"
|
||||
"manual"
|
||||
"manual_mqtt"
|
||||
"matter"
|
||||
"media_player"
|
||||
"min_max"
|
||||
"mjpeg"
|
||||
"modern_forms"
|
||||
"mold_indicator"
|
||||
"moon"
|
||||
"mysensors"
|
||||
"network"
|
||||
"nmap_tracker"
|
||||
"notify"
|
||||
"number"
|
||||
"onboarding"
|
||||
"onkyo"
|
||||
"panel_custom"
|
||||
"persistent_notification"
|
||||
"person"
|
||||
"ping"
|
||||
"plant"
|
||||
"prometheus"
|
||||
"proximity"
|
||||
"push"
|
||||
"proximity"
|
||||
"python_script"
|
||||
"radio_browser"
|
||||
"random"
|
||||
"recorder"
|
||||
"remote"
|
||||
"repairs"
|
||||
"rest"
|
||||
"rest_command"
|
||||
"rss_feed_template"
|
||||
"scene"
|
||||
"schedule"
|
||||
"scrape"
|
||||
"script"
|
||||
"search"
|
||||
"season"
|
||||
"select"
|
||||
"sense"
|
||||
"sensor"
|
||||
"sensorpush"
|
||||
"shell_command"
|
||||
"shopping_list"
|
||||
"siren"
|
||||
"smtp"
|
||||
"snmp"
|
||||
"sql"
|
||||
"statistics"
|
||||
"sun"
|
||||
"switch"
|
||||
"switch_as_x"
|
||||
"system_health"
|
||||
"system_log"
|
||||
"systemmonitor"
|
||||
"tag"
|
||||
"tailscale"
|
||||
"tcp"
|
||||
"template"
|
||||
"text"
|
||||
"thread"
|
||||
"threshold"
|
||||
"time_date"
|
||||
"timer"
|
||||
"tod"
|
||||
"todo"
|
||||
"tomorrowio"
|
||||
"trend"
|
||||
"universal"
|
||||
"upb"
|
||||
"update"
|
||||
"upnp"
|
||||
"uptime"
|
||||
"utility_meter"
|
||||
"vacuum"
|
||||
"vlc"
|
||||
"vlc_telnet"
|
||||
"wake_on_lan"
|
||||
"water_heater"
|
||||
"weather"
|
||||
"websocket_api"
|
||||
"wled"
|
||||
"workday"
|
||||
"worldclock"
|
||||
"zone"
|
||||
];
|
||||
|
||||
extraPackages = python3Packages: with python3Packages; [
|
||||
onkyo-eiscp
|
||||
zeroconf
|
||||
];
|
||||
|
||||
customLovelaceModules = with pkgs.home-assistant-custom-lovelace-modules; [
|
||||
bubble-card
|
||||
button-card
|
||||
mushroom
|
||||
sankey-chart
|
||||
universal-remote-card
|
||||
# zigbee2mqtt-networkmap
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services.home-assistant.preStart = lib.mkForce "";
|
||||
|
||||
modules.services.borgmatic.directories = [
|
||||
config.services.home-assistant.configDir
|
||||
];
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts."home.mesh.vimium.net" = {
|
||||
forceSSL = false;
|
||||
extraConfig = ''
|
||||
proxy_buffering off;
|
||||
'';
|
||||
locations."/" = {
|
||||
proxyPass = "http://[::1]:8123";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
92
modules/services/home-assistant/floorplan/default.nix
Normal file
92
modules/services/home-assistant/floorplan/default.nix
Normal file
@ -0,0 +1,92 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.modules.services.home-assistant;
|
||||
in {
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.home-assistant = {
|
||||
config.lovelace.resources = [{
|
||||
url = "/local/nixos-lovelace-modules/floorplan.js";
|
||||
type = "module";
|
||||
}];
|
||||
customLovelaceModules = [
|
||||
pkgs.ha-floorplan
|
||||
];
|
||||
};
|
||||
|
||||
environment.etc."home-assistant/www/floorplan/style.css".source = ./style.css;
|
||||
environment.etc."home-assistant/www/floorplan/config.yaml".text = builtins.toJSON {
|
||||
image = {
|
||||
location = "/local/floorplan/beetham.svg";
|
||||
cache = false;
|
||||
};
|
||||
stylesheet = {
|
||||
location = "/local/floorplan/style.css";
|
||||
cache = false;
|
||||
};
|
||||
|
||||
defaults = {
|
||||
hover_action = "hover-info";
|
||||
hold_action = "toggle";
|
||||
tap_action = "more-info";
|
||||
};
|
||||
|
||||
rules = [
|
||||
{
|
||||
name = "Rooms";
|
||||
entities = [
|
||||
{
|
||||
entity = "light.bedroom_lamps";
|
||||
element = "area.bedroom";
|
||||
}
|
||||
{
|
||||
entity = "light.hallway_spots";
|
||||
element = "area.hallway";
|
||||
}
|
||||
{
|
||||
entity = "light.living_room_lamps";
|
||||
element = "area.livingroom";
|
||||
}
|
||||
{
|
||||
entity = "light.office_lamps";
|
||||
element = "area.office";
|
||||
}
|
||||
];
|
||||
tap_action = "light.toggle";
|
||||
state_action = {
|
||||
service = "floorplan.class_set";
|
||||
service_data = ''
|
||||
if (entity.state === "on") {
|
||||
return "light-on";
|
||||
}
|
||||
return "light-off";
|
||||
'';
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "Temperature";
|
||||
entities = [
|
||||
"sensor.motion_sensor_temperature"
|
||||
];
|
||||
state_action = [
|
||||
{
|
||||
service = "floorplan.text_set";
|
||||
service_data = ''
|
||||
if (!isNaN(entity.state)) {
|
||||
return Math.round(entity.state * 10) / 10 + "°";
|
||||
}
|
||||
return "Unknown";
|
||||
'';
|
||||
}
|
||||
{
|
||||
service = "floorplan.class_set";
|
||||
service_data = {
|
||||
class = "static-temp";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
27
modules/services/home-assistant/floorplan/style.css
Normal file
27
modules/services/home-assistant/floorplan/style.css
Normal file
@ -0,0 +1,27 @@
|
||||
#floorplan {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
svg, svg * {
|
||||
vector-effect: non-scaling-stroke !important;
|
||||
pointer-events: all !important;
|
||||
}
|
||||
|
||||
path[id*="area."].light-on {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
|
||||
path[id*="area."] {
|
||||
opacity: 0.5 !important;
|
||||
transition: opacity .25s;
|
||||
-moz-transition: opacity .25s;
|
||||
-webkit-transition: opacity .25s;
|
||||
}
|
||||
|
||||
svg tspan {
|
||||
fill: var(--primary-text-color);
|
||||
}
|
||||
|
||||
.static-temp, .static-temp tspan {
|
||||
fill: #ffffff;
|
||||
}
|
75
modules/services/home-assistant/mqtt.nix
Normal file
75
modules/services/home-assistant/mqtt.nix
Normal file
@ -0,0 +1,75 @@
|
||||
{ config, lib, pkgs, self, ... }:
|
||||
|
||||
let
|
||||
cfg = config.modules.services.home-assistant;
|
||||
in {
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.mosquitto = {
|
||||
enable = true;
|
||||
listeners = [{
|
||||
acl = [ "pattern readwrite #" ];
|
||||
omitPasswordAuth = true;
|
||||
port = 1883;
|
||||
settings = {
|
||||
allow_anonymous = true;
|
||||
};
|
||||
}];
|
||||
};
|
||||
|
||||
age.secrets."files/services/zigbee2mqtt/secret.yaml" = {
|
||||
file = "${self.inputs.secrets}/files/services/zigbee2mqtt/secret.yaml.age";
|
||||
path = "${config.services.zigbee2mqtt.dataDir}/secret.yaml";
|
||||
owner = "zigbee2mqtt";
|
||||
group = "zigbee2mqtt";
|
||||
};
|
||||
|
||||
services.zigbee2mqtt = {
|
||||
package = pkgs.unstable.zigbee2mqtt;
|
||||
enable = true;
|
||||
dataDir = "/var/lib/zigbee2mqtt";
|
||||
settings = {
|
||||
homeassistant = lib.optionalAttrs config.services.home-assistant.enable {
|
||||
discovery_topic = "homeassistant";
|
||||
status_topic = "hass/status";
|
||||
legacy_entity_attributes = true;
|
||||
legacy_triggers = true;
|
||||
};
|
||||
availability = true;
|
||||
frontend = true;
|
||||
device_options = {
|
||||
retain = true;
|
||||
};
|
||||
serial = {
|
||||
port = "/dev/serial/by-id/usb-Silicon_Labs_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0001-if00-port0";
|
||||
};
|
||||
advanced = {
|
||||
channel = 20;
|
||||
network_key = "!secret.yaml network_key";
|
||||
pan_id = 13001;
|
||||
ext_pan_id = [ 79 1 73 47 250 136 124 222 ];
|
||||
transmit_power = 20;
|
||||
};
|
||||
mqtt = {
|
||||
version = 5;
|
||||
server = "mqtt://localhost:1883";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
modules.services.borgmatic.directories = [
|
||||
config.services.mosquitto.dataDir
|
||||
config.services.zigbee2mqtt.dataDir
|
||||
];
|
||||
|
||||
services.home-assistant = {
|
||||
config.mqtt = {};
|
||||
extraComponents = [
|
||||
"mqtt"
|
||||
"mqtt_eventstream"
|
||||
"mqtt_json"
|
||||
"mqtt_room"
|
||||
"mqtt_statestream"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
38
pkgs/ha-floorplan/package.nix
Normal file
38
pkgs/ha-floorplan/package.nix
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
lib,
|
||||
buildNpmPackage,
|
||||
fetchFromGitHub
|
||||
}:
|
||||
|
||||
buildNpmPackage rec {
|
||||
pname = "floorplan";
|
||||
version = "1.0.44";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ExperienceLovelace";
|
||||
repo = "ha-floorplan";
|
||||
rev = "refs/tags/${version}";
|
||||
hash = "sha256-ajEA47H9nFXVcuvhwkDsxc5YYQWMsUXqHQ3t6tuAaxc=";
|
||||
};
|
||||
|
||||
npmDepsHash = "sha256-/6H3XMraD7/usZBwmQaCDpV2n1Eed+U+G0f2YnjyWgk=";
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir $out
|
||||
cp -R dist/* $out/
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Floorplan for Home Assistant";
|
||||
longDescription = ''
|
||||
Bring new life to Home Assistant. By mapping entities to a SVG-object,
|
||||
you're able to control devices, show states, calling services - and much
|
||||
more. Add custom styling on top, to visualize whatever you can think of.
|
||||
Your imagination just became the new limit.
|
||||
'';
|
||||
homepage = "https://github.com/ExperienceLovelace/ha-floorplan";
|
||||
license = lib.licenses.asl20;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user