nixos-config/configs/pepe/home-assistant/zigbee2mqtt.nix

102 lines
2.6 KiB
Nix
Raw Normal View History

2020-12-05 22:19:40 +01:00
{ pkgs, lib, config, ... }:
# no need to set ZIGBEE2MQTT_DATA anymore
assert lib.versionOlder lib.version "21.03";
let unstable = import <nixpkgs-unstable> { };
in {
2020-04-15 21:47:21 +02:00
imports = [
./mqtt.nix
2021-03-20 13:28:40 +01:00
./zigbee2mqtt/service.nix
2020-10-21 00:24:16 +02:00
./zigbee2mqtt/buttons.nix
2020-11-22 01:58:32 +01:00
./zigbee2mqtt/configurationHelper.nix
2020-10-21 00:24:16 +02:00
./zigbee2mqtt/doors.nix
2020-10-30 23:39:40 +01:00
./zigbee2mqtt/fyrtur.nix
2020-10-30 00:36:00 +01:00
./zigbee2mqtt/heater.nix
2020-10-21 00:24:16 +02:00
./zigbee2mqtt/leds.nix
2020-04-15 21:47:21 +02:00
./zigbee2mqtt/lights.nix
./zigbee2mqtt/motion.nix
2020-10-30 00:36:00 +01:00
./zigbee2mqtt/repeater.nix
2020-04-15 23:55:21 +02:00
./zigbee2mqtt/temperatur.nix
2020-04-15 21:47:21 +02:00
];
2021-03-20 13:28:40 +01:00
custom.services.zigbee2mqtt = {
2020-05-09 16:43:47 +02:00
enable = true;
2020-12-05 22:19:40 +01:00
#package = pkgs.own_zigbee2mqtt;
2021-03-18 21:12:43 +01:00
#package = unstable.zigbee2mqtt;
package = unstable.zigbee2mqtt.overrideAttrs (old: rec {
version = "1.18.1";
src = pkgs.fetchFromGitHub {
owner = "Koenkk";
repo = "zigbee2mqtt";
rev = version;
sha256 = "1x73k346ayik5hv5axa3nvmd82mgwyrpxqv3dxnffi8aa1r8pf8x";
};
});
2020-11-22 01:58:32 +01:00
config = {
# Home Assistant integration (MQTT discovery)
homeassistant = false;
# allow new devices to join
2021-02-12 12:29:41 +01:00
permit_join = false;
2020-11-22 01:58:32 +01:00
# MQTT settings
mqtt = {
# MQTT base topic for zigbee2mqtt MQTT messages
base_topic = "zigbee2mqtt";
# MQTT server URL
server = "mqtt://127.0.0.1:1883";
# MQTT server authentication, uncomment if required:
user = "zigbee";
password = lib.fileContents <secrets/zigbee/password>;
};
# Serial settings
serial = {
2020-12-25 01:11:14 +01:00
#port = "/dev/ttyACM0";
port = "/dev/ttyUSB0";
2020-11-22 01:58:32 +01:00
# disable LED of CC2531 USB sniffer
2020-12-25 01:11:14 +01:00
#disable_led = true;
2020-11-22 01:58:32 +01:00
};
# you own network key,
# 16 numbers between 0 and 255
# see https://www.zigbee2mqtt.io/how_tos/how_to_secure_network.html
advanced.network_key = import <secrets/home-assistant/zigbee/networkKey>;
2020-12-05 22:19:40 +01:00
advanced.log_output = [ "console" ];
2020-11-22 01:58:32 +01:00
2020-12-25 01:11:14 +01:00
advanced.pan_id = 1337;
2021-02-24 05:58:18 +01:00
# add last seen information
2021-02-27 21:48:40 +01:00
advanced.last_seen = "ISO_8601_local";
2021-02-24 05:58:18 +01:00
2020-12-05 22:47:54 +01:00
# configure web ui
frontend.port = 9666;
frontend.host = "0.0.0.0";
experimental.new_api = true;
2020-11-22 01:58:32 +01:00
};
2020-05-09 16:43:47 +02:00
};
2020-04-08 16:43:09 +02:00
2021-03-20 13:28:40 +01:00
#systemd.services.zigbee2mqtt.environment = {
# ZIGBEE2MQTT_DATA = "/var/lib/zigbee2mqtt";
#};
2020-12-05 22:19:40 +01:00
2020-12-05 22:47:54 +01:00
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts = {
"zigbee2mqtt.pepe.private" = {
serverAliases = [ "zigbee.pepe.private" ];
locations."/" = {
proxyPass = "http://localhost:${
2021-03-20 13:28:40 +01:00
toString config.custom.services.zigbee2mqtt.config.frontend.port
2020-12-05 22:47:54 +01:00
}";
proxyWebsockets = true;
};
};
};
};
2020-04-08 16:43:09 +02:00
}