From cb42f5cf152641565916e27173fbe020e0f0eb28 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sat, 21 Dec 2024 15:12:54 +0100 Subject: ev: add zigbee2mqtt and mosquitto --- nixos/hosts/ev/home-automation.nix | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 nixos/hosts/ev/home-automation.nix (limited to 'nixos/hosts/ev/home-automation.nix') diff --git a/nixos/hosts/ev/home-automation.nix b/nixos/hosts/ev/home-automation.nix new file mode 100644 index 0000000..0766e4e --- /dev/null +++ b/nixos/hosts/ev/home-automation.nix @@ -0,0 +1,41 @@ +# I'm not using Home Assistant because many of its integrations can only be configured via the UI. +# (see https://github.com/home-assistant/architecture/blob/master/adr/0010-integration-configuration.md) + +{ config, lib, pkgs, ... }: + +let + cfg = config.home-automation; +in +{ + options.home-automation = { + zigbee2mqttPort = lib.mkOption { + type = lib.types.int; + }; + zigbeeSerialPort = lib.mkOption { + type = lib.types.str; + }; + }; + + config = { + services = { + zigbee2mqtt = { + enable = true; + settings = { + serial = { + port = cfg.zigbeeSerialPort; + }; + frontend = { + port = cfg.zigbee2mqttPort; + }; + }; + }; + + mosquitto = { + enable = true; + }; + + # TODO: somehow record a history of events (perhaps in Grafana?) + # TODO: somehow set up some automations + }; + }; +} -- cgit v1.2.3