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
|
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
|
|
|
];
|
|
|
|
|
2020-05-09 16:43:47 +02:00
|
|
|
services.zigbee2mqtt = {
|
|
|
|
enable = true;
|
2020-12-05 22:19:40 +01:00
|
|
|
#package = pkgs.own_zigbee2mqtt;
|
|
|
|
package = unstable.zigbee2mqtt;
|
2020-11-22 01:58:32 +01:00
|
|
|
config = {
|
|
|
|
|
|
|
|
# Home Assistant integration (MQTT discovery)
|
|
|
|
homeassistant = false;
|
|
|
|
|
|
|
|
# allow new devices to join
|
2020-11-22 15:01:19 +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 = {
|
|
|
|
port = "/dev/ttyACM0";
|
|
|
|
# disable LED of CC2531 USB sniffer
|
|
|
|
disable_led = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
# 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-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
|
|
|
|
2020-12-05 22:19:40 +01:00
|
|
|
systemd.services.zigbee2mqtt.environment = {
|
|
|
|
ZIGBEE2MQTT_DATA = "/var/lib/zigbee2mqtt";
|
|
|
|
};
|
|
|
|
|
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:${
|
|
|
|
toString config.services.zigbee2mqtt.config.frontend.port
|
|
|
|
}";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-04-08 16:43:09 +02:00
|
|
|
}
|