{ pkgs, ... }: let bermuda = pkgs.callPackage ./custom-components/bermuda.nix {}; in { services.home-assistant.extraComponents = [ "daikin" "enocean" "private_ble_device" ]; systemd.services.install-bermuda = { description = "Install Bermuda"; wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "oneshot"; }; script = '' set -e BERMUDA_VERSION="v0.7.2" # Replace with the latest version BERMUDA_DIR="/var/lib/hass/custom_components/bermuda" mkdir -p "$BERMUDA_DIR" ${pkgs.curl}/bin/curl -L "https://github.com/agittins/bermuda/releases/download/$BERMUDA_VERSION/bermuda.zip" -o /tmp/bermuda.zip ${pkgs.unzip}/bin/unzip -o /tmp/bermuda.zip -d "$BERMUDA_DIR" rm /tmp/bermuda.zip chown -R hass:hass "$BERMUDA_DIR" ''; }; services.home-assistant.config = { "automation presense kitchen" = { alias = "presense kitchen"; mode = "restart"; trigger = { platform = "state"; entity_id = [ "sensor.presense_kitchen" ]; }; action = [ { choose = [ { conditions = [ "{{ trigger.to_state.state == \"\" }}" ]; sequence = [ ]; } { conditions = [ "{{ trigger.to_state.state != \"\" }}" ]; sequence = [ { service = "light.turn_on"; entity_id = "light.kitchen_lights"; } ]; } ]; } ]; }; sensor = [ ]; }; }