summaryrefslogtreecommitdiffstats
path: root/makefu/2configs
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2021-03-12 20:28:20 +0100
committermakefu <github@syntax-fehler.de>2021-03-12 20:28:20 +0100
commit31cb697190ea6d5c50925048a897880278eaf511 (patch)
tree0c919371b39d8fb5871d9d4a0a0b2e53a5fb37b6 /makefu/2configs
parentcd6a3637d4ca727b0f3277e1478130a8aa1fd8c0 (diff)
ma ham/zigbee2mqtt: enable frontend
Diffstat (limited to 'makefu/2configs')
-rw-r--r--makefu/2configs/home/ham/zigbee2mqtt/default.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/makefu/2configs/home/ham/zigbee2mqtt/default.nix b/makefu/2configs/home/ham/zigbee2mqtt/default.nix
index 83c3c187c..6ccf8b241 100644
--- a/makefu/2configs/home/ham/zigbee2mqtt/default.nix
+++ b/makefu/2configs/home/ham/zigbee2mqtt/default.nix
@@ -3,12 +3,16 @@
let
dataDir = "/var/lib/zigbee2mqtt";
sec = import <secrets/zigbee2mqtt.nix>;
+ internal-ip = "192.168.1.11";
+ webport = 8521;
in
{
# symlink the zigbee controller
#services.udev.extraRules = ''
# SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dialout"
#'';
+
+ # /dev/serial/by-id/usb-Silicon_Labs_slae.sh_cc2652rb_stick_-_slaesh_s_iot_stuff_00_12_4B_00_21_CC_45_BD-if00-port0
services.udev.extraRules = ''
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="cc2531", MODE="0660", GROUP="dialout"
'';
@@ -28,6 +32,9 @@ in
include_device_information = true;
client_id = "zigbee2mqtt";
};
+ frontend = {
+ port = webport;
+ };
advanced = {
log_level = "debug";
log_output = [ "console" ];
@@ -56,6 +63,19 @@ in
};
};
+ services.nginx.recommendedProxySettings = true;
+ services.nginx.virtualHosts."zigbee" = {
+ serverAliases = [ "zigbee.lan" ];
+ locations."/".proxyPass = "http://localhost:${toString webport}";
+ locations."/api".proxyPass = "http://localhost:${toString webport}";
+ locations."/api".proxyWebsockets = true;
+ extraConfig = ''
+ if ( $server_addr != "${internal-ip}" ) {
+ return 403;
+ }
+ '';
+ };
+
state = [ "${dataDir}/devices.yaml" "${dataDir}/state.json" ];
systemd.services.zigbee2mqtt = {