move modules to hass
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
{ lib, config, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./utils/bento.nix
|
||||
./utils/modules/autoupgrade.nix
|
||||
./utils/modules/sops.nix
|
||||
./utils/modules/lego/lego.nix
|
||||
./utils/modules/nginx.nix
|
||||
./utils/modules/home-assistant/new.nix
|
||||
./utils/modules/mopidy.nix
|
||||
./utils/modules/mosquitto.nix
|
||||
./utils/modules/snapserver.nix
|
||||
./utils/modules/deconz/default.nix
|
||||
|
||||
./modules/home-assistant/new.nix
|
||||
./modules/mopidy.nix
|
||||
./modules/mosquitto.nix
|
||||
./modules/snapserver.nix
|
||||
./modules/deconz
|
||||
|
||||
./utils/modules/borgbackup.nix
|
||||
./utils/modules/promtail
|
||||
./utils/modules/victoriametrics
|
||||
./utils/modules/netdata.nix
|
||||
|
||||
./utils/bento.nix
|
||||
./utils/modules/autoupgrade.nix
|
||||
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
|
||||
60
hosts/home-assistant.cloonar.com/modules/deconz/default.nix
Normal file
60
hosts/home-assistant.cloonar.com/modules/deconz/default.nix
Normal file
@@ -0,0 +1,60 @@
|
||||
{ config, lib, pkgs, stdenv, ... }:
|
||||
let
|
||||
deconz-full = pkgs.callPackage ./pkg/default.nix { };
|
||||
deconz = deconz-full.deCONZ;
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
deconz
|
||||
];
|
||||
|
||||
|
||||
users.users."deconz" = {
|
||||
createHome = true;
|
||||
isSystemUser = true;
|
||||
group = "dialout";
|
||||
home = "/home/deconz";
|
||||
};
|
||||
|
||||
systemd.services.deconz = {
|
||||
enable = true;
|
||||
description = "deconz";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
stopIfChanged = false;
|
||||
serviceConfig = {
|
||||
ExecStart = "${deconz}/bin/deCONZ -platform minimal --http-port=8080 --ws-port=8081 --http-listen=127.0.0.1 --dev=/dev/ttyACM0";
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||
Restart = "always";
|
||||
RestartSec = "10s";
|
||||
# StartLimitInterval = "1min";
|
||||
# StateDirectory = "/var/lib/deconz";
|
||||
User = "deconz";
|
||||
# DeviceAllow = "char-ttyUSB rwm";
|
||||
# DeviceAllow = "char-usb_device rwm";
|
||||
# AmbientCapabilities="CAP_NET_BIND_SERVICE CAP_KILL CAP_SYS_BOOT CAP_SYS_TIME";
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."deconz.cloonar.com" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
acmeRoot = null;
|
||||
extraConfig = ''
|
||||
proxy_buffering off;
|
||||
'';
|
||||
locations."/".extraConfig = ''
|
||||
set $p 8080;
|
||||
if ($http_upgrade = "websocket") {
|
||||
set $p 8081;
|
||||
}
|
||||
proxy_pass http://127.0.0.1:$p;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect http:// https://;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
{ config, pkgs, stdenv, buildFHSUserEnv, fetchurl, dpkg, qt5, sqlite, hicolor-icon-theme, libcap, libpng, libxcrypt-legacy, ... }:
|
||||
#ith import <nixpkgs> {};
|
||||
let
|
||||
version = "2.21.02";
|
||||
name = "deconz-${version}";
|
||||
in
|
||||
rec {
|
||||
deCONZ-deb = stdenv.mkDerivation {
|
||||
#builder = ./builder.sh;
|
||||
inherit name;
|
||||
dpkg = dpkg;
|
||||
src = fetchurl {
|
||||
url = "https://deconz.dresden-elektronik.de/ubuntu/stable/${name}-qt5.deb";
|
||||
sha256 = "2d5ab8af471ffa82fb0fd0c8a2f0bb09e7c0bd9a03ef887abe49c616c63042f0";
|
||||
};
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
dontStrip = true;
|
||||
|
||||
buildInputs = [ dpkg sqlite hicolor-icon-theme libcap libpng qt5.qtbase qt5.qtserialport qt5.qtwebsockets qt5.wrapQtAppsHook libxcrypt-legacy ]; # qt5.qtserialport qt5.qtwebsockets ];
|
||||
|
||||
unpackPhase = "dpkg-deb -x $src .";
|
||||
installPhase = ''
|
||||
cp -r usr/* .
|
||||
cp -r ${libxcrypt-legacy}/lib/* share/deCONZ/plugins/
|
||||
cp -r share/deCONZ/plugins/* lib/
|
||||
cp -r . $out
|
||||
'';
|
||||
|
||||
};
|
||||
deCONZ = buildFHSUserEnv {
|
||||
name = "deCONZ";
|
||||
targetPkgs = pkgs: [
|
||||
deCONZ-deb
|
||||
];
|
||||
multiPkgs = pkgs: [
|
||||
dpkg
|
||||
qt5.qtbase
|
||||
qt5.qtserialport
|
||||
qt5.qtwebsockets
|
||||
qt5.wrapQtAppsHook
|
||||
sqlite
|
||||
hicolor-icon-theme
|
||||
libcap
|
||||
libpng
|
||||
];
|
||||
runScript = "deCONZ";
|
||||
};
|
||||
}
|
||||
103
hosts/home-assistant.cloonar.com/modules/home-assistant/ac.nix
Normal file
103
hosts/home-assistant.cloonar.com/modules/home-assistant/ac.nix
Normal file
@@ -0,0 +1,103 @@
|
||||
{
|
||||
services.home-assistant.extraComponents = [
|
||||
"daikin"
|
||||
];
|
||||
|
||||
services.home-assistant.config = {
|
||||
sensor = [
|
||||
{
|
||||
name = "Living Room Window Handle";
|
||||
platform = "enocean";
|
||||
id = [ 129 0 227 53 ];
|
||||
device_class = "windowhandle";
|
||||
}
|
||||
];
|
||||
"automation ac_livingroom" = {
|
||||
alias = "ac_livingroom";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = "sensor.windowhandle_living_room_window_handle";
|
||||
to = [ "open" "tilt" ];
|
||||
};
|
||||
action = {
|
||||
service = "climate.set_hvac_mode";
|
||||
target = {
|
||||
entity_id = "climate.livingroom_ac";
|
||||
};
|
||||
data = {
|
||||
hvac_mode = "off";
|
||||
};
|
||||
};
|
||||
};
|
||||
"automation ac_eco" = {
|
||||
alias = "ac_eco";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = [
|
||||
"climate.livingroom_ac"
|
||||
"climate.bedroom_ac"
|
||||
];
|
||||
to = [
|
||||
"heat"
|
||||
"cold"
|
||||
];
|
||||
};
|
||||
action = {
|
||||
service = "climate.set_preset_mode";
|
||||
target = {
|
||||
entity_id = "{{ trigger.entity_id }}";
|
||||
};
|
||||
data = {
|
||||
preset_mode = "eco";
|
||||
};
|
||||
};
|
||||
};
|
||||
"automation bedroom_ac_on" = {
|
||||
alias = "bedroom ac on";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "time";
|
||||
at = "00:30:00";
|
||||
};
|
||||
action = {
|
||||
choose = [
|
||||
{
|
||||
conditions = [ "{{ states('sensor.bedroom_ac_inside_temperature') > 25 and states('sensor.bedroom_ac_outside_temperature') > 22 }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "climate.set_hvac_mode";
|
||||
target = {
|
||||
entity_id = "climate.bedroom_ac";
|
||||
};
|
||||
data = {
|
||||
hvac_mode = "cold";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
"automation bedroom_ac_off" = {
|
||||
alias = "bedroom ac on";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "template";
|
||||
value_template = ''
|
||||
{{ now().timestamp() | timestamp_custom('%H:%M') == (as_timestamp(strptime(states('sensor.bedtime_alarm'), "%H:%M")) - 1800) | timestamp_custom('%H:%M', false) }}
|
||||
'';
|
||||
};
|
||||
action = {
|
||||
service = "climate.set_hvac_mode";
|
||||
target = {
|
||||
entity_id = "climate.bedroom_ac";
|
||||
};
|
||||
data = {
|
||||
hvac_mode = "off";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
services.home-assistant.package = pkgs.home-assistant.override {
|
||||
extraPackages = ps: with ps; [ pyelectroluxconnect ];
|
||||
|
||||
packageOverrides = self: super: {
|
||||
pyelectroluxconnect = super.buildPythonPackage rec {
|
||||
pname = "pyelectroluxconnect";
|
||||
version = "0.3.12";
|
||||
|
||||
src = super.fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "sha256-g9UxkWuTIqJe0/CDk3kwU3dSmc+GXlfDMxdzu6CqyY0=";
|
||||
};
|
||||
|
||||
doCheck = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
# services.home-assistant.extraPackages = python3Packages: with python3Packages; [
|
||||
# (callPackage ../../pkgs/pyelectroluxconnect.nix)
|
||||
# ];
|
||||
|
||||
services.home-assistant.config = {
|
||||
electrolux_status = {
|
||||
username = "dominik@superbros.tv";
|
||||
password = "U26tTTYtXdhErWpbRxRRVZy541vFvWyn";
|
||||
region = "emea";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
{
|
||||
services.home-assistant.config = {
|
||||
sensor = [
|
||||
{
|
||||
platform = "template";
|
||||
sensors = {
|
||||
sensors_lowest_battery_level = {
|
||||
friendly_name = "Lowest battery level (Sensors)";
|
||||
entity_id = "sun.sun";
|
||||
device_class = "battery";
|
||||
unit_of_measurement = "%";
|
||||
value_template = ''
|
||||
{% set domains = ['sensor', 'battery'] %}
|
||||
{% set ns = namespace(min_batt=100, entities=[]) %}
|
||||
{%- set exclude_sensors = ['sensor.sensors_lowest_battery_level','sensor.dominiks_iphone_battery_level'] -%}
|
||||
{% for domain in domains %}
|
||||
{% set ns.entities = states[domain] %}
|
||||
{% for sensor in exclude_sensors %}
|
||||
{% set ns.entities = ns.entities | rejectattr('entity_id', 'equalto', sensor) %}
|
||||
{% endfor %}
|
||||
{% set batt_sensors = ns.entities | selectattr('attributes.device_class','equalto','battery') | map(attribute='state') | reject('equalto', 'unknown') | reject('equalto', 'None') | map('int') | reject('equalto', 0) | list %}
|
||||
{% set batt_attrs = ns.entities | selectattr('attributes.battery_level','defined') | map(attribute='attributes.battery_level') | reject('equalto', 'unknown') | reject('equalto', 'None') | map('int') | reject('equalto', 0) | list %}
|
||||
{% set batt_lvls = batt_sensors + batt_attrs %}
|
||||
{% if batt_lvls|length > 0 %}
|
||||
{% set _min = batt_lvls|min %}
|
||||
{% if _min < ns.min_batt %}
|
||||
{% set ns.min_batt = _min %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ ns.min_batt }}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
binary_sensor = [
|
||||
{
|
||||
platform = "template";
|
||||
sensors = {
|
||||
sensor_low_battery = {
|
||||
value_template = "{{ states('sensor.sensors_lowest_battery_level')|int <= 30 }}";
|
||||
friendly_name = "A sensor has low battery";
|
||||
device_class = "problem";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
alert = {
|
||||
sensor_low_battery = {
|
||||
name = "Sensor has low battery!";
|
||||
message = ''
|
||||
{%- set domains = ['sensor', 'battery'] -%}
|
||||
{%- set threshold = 30 -%}
|
||||
{%- set exclude_entities = ['sensor.sensors_lowest_battery_level','sensor.dominiks_iphone_battery_level'] -%}
|
||||
Sensors are below 50% battery:
|
||||
{%- for domain in domains -%}
|
||||
{%- for item in states[domain] -%}
|
||||
{%- if item.entity_id not in exclude_entities -%}
|
||||
{%- if item.attributes.battery_level is defined -%}
|
||||
{%- set level = item.attributes.battery_level|int -%}
|
||||
{% if level > 0 and level < threshold %}
|
||||
- {{ item.attributes.friendly_name }} ({{ item.attributes['battery_level']|int}}%)
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- if item.attributes.device_class is defined and item.attributes.device_class == 'battery' -%}
|
||||
{%- set level = item.state|int -%}
|
||||
{% if level > 0 and level <= threshold %}
|
||||
- {{ item.attributes.friendly_name }} ({{ item.state|int }}%)
|
||||
{%- endif -%}
|
||||
{%- endif %}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- endfor -%}
|
||||
'';
|
||||
entity_id = "binary_sensor.sensor_low_battery";
|
||||
state = "on";
|
||||
repeat = [
|
||||
5
|
||||
60
|
||||
360
|
||||
];
|
||||
skip_first = true;
|
||||
can_acknowledge = true;
|
||||
notifiers = [
|
||||
"NotificationGroup"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
{ pkgs, ... }: {
|
||||
imports = [
|
||||
./ac.nix
|
||||
# ./aeg.nix
|
||||
./battery.nix
|
||||
./ecovacs.nix
|
||||
./enocean.nix
|
||||
./ldap.nix
|
||||
./light.nix
|
||||
./locks.nix
|
||||
./multimedia.nix
|
||||
./notify.nix
|
||||
./pc.nix
|
||||
./presence.nix
|
||||
./pushover.nix
|
||||
./roborock.nix
|
||||
./scene-switch.nix
|
||||
./sleep.nix
|
||||
./snapcast.nix
|
||||
];
|
||||
|
||||
services.home-assistant = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
services.home-assistant.extraComponents = [
|
||||
"mobile_app"
|
||||
"shopping_list"
|
||||
"backup"
|
||||
"denonavr"
|
||||
"androidtv"
|
||||
"rainbird"
|
||||
];
|
||||
|
||||
services.home-assistant.config =
|
||||
let
|
||||
hiddenEntities = [
|
||||
"sensor.last_boot"
|
||||
"sensor.date"
|
||||
];
|
||||
in
|
||||
{
|
||||
homeassistant = {
|
||||
name = "Home";
|
||||
latitude = "!secret home_latitude";
|
||||
longitude = "!secret home_longitude";
|
||||
# elevation = "!secret home_elevation";
|
||||
unit_system = "metric";
|
||||
time_zone = "Europe/Vienna";
|
||||
country = "AT";
|
||||
};
|
||||
automation = "!include automations.yaml";
|
||||
frontend = { };
|
||||
http = {
|
||||
use_x_forwarded_for = true;
|
||||
trusted_proxies = [
|
||||
"127.0.0.1"
|
||||
"::1"
|
||||
];
|
||||
};
|
||||
history.exclude = {
|
||||
entities = hiddenEntities;
|
||||
domains = [
|
||||
"automation"
|
||||
"updater"
|
||||
];
|
||||
};
|
||||
"map" = { };
|
||||
enocean = {
|
||||
device = "/dev/serial/by-id/usb-EnOcean_GmbH_EnOcean_USB_300_DC_FT5OI9YG-if00-port0";
|
||||
};
|
||||
# logbook.exclude.entities = "hiddenEntities";
|
||||
logger = {
|
||||
default = "info";
|
||||
};
|
||||
|
||||
#icloud = {
|
||||
# username = "!secret icloud_email";
|
||||
# password = "!secret icloud_password";
|
||||
# with_family = true;
|
||||
#};
|
||||
network = { };
|
||||
zeroconf = { };
|
||||
system_health = { };
|
||||
default_config = { };
|
||||
system_log = { };
|
||||
sensor = [
|
||||
{
|
||||
platform = "template";
|
||||
sensors.bedtime_alarm = {
|
||||
friendly_name = "Bedtime Alarm";
|
||||
value_template = "09:00";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."home-assistant.cloonar.com" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
acmeRoot = null;
|
||||
extraConfig = ''
|
||||
proxy_buffering off;
|
||||
'';
|
||||
locations."/".extraConfig = ''
|
||||
proxy_pass http://127.0.0.1:8123;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect http:// https://;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
'';
|
||||
};
|
||||
|
||||
sops.secrets."home-assistant-secrets.yaml" = {
|
||||
owner = "hass";
|
||||
path = "/var/lib/hass/secrets.yaml";
|
||||
restartUnits = [ "home-assistant.service" ];
|
||||
};
|
||||
|
||||
users.users.hass.extraGroups = [ "dialout" ];
|
||||
|
||||
networking.firewall = {
|
||||
allowedUDPPorts = [ 5683 ];
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
services.home-assistant.extraComponents = [
|
||||
"ecovacs"
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
services.home-assistant.config = {
|
||||
"binary_sensor pc_0" = [
|
||||
{
|
||||
platform = "enocean";
|
||||
id = [ 254 235 105 198 ];
|
||||
name = "enocean_switch_pc";
|
||||
}
|
||||
];
|
||||
logger.logs."homeassistant.components.enocean" = "debug";
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ... }:
|
||||
let
|
||||
ldap-auth-sh = pkgs.stdenv.mkDerivation {
|
||||
name = "ldap-auth-sh";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "efficiosoft";
|
||||
repo = "ldap-auth-sh";
|
||||
rev = "93b2c00413942908139e37c7432a12bcb705ac87";
|
||||
sha256 = "1pymp6ki353aqkigr89g7hg5x1mny68m31c3inxf1zr26n5s2kz8";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
installPhase = ''
|
||||
mkdir -p $out/etc
|
||||
cat > $out/etc/home-assistant.cfg << 'EOF'
|
||||
CLIENT="ldapsearch"
|
||||
SERVER="ldaps://ldap.cloonar.com:636"
|
||||
USERDN="cn=home-assistant,ou=system,ou=users,dc=cloonar,dc=com"
|
||||
PW="$(<${config.sops.secrets.home-assistant-ldap.path})"
|
||||
BASEDN="ou=users,dc=cloonar,dc=com"
|
||||
SCOPE="one"
|
||||
FILTER="(&(objectClass=cloonarUser)(memberOf=cn=HomeAssistant,ou=groups,dc=cloonar,dc=com)(mail=$(ldap_dn_escape "$username")))"
|
||||
USERNAME_PATTERN='^[a-z|A-Z|0-9|_|-|.|@]+$'
|
||||
on_auth_success() {
|
||||
# print the meta entries for use in HA
|
||||
if echo "$output" | grep -qE '^(dn|DN):: '; then
|
||||
# ldapsearch base64 encodes non-ascii
|
||||
output=$(echo "$output" | sed -n -e "s/^\(dn\|DN\)\s*::\s*\(.*\)$/\2/p" | base64 -d)
|
||||
else
|
||||
output=$(echo "$output" | sed -n -e "s/^\(dn\|DN\)\s*:\s*\(.*\)$/\2/p")
|
||||
fi
|
||||
name=$(echo "$output" | sed -nr 's/^cn=([^,]+).*/\1/Ip')
|
||||
[ -z "$name" ] || echo "name=$name"
|
||||
}
|
||||
EOF
|
||||
install -D -m755 ldap-auth.sh $out/bin/ldap-auth.sh
|
||||
wrapProgram $out/bin/ldap-auth.sh \
|
||||
--prefix PATH : ${lib.makeBinPath [pkgs.openldap pkgs.coreutils pkgs.gnused pkgs.gnugrep]} \
|
||||
--add-flags "$out/etc/home-assistant.cfg"
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
services.home-assistant.config.homeassistant.auth_providers = [
|
||||
{
|
||||
type = "command_line";
|
||||
command = "${ldap-auth-sh}/bin/ldap-auth.sh";
|
||||
meta = true;
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
sops.secrets.home-assistant-ldap.owner = "hass";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
{
|
||||
services.home-assistant.extraComponents = [
|
||||
"deconz"
|
||||
"shelly"
|
||||
"sun"
|
||||
];
|
||||
|
||||
services.home-assistant.config = {
|
||||
homeassistant = {
|
||||
customize_domain = {
|
||||
light = {
|
||||
assumed_state = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
"automation light_sunrise" = {
|
||||
alias = "light_sunrise";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "sun";
|
||||
event = "sunrise";
|
||||
};
|
||||
action = {
|
||||
service = "light.turn_on";
|
||||
target = {
|
||||
entity_id = "{{ states.light | selectattr(\"state\",\"eq\",\"on\") | map(attribute=\"entity_id\") | list }}";
|
||||
};
|
||||
data = {
|
||||
brightness_pct = 254;
|
||||
color_temp = 250;
|
||||
};
|
||||
};
|
||||
};
|
||||
"automation light_sunset" = {
|
||||
alias = "light_sunset";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "sun";
|
||||
event = "sunset";
|
||||
};
|
||||
action = {
|
||||
service = "light.turn_on";
|
||||
target = {
|
||||
entity_id = "{{ states.light | selectattr(\"state\",\"eq\",\"on\") | map(attribute=\"entity_id\") | list }}";
|
||||
};
|
||||
data = {
|
||||
brightness_pct = 30;
|
||||
color_temp = 450;
|
||||
};
|
||||
};
|
||||
};
|
||||
"automation light_on" = {
|
||||
alias = "light_on";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = [
|
||||
"light.bed_room"
|
||||
"light.kitchen"
|
||||
"light.livingroom_lights"
|
||||
"light.hallway_lights"
|
||||
"light.bathroom_light"
|
||||
"light.toilett_lights"
|
||||
"light.storage_lights"
|
||||
];
|
||||
to = "on";
|
||||
};
|
||||
action = [
|
||||
{
|
||||
choose = [
|
||||
{
|
||||
conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.toilett_lights' }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.turn_on";
|
||||
target = {
|
||||
entity_id = "{{ trigger.entity_id }}";
|
||||
};
|
||||
data = {
|
||||
brightness_pct = 30;
|
||||
color_temp = 450;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.hallway_lights' }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.turn_on";
|
||||
target = {
|
||||
entity_id = "{{ trigger.entity_id }}";
|
||||
};
|
||||
data = {
|
||||
brightness_pct = 1;
|
||||
color_temp = 450;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.bathroom_light' }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.turn_on";
|
||||
target = {
|
||||
entity_id = "{{ trigger.entity_id }}";
|
||||
};
|
||||
data = {
|
||||
brightness_pct = 30;
|
||||
color_temp = 450;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.livingroom_lights' }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.turn_on";
|
||||
target = {
|
||||
entity_id = "{{ trigger.entity_id }}";
|
||||
};
|
||||
data = {
|
||||
brightness_pct = 5;
|
||||
color_temp = 450;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and state_attr(trigger.entity_id, 'is_deconz_group') != None }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.turn_on";
|
||||
target = {
|
||||
entity_id = "{{ trigger.entity_id }}";
|
||||
};
|
||||
data = {
|
||||
brightness_pct = 30;
|
||||
color_temp = 450;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
conditions = [ "{{ state_attr('sun.sun', 'elevation') > 4 }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.turn_on";
|
||||
target = {
|
||||
entity_id = "{{ trigger.entity_id }}";
|
||||
};
|
||||
data = {
|
||||
brightness_pct = 100;
|
||||
color_temp = 250;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
"automation bathroom light small" = {
|
||||
alias = "bathroom light small";
|
||||
mode = "restart";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = [
|
||||
"light.bathroom_switch_channel_1"
|
||||
];
|
||||
from = "on";
|
||||
to = "off";
|
||||
};
|
||||
action = [
|
||||
{
|
||||
service = "switch.turn_off";
|
||||
target = {
|
||||
entity_id = "switch.bathroom_small";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
"automation bathroom light" = {
|
||||
alias = "bathroom light";
|
||||
mode = "restart";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = [
|
||||
"light.bathroom_switch_channel_1"
|
||||
];
|
||||
from = "off";
|
||||
to = "on";
|
||||
};
|
||||
action = [
|
||||
{
|
||||
delay = 3600;
|
||||
}
|
||||
{
|
||||
service = "light.turn_off";
|
||||
target = {
|
||||
entity_id = "light.bathroom_switch_channel_1";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
"automation bed_led" = {
|
||||
alias = "bed_led";
|
||||
mode = "restart";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = [
|
||||
"light.bedroom_led"
|
||||
];
|
||||
from = "off";
|
||||
to = "on";
|
||||
};
|
||||
action = [
|
||||
{
|
||||
delay = 10800;
|
||||
}
|
||||
{
|
||||
service = "light.turn_off";
|
||||
target = {
|
||||
entity_id = "{{ trigger.entity_id }}";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
"automation hallway_motion" = {
|
||||
alias = "Hallway Motion";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = "binary_sensor.hallway_motion_motion";
|
||||
};
|
||||
action = {
|
||||
service_template = "light.turn_{{ trigger.to_state.state }}";
|
||||
target = {
|
||||
entity_id = "light.hallway_lights";
|
||||
};
|
||||
};
|
||||
};
|
||||
"automation bed_button_1" = {
|
||||
alias = "bed_button_1";
|
||||
trigger = {
|
||||
platform = "event";
|
||||
event_type = "shelly.click";
|
||||
event_data = {
|
||||
device = "shellybutton1-E8DB84AA196D";
|
||||
};
|
||||
};
|
||||
action = [
|
||||
{
|
||||
choose = [
|
||||
{
|
||||
conditions = [ "{{ trigger.event.data.click_type == \"single\" }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.toggle";
|
||||
entity_id = "light.bed_reading_1";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
conditions = [ "{{ trigger.event.data.click_type == \"double\" }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.toggle";
|
||||
entity_id = "light.bedroom_lights";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
conditions = [ "{{ trigger.event.data.click_type == \"triple\" }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.toggle";
|
||||
entity_id = "light.bedroom_bed";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
"automation bed_button_2" = {
|
||||
alias = "bed_button_2";
|
||||
trigger = {
|
||||
platform = "event";
|
||||
event_type = "shelly.click";
|
||||
event_data = {
|
||||
device = "shellybutton1-E8DB84AA136D";
|
||||
};
|
||||
};
|
||||
action = [
|
||||
{
|
||||
choose = [
|
||||
{
|
||||
conditions = [ "{{ trigger.event.data.click_type == \"single\" }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.toggle";
|
||||
entity_id = "light.bed_reading_2";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
conditions = [ "{{ trigger.event.data.click_type == \"double\" }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.toggle";
|
||||
entity_id = "light.bedroom_lights";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
conditions = [ "{{ trigger.event.data.click_type == \"triple\" }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.toggle";
|
||||
entity_id = "light.bedroom_bed";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
{
|
||||
services.home-assistant.extraComponents = [
|
||||
"nuki"
|
||||
];
|
||||
|
||||
services.home-assistant.config = {
|
||||
"automation house_door" = {
|
||||
alias = "house_door";
|
||||
mode = "restart";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = [
|
||||
"person.dominik"
|
||||
];
|
||||
from = "not_home";
|
||||
to = "home";
|
||||
};
|
||||
action = [
|
||||
{
|
||||
service = "lock.unlock";
|
||||
target = {
|
||||
entity_id = "lock.house_door";
|
||||
};
|
||||
}
|
||||
{
|
||||
delay = "00:05:00";
|
||||
}
|
||||
{
|
||||
service = "lock.lock";
|
||||
target = {
|
||||
entity_id = "lock.house_door";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
"automation house_door_ring" = {
|
||||
alias = "house_door_ring";
|
||||
trigger = {
|
||||
platform = "event";
|
||||
event_type = "nuki_event";
|
||||
event_data = {
|
||||
type = "ring";
|
||||
};
|
||||
};
|
||||
action = [
|
||||
{
|
||||
choose = [
|
||||
{
|
||||
conditions = [ "{{ state.house_door == \"unlocked\" }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "lock.lock";
|
||||
target = {
|
||||
entity_id = "lock.house_door";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
binary_sensor = [
|
||||
{
|
||||
platform = "template";
|
||||
sensors = {
|
||||
lock_critical_battery = {
|
||||
value_template = ''
|
||||
{% set domains = ['lock'] %}
|
||||
{% set ns = namespace(crit=battery_critical, entities=[]) %}
|
||||
{% for domain in domains %}
|
||||
{% set batt_critical = states[domain] | selectattr('attributes.battery_critical','defined') | map(attribute='attributes.battery_critical') | reject('equalto', 'unknown') | reject('equalto', 'None') | map('int') | reject('equalto', 0) | list %}
|
||||
{% if batt_critical|length > 0 %}
|
||||
{% set ns.battery_critical = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ ns.battery_critical }}
|
||||
'';
|
||||
friendly_name = "A lock has critical battery";
|
||||
device_class = "problem";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
alert = {
|
||||
battery_critical = {
|
||||
name = "Lock has low battery!";
|
||||
message = ''
|
||||
{%- set domains = ['lock'] -%}
|
||||
Lock battery is critical:
|
||||
{%- for domain in domains -%}
|
||||
{%- for item in states[domain] -%}
|
||||
{%- if item.attributes.battery_critical is defined -%}
|
||||
{% if item.attributes.battery_critical %}
|
||||
- {{ item.attributes.friendly_name }}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- endfor -%}
|
||||
'';
|
||||
entity_id = "binary_sensor.lock_critical_battery";
|
||||
state = "on";
|
||||
repeat = [
|
||||
5
|
||||
60
|
||||
360
|
||||
];
|
||||
skip_first = true;
|
||||
can_acknowledge = true;
|
||||
notifiers = [
|
||||
"NotificationGroup"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
{
|
||||
services.home-assistant.config = {
|
||||
binary_sensor = [
|
||||
{
|
||||
name = "ps5_living";
|
||||
platform = "command_line";
|
||||
command = "python /var/lib/hass/ps5.py -q -b 10.42.96.176";
|
||||
device_class = "connectivity";
|
||||
scan_interval = 5;
|
||||
}
|
||||
{
|
||||
platform = "template";
|
||||
sensors = {
|
||||
multimedia_device_on = {
|
||||
friendly_name = "Any multimedia device on";
|
||||
device_class = "connectivity";
|
||||
value_template = ''
|
||||
{% if is_state('binary_sensor.ps5_living', 'on') or states('media_player.fire_tv_firetv_living_cloonar_com') != 'off' or states('device_tracker.xbox') == 'home' %}
|
||||
on
|
||||
{% else %}
|
||||
off
|
||||
{% endif %}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
# "automation tv scene" = {
|
||||
# alias = "auto tv scene";
|
||||
# hide_entity = true;
|
||||
# trigger = {
|
||||
# platform = "event";
|
||||
# event_type = "button_pressed";
|
||||
# event_data = {
|
||||
# id = [ 254 235 105 198 ];
|
||||
# };
|
||||
# };
|
||||
# action = {
|
||||
# service_template = "switch.turn_on";
|
||||
# data_template = {
|
||||
# entity_id = "switch.computer";
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# "automation beamer switch" = {
|
||||
# alias = "auto beamer scene";
|
||||
# hide_entity = true;
|
||||
# trigger = {
|
||||
# platform = "state";
|
||||
# entity_id = "sensor.computer_power";
|
||||
# };
|
||||
# condition = {
|
||||
# condition = "and";
|
||||
# conditions = [
|
||||
# {
|
||||
# condition = "numeric_state";
|
||||
# entity_id = "sensor.computer_power";
|
||||
# below = 15;
|
||||
# }
|
||||
# "{{ (as_timestamp(now()) - as_timestamp(states.switch.computer.last_changed)) > 300 }}"
|
||||
# ];
|
||||
# };
|
||||
# action = {
|
||||
# service = "switch.turn_off";
|
||||
# target = {
|
||||
# entity_id = [ "switch.computer" ];
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
"automation xbox on" = {
|
||||
alias = "xbox on";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = "device-tracker.xbox";
|
||||
to = "home";
|
||||
};
|
||||
action = [
|
||||
{
|
||||
service = "media_player.select_source";
|
||||
target = {
|
||||
entity_id = "media_player.marantz_sr6015";
|
||||
};
|
||||
data = {
|
||||
source = "Xbox";
|
||||
};
|
||||
}
|
||||
{
|
||||
delay = 5;
|
||||
}
|
||||
{
|
||||
service = "denonavr.get_command";
|
||||
target = {
|
||||
entity_id = "media_player.marantz_sr6015";
|
||||
};
|
||||
data = {
|
||||
command = "/goform/formiPhoneAppDirect.xml?PWSTANDBY";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
"automation firetv on" = {
|
||||
alias = "firetv on";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = "media_player.fire_tv_firetv_living_cloonar_com";
|
||||
from = "off";
|
||||
};
|
||||
action = [
|
||||
{
|
||||
service = "denonavr.get_command";
|
||||
target = {
|
||||
entity_id = "media_player.marantz_sr6015";
|
||||
};
|
||||
data = {
|
||||
command = "/goform/formiPhoneAppDirect.xml?SIMPLAY";
|
||||
};
|
||||
}
|
||||
{
|
||||
delay = 5;
|
||||
}
|
||||
{
|
||||
service = "denonavr.get_command";
|
||||
target = {
|
||||
entity_id = "media_player.marantz_sr6015";
|
||||
};
|
||||
data = {
|
||||
command = "/goform/formiPhoneAppDirect.xml?PWSTANDBY";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
"automation ps5 on" = {
|
||||
alias = "ps5 on";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = "binary_sensor.ps5_living";
|
||||
to = "on";
|
||||
};
|
||||
action = [
|
||||
{
|
||||
service = "denonavr.get_command";
|
||||
target = {
|
||||
entity_id = "media_player.marantz_sr6015";
|
||||
};
|
||||
data = {
|
||||
command = "/goform/formiPhoneAppDirect.xml?SIBD";
|
||||
};
|
||||
}
|
||||
{
|
||||
delay = 5;
|
||||
}
|
||||
{
|
||||
service = "denonavr.get_command";
|
||||
target = {
|
||||
entity_id = "media_player.marantz_sr6015";
|
||||
};
|
||||
data = {
|
||||
command = "/goform/formiPhoneAppDirect.xml?PWSTANDBY";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
"automation all multimedia off" = {
|
||||
alias = "all multimedia off";
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = "binary_sensor.multimedia_device_on";
|
||||
to = "off";
|
||||
};
|
||||
action = [
|
||||
{
|
||||
conditions = [ "{{ states('media_player.android_tv_metz_cloonar_com') != 'off'}}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "androidtv.adb_command";
|
||||
target = {
|
||||
device_id = "a5e50f268f3a2dbd0741fb8e9ff7f931";
|
||||
};
|
||||
data = {
|
||||
command = "POWER";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
service = "denonavr.get_command";
|
||||
target = {
|
||||
entity_id = "media_player.marantz_sr6015";
|
||||
};
|
||||
data = {
|
||||
command = "/goform/formiPhoneAppDirect.xml?PWSTANDBY";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
"automation all_multimedia_on" = {
|
||||
alias = "all multimedia on";
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = "binary_sensor.multimedia_device_on";
|
||||
to = "on";
|
||||
};
|
||||
condition = {
|
||||
condition = "or";
|
||||
conditions = [
|
||||
{
|
||||
condition = "state";
|
||||
entity_id = "media_player.android_tv_metz_cloonar_com";
|
||||
state = "off";
|
||||
}
|
||||
{
|
||||
condition = "state";
|
||||
entity_id = "media_player.android_tv_metz_cloonar_com";
|
||||
state = "unavailable";
|
||||
}
|
||||
];
|
||||
};
|
||||
action = [
|
||||
{
|
||||
service = "androidtv.adb_command";
|
||||
target = {
|
||||
device_id = "a5e50f268f3a2dbd0741fb8e9ff7f931";
|
||||
};
|
||||
data = {
|
||||
command = "POWER";
|
||||
};
|
||||
}
|
||||
{
|
||||
delay = 5;
|
||||
}
|
||||
{
|
||||
service = "androidtv.adb_command";
|
||||
target = {
|
||||
device_id = "a5e50f268f3a2dbd0741fb8e9ff7f931";
|
||||
};
|
||||
data = {
|
||||
command = "adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHDMI100004";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
# "automation multimedia input" = {
|
||||
# hide_entity = true;
|
||||
# trigger = {
|
||||
# platform = "state";
|
||||
# entity_id = "sensor.computer_power";
|
||||
# };
|
||||
# condition = {
|
||||
# condition = "and";
|
||||
# conditions = [
|
||||
# {
|
||||
# condition = "numeric_state";
|
||||
# entity_id = "sensor.computer_power";
|
||||
# below = 15;
|
||||
# }
|
||||
# "{{ (as_timestamp(now()) - as_timestamp(states.switch.computer.last_changed)) > 300 }}"
|
||||
# ];
|
||||
# };
|
||||
# action = {
|
||||
# service = "switch.turn_off";
|
||||
# target = {
|
||||
# entity_id = [ "switch.computer" ];
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
services.home-assistant.extraComponents = [
|
||||
"nuki"
|
||||
];
|
||||
|
||||
services.home-assistant.config = {
|
||||
"automation house_door" = {
|
||||
alias = "house_door";
|
||||
mode = "restart";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = [
|
||||
"person.dominik"
|
||||
];
|
||||
from = "not_home";
|
||||
to = "home";
|
||||
};
|
||||
action = [
|
||||
{
|
||||
service = "lock.unlock";
|
||||
target = {
|
||||
entity_id = "lock.house_door";
|
||||
};
|
||||
}
|
||||
{
|
||||
delay = "00:05:00";
|
||||
}
|
||||
{
|
||||
service = "lock.lock";
|
||||
target = {
|
||||
entity_id = "lock.house_door";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
"automation house_door_ring" = {
|
||||
alias = "house_door_ring";
|
||||
trigger = {
|
||||
platform = "event";
|
||||
event_type = "nuki_event";
|
||||
event_data = {
|
||||
type = "ring";
|
||||
};
|
||||
};
|
||||
action = [
|
||||
{
|
||||
choose = [
|
||||
{
|
||||
conditions = [ "{{ state.house_door == \"unlocked\" }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "lock.lock";
|
||||
target = {
|
||||
entity_id = "lock.house_door";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{ ... }: {
|
||||
virtualisation = {
|
||||
podman = {
|
||||
enable = true;
|
||||
|
||||
# Create a `docker` alias for podman, to use it as a drop-in replacement
|
||||
dockerCompat = true;
|
||||
|
||||
# Required for containers under podman-compose to be able to talk to each other.
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
# For Nixos version > 22.11
|
||||
#defaultNetwork.settings = {
|
||||
# dns_enabled = true;
|
||||
#};
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation.oci-containers = {
|
||||
backend = "podman";
|
||||
containers.homeassistant = {
|
||||
volumes = [ "home-assistant:/config" ];
|
||||
environment.TZ = "Europe/Vienna";
|
||||
image = "ghcr.io/home-assistant/home-assistant:2023.7.3";
|
||||
extraOptions = [
|
||||
"--network=host"
|
||||
"--device=/dev/serial/by-id/usb-EnOcean_GmbH_EnOcean_USB_300_DC_FT5OI9YG-if00-port0:/dev/serial/by-id/usb-EnOcean_GmbH_EnOcean_USB_300_DC_FT5OI9YG-if00-port0"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."home-assistant.cloonar.com" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
acmeRoot = null;
|
||||
extraConfig = ''
|
||||
proxy_buffering off;
|
||||
'';
|
||||
locations."/".extraConfig = ''
|
||||
proxy_pass http://127.0.0.1:8123;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect http:// https://;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
'';
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
allowedUDPPorts = [
|
||||
5683 # shelly coiot
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
services.home-assistant.config = {
|
||||
notify = [
|
||||
{
|
||||
name = "NotificationGroup";
|
||||
platform = "group";
|
||||
services = [
|
||||
{
|
||||
service = "pushover_dominik";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
services.home-assistant.config = {
|
||||
"automation pc_switch" = {
|
||||
alias = "switch pc";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "event";
|
||||
event_type = "button_pressed";
|
||||
event_data = {
|
||||
id = [ 254 235 105 198 ];
|
||||
};
|
||||
};
|
||||
action = {
|
||||
service_template = "switch.turn_on";
|
||||
data_template = {
|
||||
entity_id = "switch.computer";
|
||||
};
|
||||
};
|
||||
};
|
||||
"automation pc power" = {
|
||||
alias = "auto pc power off";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = "sensor.computer_power";
|
||||
};
|
||||
condition = {
|
||||
condition = "and";
|
||||
conditions = [
|
||||
{
|
||||
condition = "numeric_state";
|
||||
entity_id = "sensor.computer_power";
|
||||
below = 15;
|
||||
}
|
||||
"{{ (as_timestamp(now()) - as_timestamp(states.switch.computer.last_changed)) > 300 }}"
|
||||
];
|
||||
};
|
||||
action = {
|
||||
service = "switch.turn_off";
|
||||
target = {
|
||||
entity_id = [ "switch.computer" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
services.home-assistant.extraComponents = [
|
||||
"mqtt_room"
|
||||
"opnsense"
|
||||
];
|
||||
services.home-assistant.config = {
|
||||
opnsense = {
|
||||
url = "https://fw.cloonar.com/api";
|
||||
api_secret = "!secret opnsense_api_secret";
|
||||
api_key = "!secret opnsense_api_key";
|
||||
};
|
||||
sensor = [
|
||||
{
|
||||
platform = "mqtt_room";
|
||||
name = "Dominiks iPhone BLE";
|
||||
device_id = "roomAssistant:d2a41d13-16bf-41fb-af4b-c520bdc7b68a";
|
||||
# device_id = "0a666fe0ccd0d587414fec9b9946168f";
|
||||
state_topic = "espresense/rooms";
|
||||
away_timeout = 30;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
config.sops.secrets.ps5-mqtt-env.restartUnits = [ "podman-ps5Mqtt.service" ];
|
||||
|
||||
config.virtualisation.oci-containers.containers = {
|
||||
ps5Mqtt = {
|
||||
image = "ghcr.io/funkeyflo/ps5-mqtt/amd64:latest ";
|
||||
# ports = ["127.0.0.1:8645:8645"];
|
||||
volumes = [
|
||||
"/var/lib/ps5-mqtt:/config"
|
||||
];
|
||||
# entrypoint = "/config/run.sh";
|
||||
entrypoint = "/usr/bin/node";
|
||||
cmd = [
|
||||
"app/server/dist/index.js"
|
||||
];
|
||||
# entrypoint = "/bin/bash";
|
||||
# cmd = [
|
||||
# "-c \"echo $MQTT_HOST\""
|
||||
# ];
|
||||
environmentFiles = [
|
||||
config.sops.secrets.ps5-mqtt-env.path
|
||||
];
|
||||
extraOptions = [
|
||||
"--network=host"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
config.networking.firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ 8645 ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
services.home-assistant.extraComponents = [
|
||||
"pushover"
|
||||
];
|
||||
|
||||
# services.home-assistant.config = {
|
||||
# notify = [
|
||||
# {
|
||||
# name = "pushover_dominik";
|
||||
# platform = "pushover";
|
||||
# api_key = "!secret pushover_dominik_api_key";
|
||||
# user_key = "!secret pushover_dominik_user_key";
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
services.home-assistant.extraComponents = [
|
||||
"roborock"
|
||||
];
|
||||
|
||||
services.home-assistant.config = {
|
||||
"automation roborock" = {
|
||||
alias = "roborock";
|
||||
hide_entity = false;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = [
|
||||
"person.dominik"
|
||||
];
|
||||
from = "home";
|
||||
to = "not_home";
|
||||
};
|
||||
action = [
|
||||
{
|
||||
service = "vacuum.start";
|
||||
target = {
|
||||
device_id = "136c307ff46cd968d08e9f9d20886755";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
services.home-assistant.config = {
|
||||
"automation scene_switch" = {
|
||||
alias = "switch scene";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "event";
|
||||
event_type = "button_pressed";
|
||||
event_data = {
|
||||
id = [ 254 242 234 134 ];
|
||||
};
|
||||
};
|
||||
action = {
|
||||
service_template = "switch.turn_on";
|
||||
data_template = {
|
||||
entity_id = "switch.computer";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
home-assistant-ldap: ENC[AES256_GCM,data:De7kuRji+flc0juqE3z1MyNo938Y18jhYtxHkvBX1AsmcJO6a37qJ6o9eCVyhcN/uyaS8cySucqKErh3SlCOZw==,iv:DD4Bp7yU0TCQ/Zeildmrt1HSUbuJgQ0L2UUSmMi6Obo=,tag:t1Hz0GiXzodVK64e0Xuf6g==,type:str]
|
||||
home-assistant-secrets.yaml: ENC[AES256_GCM,data:owCBlfPXA66zxGaMwo6mViSZS7f3WPXOTtWiWFR8R/9Cqv7YvIaY7cqYX1OYFfEJyMyq6YLhVV9Zi0/K40VtUmhgR324x/knQbKkZGxv6gwqdIZ/zaZgQIu29xtY4DQnK24/5942HtisSnQnJxgbpchnjJCAQqri2/68LjGh8GoJVhF34Zji0MHBLAxR1y5JApOb5GUpc0ftMu4j6cbU/qxiZbRkzbrjlgAjBFjARYmsaWiilXg5jT2pf0Fz6bOHslcO+b3qePgIb/cJPP9aVYy76QA0oZ03f3Qu0w+IsjBKuXGaWKVBWBDyK1E37Y/Xif8w3H3cPqkAI6qxCPXi7djYfEpOz2M1L+5GTJGJz8fmvYzVJqU+hpZeI/7qJdiQ4/98YfuDU6nTEwWumcsPKsafJzdSeVfFYcE2x1H+QJDfJ3sgWJkfLDOrRxaXIwoXeSBSYAXPxjdomBzcdgKvo8MBH47pDbR4hK+y8+0LnoPafIyh8+FeAFzbn6/9ScWzF/MOyxFnap3edd12k5yWN+Yc4xacye3RR1h/mp1+DQF9xZ1xMTE70nwNdtIsGU0cV8qUvPgknZB/0US2oZ19fdxVuAN2rneEkK/nIGoKVw==,iv:x/F8CnsxROweCosvX1yAMHzwtI34kGauPvWF8yu2Yf8=,tag:WbzjtVhEPgUhL8g07kHjdA==,type:str]
|
||||
ps5-mqtt-env: ENC[AES256_GCM,data:g079HmYjMQ/Dr/vHSuxnLDwyOG3bSmzGtUfQLXJgKFUoC+5dAyUwYu8WRD1hskER2v8yIz2oHx8dQXLuWsmKYRErk6Sybpe0+FOcqOvAXgzv1ow95sjClkrS+rwjHcoHb1nts5lP5bGkY0e4Z6Dfn5AoeQ4pEA1TOzANvPDqDZUBh+L4hUDkDSWg7sAH3pHK0BqZHwiDNrvE9ac8MFHJmrPVEr4dqhRwAip+YMAdGCwp0ofdm2amUL7aHTaCQhjgsAW306C8ksMwuFE+dAvsqJGZ1N5T2nxP9LYVWcc8ZsKV8VklZ/QS6ScBGz4Oi4YpPDvkt+ErY929t0vISjKengnDHhu/+WYaBxeVbre5G29hK+jrnmUHFBa6pjwCSFVJq8mRIn6KorGwltxObyFBxddf+kiAMDbvnqW3E6sZtW+mF+48hTD8ygjSE8D8h7IoyYYTh0nPY4DzkfMR2OXqpz+bh+dpjnh3UQktJ1HXh902A2ljmxUEMGWtcOc2fDTxEMheTqdvg2z7Ek/FIwq/curVbdHIrzeIXDis7LIRk4G8b4mA6nHG4KrzCF00LAV7Ph9Nx1wAgrxvBTq4bqnO2VP44vtDsQ/O+Dr+wZSlP3EL4PsAJznfa7YcvStvV1Nn6FrVY04W,iv:1vttyQqYffChK12Wy5KTZEZ00pESsMefXHbulKsDSqU=,tag:pzgw0jJqICaro2U2FfQEiA==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age16veg3fmvpfm7a89a9fc8dvvsxmsthlm70nfxqspr6t8vnf9wkcwsvdq38d
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBieVNmLy9zK1hXWHdGRHF3
|
||||
WXd5b0pjR0pBaFkvVSt5ZVNyaUlCL0R1c2lnCkRCY1RmZnY1UVFuWURUMElHcFU1
|
||||
WHgrZE5ZY3FQUVp2VkhIcHh3WDV4aUUKLS0tIGFRZFNsKzU4ZDhPQ0NLbmtPSEJB
|
||||
YW8zNjhYWGNRcy9VbEZoaWplakVNWkUK48LBhFusDMZj2momMwRXdU7bLiGvzvqX
|
||||
QwdxorLMP2/GW6x5xpFj1khLCwxYDOys4xGvmE89hYZa++OSYU+Ejw==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
- recipient: age1ezq2j34qngky22enhnslx6hzh4ekwk8dtmn6c9us0uqxqpn7hgpsspjz58
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAwY0pGaUU3alJrYmhQM2Y4
|
||||
TTMrbGsrRThlTUN1R3RCbFZFeVR1KzVDMWg4CnlQTzBzdTNPMTFvTUVYRXFEbUVP
|
||||
YWFvRTJqZjcxZHhtRkJrajNuUWoyYzgKLS0tIEhVcFI4N0E4VEVOZDIxREJ4bkNi
|
||||
UjRhRVpkTHF5a3p2bjhiVDZwMWRWMkEKpsHLWcPGQWpBo4Z8h7XFOP0bCct83BPj
|
||||
d/QDjarzugd6jamWVXKidZwADxfP59Pvo9JmLlFL5isgZ1TL3ZHL+g==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2023-04-26T13:33:07Z"
|
||||
mac: ENC[AES256_GCM,data:i/2+Qr0ihMaDPF22pyo7Qy3SYEr0Fr5dfRJSZ9xMu/5TFSm3GXNhd2KZVXjl6isbPbD22/siuI2MZeSB/iTFcRadtswmGnb6Lgsi8K/LULKvwXHf5t/Py/z59CpXBSgfUQQ6BuodNc25DRpCX8HEhFfd3Ajgyavc8vHVpnwG8eQ=,iv:Xu3WsyIqDbtReP9pBsiEf17pAbdVrY/y6wM2dleguFQ=,tag:gh6m7MUzMx2/lsZ5XExwyw==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.7.3
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
services.home-assistant.config.shelly = {
|
||||
FindAndroid = {
|
||||
speech.text = "Send notification";
|
||||
action = {
|
||||
service = "notify.pushover";
|
||||
data = {
|
||||
message = "Phonefinderalert";
|
||||
target = "android";
|
||||
data.sound = "echo";
|
||||
data.priority = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
services.home-assistant.config = {
|
||||
"automation wakeup" = {
|
||||
alias = "wakeup";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "template";
|
||||
value_template = ''
|
||||
{{ now().timestamp() | timestamp_custom('%H:%M') == (as_timestamp(strptime(states('sensor.bedtime_alarm'), "%H:%M")) - 1800) | timestamp_custom('%H:%M', false) }}
|
||||
'';
|
||||
};
|
||||
action = {
|
||||
service_template = "switch.turn_on";
|
||||
data_template = {
|
||||
entity_id = "switch.coffee_switch";
|
||||
};
|
||||
};
|
||||
};
|
||||
"automation sleep" = {
|
||||
alias = "sleep";
|
||||
hide_entity = true;
|
||||
trigger = [
|
||||
{
|
||||
platform = "event";
|
||||
event_type = "shelly.click";
|
||||
event_data = {
|
||||
device = "shellybutton1-E8DB84AA196D";
|
||||
};
|
||||
}
|
||||
{
|
||||
platform = "event";
|
||||
event_type = "shelly.click";
|
||||
event_data = {
|
||||
device = "shellybutton1-E8DB84AA136D";
|
||||
};
|
||||
}
|
||||
];
|
||||
action = [
|
||||
{
|
||||
choose = [
|
||||
{
|
||||
conditions = [ "{{ trigger.event.data.click_type == \"long\" }}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "light.turn_off";
|
||||
entity_id = "all";
|
||||
}
|
||||
{
|
||||
service = "light.turn_on";
|
||||
entity_id = "light.bedroom_bed";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
services.home-assistant = {
|
||||
extraComponents = [ "snapcast" ];
|
||||
config = {
|
||||
# "media_player" = {
|
||||
# platform = "snapcast";
|
||||
# host = "snapcast.cloonar.com";
|
||||
# };
|
||||
"automation toilett_music" = {
|
||||
alias = "toilett music";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = "light.toilett_switch";
|
||||
};
|
||||
action = {
|
||||
choose = [
|
||||
{
|
||||
conditions = [ "{{trigger.to_state.state == 'on'}}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "media_player.volume_mute";
|
||||
target = {
|
||||
entity_id = "media_player.snapcast_client_e4_5f_01_3c_fb_c3";
|
||||
};
|
||||
data = {
|
||||
is_volume_muted = false;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
conditions = [ "{{trigger.to_state.state == 'off'}}" ];
|
||||
sequence = [
|
||||
{
|
||||
service = "media_player.volume_mute";
|
||||
target = {
|
||||
entity_id = "media_player.snapcast_client_e4_5f_01_3c_fb_c3";
|
||||
};
|
||||
data = {
|
||||
is_volume_muted = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
"automation piano" = {
|
||||
alias = "piano";
|
||||
hide_entity = true;
|
||||
trigger = {
|
||||
platform = "state";
|
||||
entity_id = "media_player.snapcast_client_e4_5f_01_96_c1_1e";
|
||||
attribute = "is_volume_muted";
|
||||
};
|
||||
action = {
|
||||
service = "switch.turn_on";
|
||||
target = {
|
||||
entity_id = "switch.piano_switch_power";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
59
hosts/home-assistant.cloonar.com/modules/mopidy.nix
Normal file
59
hosts/home-assistant.cloonar.com/modules/mopidy.nix
Normal file
@@ -0,0 +1,59 @@
|
||||
{ pkgs, lib, ... }:
|
||||
let
|
||||
mopidy-autoplay = pkgs.python3Packages.buildPythonApplication rec {
|
||||
pname = "Mopidy-Autoplay";
|
||||
version = "0.2.3";
|
||||
|
||||
src = pkgs.python3Packages.fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "sha256-E2Q+Cn2LWSbfoT/gFzUfChwl67Mv17uKmX2woFz/3YM=";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pkgs.mopidy
|
||||
] ++ (with pkgs.python3Packages; [
|
||||
configobj
|
||||
]);
|
||||
|
||||
# no tests implemented
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://codeberg.org/sph/mopidy-autoplay";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
services.mopidy = {
|
||||
enable = true;
|
||||
extensionPackages = [ pkgs.mopidy-iris pkgs.mopidy-tunein mopidy-autoplay ];
|
||||
configuration = ''
|
||||
[audio]
|
||||
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/run/snapserver/mopidy
|
||||
|
||||
[file]
|
||||
enabled = false
|
||||
|
||||
[autoplay]
|
||||
enabled = true
|
||||
'';
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."mopidy.cloonar.com" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
acmeRoot = null;
|
||||
extraConfig = ''
|
||||
proxy_buffering off;
|
||||
'';
|
||||
locations."/".extraConfig = ''
|
||||
proxy_pass http://127.0.0.1:6680;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect http:// https://;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
'';
|
||||
};
|
||||
}
|
||||
32
hosts/home-assistant.cloonar.com/modules/mosquitto.nix
Normal file
32
hosts/home-assistant.cloonar.com/modules/mosquitto.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
services.mosquitto = {
|
||||
enable = true;
|
||||
|
||||
listeners = [
|
||||
{
|
||||
users."espresense" = {
|
||||
password = "insecure-password";
|
||||
acl = [ "readwrite #" ];
|
||||
};
|
||||
users."home-assistant" = {
|
||||
hashedPassword = "$7$101$7uaagoQWQ3ICJ/wg$5cWZs4ae4DjToe44bOzpDopPv1kRaaVD+zF6BE64yDJH2/MBqXfD6f2/o9M/65ArhV92DAK+txXRYsEcZLl45A==";
|
||||
acl = [ "readwrite #" ];
|
||||
};
|
||||
users."ps5-mqtt" = {
|
||||
password = "insecure-password";
|
||||
acl = [ "readwrite #" ];
|
||||
};
|
||||
users."shairport-mqtt" = {
|
||||
password = "insecure-password";
|
||||
acl = [ "readwrite #" ];
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ 1883 ];
|
||||
};
|
||||
}
|
||||
128
hosts/home-assistant.cloonar.com/modules/snapserver.nix
Normal file
128
hosts/home-assistant.cloonar.com/modules/snapserver.nix
Normal file
@@ -0,0 +1,128 @@
|
||||
{ pkgs, config, python3Packages, ... }:
|
||||
let
|
||||
shairport-sync = pkgs.shairport-sync.overrideAttrs (_: {
|
||||
configureFlags = [
|
||||
"--with-alsa" "--with-pipe" "--with-pa" "--with-stdout"
|
||||
"--with-avahi" "--with-ssl=openssl" "--with-soxr"
|
||||
# "--with-mqtt-client"
|
||||
"--without-configfiles"
|
||||
"--sysconfdir=/etc"
|
||||
"--with-metadata"
|
||||
];
|
||||
# buildInputs = [
|
||||
# pkgs.openssl
|
||||
# pkgs.avahi
|
||||
# pkgs.popt
|
||||
# pkgs.libconfig
|
||||
# pkgs.mosquitto
|
||||
# pkgs.alsa-lib
|
||||
# pkgs.libpulseaudio
|
||||
# pkgs.pipewire
|
||||
# pkgs.libjack2
|
||||
# pkgs.soxr
|
||||
# ];
|
||||
});
|
||||
in
|
||||
{
|
||||
environment.etc = {
|
||||
# Creates /etc/nanorc
|
||||
shairport = {
|
||||
text = ''
|
||||
whatever you want to put in the file goes here.
|
||||
metadata =
|
||||
{
|
||||
enabled = "yes"; // set this to yes to get Shairport Sync to solicit metadata from the source and to pass it on via a pipe
|
||||
include_cover_art = "yes"; // set to "yes" to get Shairport Sync to solicit cover art from the source and pass it via the pipe. You must also set "enabled" to "yes".
|
||||
cover_art_cache_directory = "/tmp/shairport-sync/.cache/coverart"; // artwork will be stored in this directory if the dbus or MPRIS interfaces are enabled or if the MQTT client is in use. Set it to "" to prevent caching, which may be useful on some systems
|
||||
pipe_name = "/tmp/shairport-sync-metadata";
|
||||
pipe_timeout = 5000; // wait for this number of milliseconds for a blocked pipe to unblock before giving up
|
||||
};
|
||||
|
||||
|
||||
mqtt =
|
||||
{
|
||||
enabled = "yes"; // set this to yes to enable the mqtt-metadata-service
|
||||
hostname = "127.0.0.1"; // Hostname of the MQTT Broker
|
||||
port = 1883; // Port on the MQTT Broker to connect to
|
||||
username = "espresense"; //set this to a string to your username in order to enable username authentication
|
||||
password = "insecure-password"; //set this to a string you your password in order to enable username & password authentication
|
||||
topic = "shairport"; //MQTT topic where this instance of shairport-sync should publish. If not set, the general.name value is used.
|
||||
// publish_raw = "no"; //whether to publish all available metadata under the codes given in the 'metadata' docs.
|
||||
publish_parsed = "yes"; //whether to publish a small (but useful) subset of metadata under human-understandable topics
|
||||
publish_cover = "yes"; //whether to publish the cover over mqtt in binary form. This may lead to a bit of load on the broker
|
||||
// enable_remote = "no"; //whether to remote control via MQTT. RC is available under `topic`/remote.
|
||||
};
|
||||
'';
|
||||
|
||||
# The UNIX file mode bits
|
||||
mode = "0440";
|
||||
};
|
||||
};
|
||||
|
||||
services.snapserver = {
|
||||
enable = true;
|
||||
codec = "flac";
|
||||
http.docRoot = "${pkgs.snapcast}/share/snapserver/snapweb";
|
||||
streams.mopidy = {
|
||||
type = "pipe";
|
||||
location = "/run/snapserver/mopidy";
|
||||
};
|
||||
streams.airplay = {
|
||||
type = "airplay";
|
||||
location = "${shairport-sync}/bin/shairport-sync";
|
||||
query = {
|
||||
devicename = "Multi Room";
|
||||
port = "5000";
|
||||
params = "--mdns=avahi";
|
||||
};
|
||||
};
|
||||
streams.mixed = {
|
||||
type = "meta";
|
||||
location = "/airplay/mopidy";
|
||||
};
|
||||
};
|
||||
|
||||
services.avahi.enable = true;
|
||||
services.avahi.publish.enable = true;
|
||||
services.avahi.publish.userServices = true;
|
||||
|
||||
# services.shairport-sync = {
|
||||
# enable = true;
|
||||
# arguments = "-v -o=pipe -- pipe:name=/run/snapserver/airplay";
|
||||
# };
|
||||
|
||||
services.nginx.virtualHosts."snapcast.cloonar.com" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
acmeRoot = null;
|
||||
extraConfig = ''
|
||||
proxy_buffering off;
|
||||
'';
|
||||
locations."/".extraConfig = ''
|
||||
proxy_pass http://127.0.0.1:1780;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect http:// https://;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80 # http
|
||||
443 # https
|
||||
1704 # snapcast
|
||||
1705 # snapcast
|
||||
5000 # airplay
|
||||
5353 # airplay
|
||||
];
|
||||
networking.firewall.allowedUDPPorts = [
|
||||
5000 # airplay
|
||||
5353 # airplay
|
||||
];
|
||||
networking.firewall.allowedUDPPortRanges = [
|
||||
{ from = 6001; to = 6011; } # airplay
|
||||
];
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
borg-passphrase: ENC[AES256_GCM,data:Z7JftGp60YzKLXpfqRlIOFBx+WDbOA7nrqyYNeKWR5c2+tSAeQ+nsKxYS8cViIZor+OI8/PwkSgBYmslJ4iHpQ==,iv:d3kvQj2Eheu8uXnXYLmAw4YmL6be43NZJbCCR0RaJdg=,tag:K9LmnJQiyQu1MoHGDq8Jtw==,type:str]
|
||||
borg-ssh-key: ENC[AES256_GCM,data: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,iv:W3cwoql686CZ/1gvN/2peskuOPj5FnEnQ7bV28+nHJ4=,tag:heszwVzajuFJKQLmT/h6/w==,type:str]
|
||||
home-assistant-ldap: ENC[AES256_GCM,data:goVtStX95X3B4XqzJKmPNt5FLOtG9AcZRKV8HaNWaHOQQCvMuAeTE5GVllkgisQt3IT7nQDAC4y5O7Ol08GPew==,iv:Fr9sodSAlP/pA7q7eoJ8uj5FRHI5lZ55Q+ChJksmINA=,tag:mk/j3iq9UQEks3Pxfl9cKg==,type:str]
|
||||
home-assistant-secrets.yaml: ENC[AES256_GCM,data:S0qrCCvlNMZwpcGZww5ER9u2Aqy77/ZT5Sfr0biME9qjlFliiPjTd9NtM6TEktAYPHdbx94pQ9jvUg0EHCaG+0VSPhO/q4a5CkdokcU7xaInwY8r8gEx1US5MDESrWwO3THIVXFGQi7z78VrE8D4XaEiUl0GYXHre0TYJevkxr6/F7tr/JCzREAdCACyP5U8HoCrm6lWryWcCDLst15NheY4dfRAv0PsMjNDc4oWfs+BPmvC+kfvLw2YjdETrABaG0QTiUVrrRpnVcyVBSwQDTi6b8CIbrkd+S6I7dMI4Of5b6+wPBBrToSdZKhZd/lJrY9nSht3NPUrcGbkbpCBCpDmS26U0ZYiH0BApmsP7UIn4iYwuN+DZwsdE1riK2dt1qeXUE0wcj1Jt0vFbSuxPpvWaATaYTJTRVnhKkRLMYaEIjO5x9XQIkAdsHLpK8/rgfUSvLoTd3cqab+mPvm47R22HD4h1LvIiRgpgy9hsorg9vQ/y9npA4MSDbyS/tnJfleieLYIqiB9kRzjExairmHbu8Pi8UqRYD6zuKmKgc8s4DIxWDarrsKgXwyj3pBTPEv2lO+nApQkgIVAJ5qy1GyMLV7sta2F6uQbP8ek+Q==,iv:ofV96M6hCYgAEz8eKW97gMl1METkN40jV2yOXWsSpw4=,tag:UJ1uaGxjY0tQFITf65Cqqg==,type:str]
|
||||
ps5-mqtt-env: ENC[AES256_GCM,data:Db+RZBLLFk/gHUBAIH41sT4ykhqVOTfsjw/DMuF+YWzUkOMNuOEymeTiL8w0UxIOVr4ARQHefjB/E2kkqvRAE2b0ZOQ/dNnhsia0okpwU53aOExOe9xcUz6NoCi7aYRx9Gk1yySNJcCpUENUcyoVLEogEsB4/JNc06EDslMKAclMEXmIo4cPRX11/WSCgLx8j22dlSm9fVQWIigEmf6jDvSkZZN68ArHpazBnXJgHZRuXmpjSWsVkqyYqvCMPu2xvChCRmzA6s8nIlyzB/aW1hyZeQQLxM73t+YGda1SEwdiG4tl3AdUa4AoGDTtUoGr62SRl8pyCGengiivzOnzTGBV4w5sa/DXH4pLHFgkZAI/FVl+XZJrNJ5NfWIYS6DO3CvXU87GWdsJ3yaUZiIGUVMqXeFmgvU5hUjHBl4lhCJZvrWpIT9ZXR7nSlET/7v3ovgpw1cyeVic9McxCDh5kOgPH8Y0nXFjJWVDCSJgPEiIEtf94tj8m4yHULd6J+TRcmMND30dAmTAstdPveP5JPzHlHJU7Zq8My0R/yw/MCN8meX4/gQJf9MUOj5XJmdAv4nTB3Szp17n6i0sK0j0exJ5UIpxskaHiAMBPrZpNte+jLShuQ1VG6gPA5PVnyDHGVmpFI9V,iv:IawfKpwBwn6JcHZdxyRU/8mS4oIhfad7WtnBVFdlcUs=,tag:hfQOM5FxB0q7DYRBQWCxDQ==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
@@ -24,8 +27,8 @@ sops:
|
||||
U0hkcXFObndTMTN3d1hzcnVyUktKRFkKd0LP3Ex+2oUDphP7alk7jvaj/vu4jM2X
|
||||
MkEOoG8cm/uIIu85Yuz5wRZKhb1tU/1iXTZD6Nc0IcIxRZPl/o0Llw==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2023-01-30T06:47:22Z"
|
||||
mac: ENC[AES256_GCM,data:BcBCbtz0+EiT9oKNY9mBOSWlzg9Jl6+/QY2gO7PnnGQlQ4U0fKbRnu6qQ6Wps7omAHZgkiG1IbeURPPRg6ujs1dQYm1r8ol8D6nTmvZS8bQqFzsP+becpW5aA/aIi60d06WbLOHoecnr6gi58cgIqOhckyDMI2NsXlcFJbHgADc=,iv:ZJnAGMqZACRbfkzpV+ZYrUZ822l130Sye+1TdigbQzk=,tag:WIeyyFWpvqGem+gQY4vb/w==,type:str]
|
||||
lastmodified: "2023-08-19T12:40:23Z"
|
||||
mac: ENC[AES256_GCM,data:efRmRltjulYzHiCM5Dz/3sU3vtRML4tbm6J/rIuURKCw5YkWDYRZPKK9peCefYczIZrrBUGB9Z7OIOSNbCaPKvegcxUyO45A/wox029DuosTX49T3jTJlzowm4eFu4qbeSNj2/s4BhnsAbYGS6P40f0pQ242NoUlr1omLnFcQ9I=,iv:FMr1omABdoVVYNT7H+hcp4g+yavxn+jJP+A9m09d8iY=,tag:2/JeC/UnK4ADSygvo/QKOg==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.7.3
|
||||
|
||||
Reference in New Issue
Block a user