fix(rpi4): fix home-assistant config

This commit is contained in:
Felix Schröter 2021-11-23 00:40:06 +01:00
parent c87de43103
commit e0f55dfb08
No known key found for this signature in database
GPG key ID: 910ACB9F6BD26F58

View file

@ -4,6 +4,7 @@ with pkgs;
let let
mqttDomain = "mqtt.${config.networking.domain}"; mqttDomain = "mqtt.${config.networking.domain}";
mqttPort = 1883;
mqttWSPort = 9001; mqttWSPort = 9001;
in { in {
# just installed for ConBee firmware updates # just installed for ConBee firmware updates
@ -23,20 +24,21 @@ in {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {
proxyPass = "http://localhost:8123"; proxyPass =
"http://localhost:${toString config.services.home-assistant.port}";
proxyWebsockets = true; proxyWebsockets = true;
}; };
}; };
}; };
}; };
networking.firewall.allowedTCPPorts = [ mqttWSPort ]; networking.firewall.allowedTCPPorts = [ mqttPort ];
services.mosquitto = { services.mosquitto = {
enable = true; enable = true;
listeners = [{ listeners = [
port = mqttWSPort; {
settings.protocol = "websockets"; port = mqttPort;
users = { users = {
"hass" = { "hass" = {
acl = [ acl = [
@ -54,6 +56,12 @@ in {
acl = [ "readwrite owntracks/#" ]; acl = [ "readwrite owntracks/#" ];
hashedPasswordFile = "/etc/nixos/secrets/mqtt/owntracks"; hashedPasswordFile = "/etc/nixos/secrets/mqtt/owntracks";
}; };
};
}
{
port = mqttWSPort;
settings.protocol = "websockets";
users = {
"felix" = { "felix" = {
acl = [ "read owntracks/#" "readwrite owntracks/felix/#" ]; acl = [ "read owntracks/#" "readwrite owntracks/felix/#" ];
hashedPasswordFile = "/etc/nixos/secrets/mqtt/felix"; hashedPasswordFile = "/etc/nixos/secrets/mqtt/felix";
@ -63,7 +71,8 @@ in {
hashedPasswordFile = "/etc/nixos/secrets/mqtt/birgit"; hashedPasswordFile = "/etc/nixos/secrets/mqtt/birgit";
}; };
}; };
}]; }
];
}; };
services.home-assistant = { services.home-assistant = {
@ -105,7 +114,7 @@ in {
}; };
mqtt = { mqtt = {
broker = "localhost"; broker = "localhost";
port = mqttWSPort; port = mqttPort;
username = "hass"; username = "hass";
password = "!secret mqtt_password"; password = "!secret mqtt_password";
discovery = true; discovery = true;