Add floorplan config
This commit is contained in:
@ -3,9 +3,15 @@
|
||||
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";
|
||||
@ -13,12 +19,6 @@ in {
|
||||
group = "hass";
|
||||
};
|
||||
|
||||
modules.services.borgmatic.directories = [
|
||||
"/var/lib/mosquitto"
|
||||
"/var/lib/zigbee2mqtt"
|
||||
];
|
||||
|
||||
|
||||
services.home-assistant = {
|
||||
enable = true;
|
||||
|
||||
@ -61,10 +61,6 @@ in {
|
||||
};
|
||||
lovelace = {
|
||||
resources = [
|
||||
{
|
||||
url = "/local/nixos-lovelace-modules/floorplan.js";
|
||||
type = "module";
|
||||
}
|
||||
{
|
||||
url = "/local/nixos-lovelace-modulels/mushroom.js";
|
||||
type = "module";
|
||||
@ -73,7 +69,6 @@ in {
|
||||
};
|
||||
media_player = [ ];
|
||||
mobile_app = { };
|
||||
mqtt = { };
|
||||
onkyo = { };
|
||||
open_meteo = { };
|
||||
recorder = {
|
||||
@ -86,6 +81,8 @@ in {
|
||||
zeroconf = { };
|
||||
};
|
||||
|
||||
configDir = "/etc/home-assistant";
|
||||
|
||||
extraComponents = [
|
||||
"air_quality"
|
||||
"airly"
|
||||
@ -183,11 +180,6 @@ in {
|
||||
"modern_forms"
|
||||
"mold_indicator"
|
||||
"moon"
|
||||
"mqtt"
|
||||
"mqtt_eventstream"
|
||||
"mqtt_json"
|
||||
"mqtt_room"
|
||||
"mqtt_statestream"
|
||||
"mysensors"
|
||||
"network"
|
||||
"nmap_tracker"
|
||||
@ -276,7 +268,6 @@ in {
|
||||
customLovelaceModules = with pkgs.home-assistant-custom-lovelace-modules; [
|
||||
bubble-card
|
||||
button-card
|
||||
ha-floorplan
|
||||
mushroom
|
||||
sankey-chart
|
||||
universal-remote-card
|
||||
@ -284,6 +275,12 @@ in {
|
||||
];
|
||||
};
|
||||
|
||||
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" = {
|
||||
@ -297,57 +294,5 @@ in {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user