feat: add mennekes modbus, add influxdb for hass

This commit is contained in:
oddlama 2025-01-29 00:55:42 +01:00
parent 88b02ed0f3
commit f70e9e83f8
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
15 changed files with 367 additions and 85 deletions

View file

@ -0,0 +1,62 @@
{
config,
pkgs,
...
}:
{
age.secrets.influxdb-admin-password = {
generator.script = "alnum";
mode = "440";
group = "influxdb2";
};
age.secrets.influxdb-admin-token = {
generator.script = "alnum";
mode = "440";
group = "influxdb2";
};
age.secrets.hass-influxdb-token = {
generator.script = "alnum";
mode = "440";
group = "hass";
};
environment.persistence."/persist".directories = [
{
directory = "/var/lib/influxdb2";
user = "influxdb2";
group = "influxdb2";
mode = "0700";
}
];
environment.systemPackages = [ pkgs.influxdb2-cli ];
services.influxdb2 = {
enable = true;
settings = {
reporting-disabled = true;
http-bind-address = "127.0.0.1:8086";
};
provision = {
enable = true;
initialSetup = {
organization = "default";
bucket = "default";
passwordFile = config.age.secrets.influxdb-admin-password.path;
tokenFile = config.age.secrets.influxdb-admin-token.path;
};
organizations.home = {
buckets.hass = { };
auths.home-assistant = {
readBuckets = [ "hass" ];
writeBuckets = [ "hass" ];
tokenFile = config.age.secrets.hass-influxdb-token.path;
};
};
};
};
systemd.services.influxdb2.serviceConfig.RestartSec = "60"; # Retry every minute
}