From f48e3c357e18234ce183e4674ccc3345bf150a04 Mon Sep 17 00:00:00 2001
From: Felix Tenley <dev@felschr.com>
Date: Thu, 22 Oct 2020 22:08:16 +0200
Subject: [PATCH] fix(rpi4): fix home-assistant mqtt connection

- use mqtt websockets via separate port
---
 services/home-assistant.nix | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/services/home-assistant.nix b/services/home-assistant.nix
index a5f0dc5..aba2868 100644
--- a/services/home-assistant.nix
+++ b/services/home-assistant.nix
@@ -4,6 +4,7 @@ with pkgs;
 
 let
   mqttDomain = "mqtt.${config.networking.domain}";
+  mqttWSPort = "9001";
 in
 {
   environment.systemPackages = with pkgs; [ deconz ];
@@ -21,7 +22,7 @@ in
         enableACME = true;
         forceSSL = true;
         locations."/" = {
-          proxyPass = "http://localhost:${toString config.services.mosquitto.port}";
+          proxyPass = "http://localhost:${mqttWSPort}";
           proxyWebsockets = true;
         };
       };
@@ -37,6 +38,7 @@ in
     host = "0.0.0.0";
     checkPasswords = true;
     extraConf = ''
+      listener ${mqttWSPort}
       protocol websockets
     '';
     users = {