Add homeassistant configuration
This commit is contained in:
parent
b41aac2041
commit
69537d20b3
6 changed files with 300 additions and 0 deletions
|
|
@ -81,6 +81,11 @@ home-manager switch --flake github:Logan-Lin/nix-config#yanlin@hs
|
||||||
│ │ ├── extensions.nix
|
│ │ ├── extensions.nix
|
||||||
│ │ └── search.nix
|
│ │ └── search.nix
|
||||||
│ ├── fonts.nix # Font packages and configuration
|
│ ├── fonts.nix # Font packages and configuration
|
||||||
|
│ ├── homeassistant/ # Home Assistant smart home configuration
|
||||||
|
│ │ ├── configuration.yaml # Main HA configuration with reverse proxy
|
||||||
|
│ │ ├── automations.yaml # Bedroom lighting automation via Zigbee
|
||||||
|
│ │ ├── scenes.yaml # Scene definitions (empty, ready for use)
|
||||||
|
│ │ └── scripts.yaml # Script definitions (empty, ready for use)
|
||||||
│ ├── immich.nix # Immich photo management service configuration
|
│ ├── immich.nix # Immich photo management service configuration
|
||||||
│ ├── p10k.zsh # Powerlevel10k theme configuration
|
│ ├── p10k.zsh # Powerlevel10k theme configuration
|
||||||
│ ├── projects.json # Project definitions
|
│ ├── projects.json # Project definitions
|
||||||
|
|
@ -968,6 +973,10 @@ Comprehensive suite of self-hosted services managed via Podman with automatic st
|
||||||
|
|
||||||
#### Home Automation & Monitoring
|
#### Home Automation & Monitoring
|
||||||
- **Home Assistant**: Smart home automation with USB Zigbee integration
|
- **Home Assistant**: Smart home automation with USB Zigbee integration
|
||||||
|
- Declarative configuration in `config/homeassistant/`
|
||||||
|
- Bedroom lighting automation via Zigbee switch
|
||||||
|
- Reverse proxy trust configuration for Traefik
|
||||||
|
- Configuration and automations version-controlled and backed up
|
||||||
- **Syncthing**: Secure file synchronization across devices
|
- **Syncthing**: Secure file synchronization across devices
|
||||||
|
|
||||||
#### Productivity & Knowledge Management
|
#### Productivity & Knowledge Management
|
||||||
|
|
|
||||||
234
config/homeassistant/automations.yaml
Normal file
234
config/homeassistant/automations.yaml
Normal file
|
|
@ -0,0 +1,234 @@
|
||||||
|
# Home Assistant Automations
|
||||||
|
# This file contains all automation definitions for the smart home
|
||||||
|
# Documentation: https://www.home-assistant.io/docs/automation/yaml/
|
||||||
|
|
||||||
|
# Bedroom Light Control Automation
|
||||||
|
# Controls bedroom lights via Zigbee switch with multiple button actions
|
||||||
|
- id: '1749663887767'
|
||||||
|
alias: Bedroom light - switch control
|
||||||
|
triggers:
|
||||||
|
- device_id: 9041a8cd641d55436de6b8645b20e3c8
|
||||||
|
domain: zha
|
||||||
|
type: remote_button_short_press
|
||||||
|
subtype: button_1
|
||||||
|
trigger: device
|
||||||
|
id: first_btn
|
||||||
|
- device_id: 9041a8cd641d55436de6b8645b20e3c8
|
||||||
|
domain: zha
|
||||||
|
type: remote_button_short_press
|
||||||
|
subtype: button_2
|
||||||
|
trigger: device
|
||||||
|
id: second_btn
|
||||||
|
- device_id: 9041a8cd641d55436de6b8645b20e3c8
|
||||||
|
domain: zha
|
||||||
|
type: remote_button_double_press
|
||||||
|
subtype: button_1
|
||||||
|
trigger: device
|
||||||
|
id: first_btn_double
|
||||||
|
- device_id: 9041a8cd641d55436de6b8645b20e3c8
|
||||||
|
domain: zha
|
||||||
|
type: remote_button_double_press
|
||||||
|
subtype: button_2
|
||||||
|
trigger: device
|
||||||
|
id: second_btn_double
|
||||||
|
conditions: []
|
||||||
|
actions:
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- first_btn
|
||||||
|
sequence:
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: light.cell_light
|
||||||
|
state: 'off'
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 2000
|
||||||
|
brightness_pct: 70
|
||||||
|
target:
|
||||||
|
entity_id: light.cell_light
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: light.cell_light
|
||||||
|
state: 'on'
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_off
|
||||||
|
target:
|
||||||
|
entity_id:
|
||||||
|
- light.cell_light
|
||||||
|
data: {}
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- second_btn
|
||||||
|
sequence:
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: light.table_lights_bed_lights
|
||||||
|
state: 'off'
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 2000
|
||||||
|
brightness_pct: 50
|
||||||
|
target:
|
||||||
|
entity_id: light.table_lights_bed_lights
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: light.table_lights_bed_lights
|
||||||
|
state: 'on'
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_off
|
||||||
|
metadata: {}
|
||||||
|
data: {}
|
||||||
|
target:
|
||||||
|
entity_id: light.table_lights_bed_lights
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- first_btn_double
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 3000
|
||||||
|
brightness_pct: 100
|
||||||
|
target:
|
||||||
|
entity_id: light.cell_light
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- second_btn_double
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 2000
|
||||||
|
brightness_pct: 75
|
||||||
|
target:
|
||||||
|
entity_id: light.table_lights_bed_lights
|
||||||
|
mode: single
|
||||||
|
|
||||||
|
- id: '1750278561179'
|
||||||
|
alias: Living room lights - switch control
|
||||||
|
description: ''
|
||||||
|
triggers:
|
||||||
|
- device_id: 5da7507dbe1988ee34fbdd3ade9d7645
|
||||||
|
domain: zha
|
||||||
|
type: remote_button_short_press
|
||||||
|
subtype: turn_on
|
||||||
|
trigger: device
|
||||||
|
id: 'on'
|
||||||
|
- device_id: 5da7507dbe1988ee34fbdd3ade9d7645
|
||||||
|
domain: zha
|
||||||
|
type: remote_button_short_press
|
||||||
|
subtype: turn_off
|
||||||
|
trigger: device
|
||||||
|
id: 'off'
|
||||||
|
- device_id: 5da7507dbe1988ee34fbdd3ade9d7645
|
||||||
|
domain: zha
|
||||||
|
type: remote_button_short_press
|
||||||
|
subtype: left
|
||||||
|
trigger: device
|
||||||
|
id: left
|
||||||
|
- device_id: 5da7507dbe1988ee34fbdd3ade9d7645
|
||||||
|
domain: zha
|
||||||
|
type: remote_button_short_press
|
||||||
|
subtype: right
|
||||||
|
trigger: device
|
||||||
|
id: right
|
||||||
|
- device_id: c22d300c7e66e004dfa848be57affe86
|
||||||
|
domain: zha
|
||||||
|
type: remote_button_short_press
|
||||||
|
subtype: turn_on
|
||||||
|
trigger: device
|
||||||
|
id: 'on'
|
||||||
|
- device_id: c22d300c7e66e004dfa848be57affe86
|
||||||
|
domain: zha
|
||||||
|
type: remote_button_short_press
|
||||||
|
subtype: turn_off
|
||||||
|
trigger: device
|
||||||
|
id: 'off'
|
||||||
|
- device_id: c22d300c7e66e004dfa848be57affe86
|
||||||
|
domain: zha
|
||||||
|
type: remote_button_short_press
|
||||||
|
subtype: left
|
||||||
|
trigger: device
|
||||||
|
id: left
|
||||||
|
- device_id: c22d300c7e66e004dfa848be57affe86
|
||||||
|
domain: zha
|
||||||
|
type: remote_button_short_press
|
||||||
|
subtype: right
|
||||||
|
trigger: device
|
||||||
|
id: right
|
||||||
|
conditions: []
|
||||||
|
actions:
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- 'on'
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
metadata: {}
|
||||||
|
data: {}
|
||||||
|
target:
|
||||||
|
area_id: living_room
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- 'off'
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_off
|
||||||
|
metadata: {}
|
||||||
|
data: {}
|
||||||
|
target:
|
||||||
|
area_id: living_room
|
||||||
|
- conditions:
|
||||||
|
- condition: and
|
||||||
|
conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- left
|
||||||
|
- right
|
||||||
|
- condition: state
|
||||||
|
entity_id: light.zbt_1_table_light
|
||||||
|
state: 'on'
|
||||||
|
sequence:
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- left
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 2000
|
||||||
|
brightness_pct: 70
|
||||||
|
target:
|
||||||
|
area_id: living_room
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- right
|
||||||
|
sequence:
|
||||||
|
- action: light.turn_on
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
color_temp_kelvin: 3000
|
||||||
|
brightness_pct: 100
|
||||||
|
target:
|
||||||
|
area_id: living_room
|
||||||
|
- action: input_boolean.turn_off
|
||||||
|
metadata: {}
|
||||||
|
data: {}
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.motion_light_automation_active
|
||||||
|
mode: single
|
||||||
25
config/homeassistant/configuration.yaml
Normal file
25
config/homeassistant/configuration.yaml
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Home Assistant Main Configuration
|
||||||
|
# This configuration is used by the Home Assistant container
|
||||||
|
# Documentation: https://www.home-assistant.io/docs/configuration/
|
||||||
|
|
||||||
|
# HTTP configuration for reverse proxy (Traefik)
|
||||||
|
http:
|
||||||
|
# Enable X-Forwarded-For header support for reverse proxy
|
||||||
|
use_x_forwarded_for: true
|
||||||
|
# Trust these proxies to set the X-Forwarded-For header
|
||||||
|
trusted_proxies:
|
||||||
|
- 127.0.0.1 # Local Traefik proxy
|
||||||
|
- ::1 # IPv6 localhost
|
||||||
|
|
||||||
|
# Loads default set of integrations. Do not remove.
|
||||||
|
# This includes: sun, mobile_app, met, radio_browser, etc.
|
||||||
|
default_config:
|
||||||
|
|
||||||
|
# Load frontend themes from the themes folder
|
||||||
|
frontend:
|
||||||
|
themes: !include_dir_merge_named themes
|
||||||
|
|
||||||
|
# External configuration files
|
||||||
|
automation: !include automations.yaml
|
||||||
|
script: !include scripts.yaml
|
||||||
|
scene: !include scenes.yaml
|
||||||
12
config/homeassistant/scenes.yaml
Normal file
12
config/homeassistant/scenes.yaml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# Home Assistant Scenes
|
||||||
|
# This file contains scene definitions for the smart home
|
||||||
|
# Documentation: https://www.home-assistant.io/integrations/scene/
|
||||||
|
|
||||||
|
# Scenes will be added here as needed
|
||||||
|
# Example:
|
||||||
|
# - name: "Evening Reading"
|
||||||
|
# entities:
|
||||||
|
# light.bedroom_lamp:
|
||||||
|
# state: on
|
||||||
|
# brightness: 80
|
||||||
|
# color_temp: 2700
|
||||||
15
config/homeassistant/scripts.yaml
Normal file
15
config/homeassistant/scripts.yaml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Home Assistant Scripts
|
||||||
|
# This file contains script definitions for the smart home
|
||||||
|
# Documentation: https://www.home-assistant.io/integrations/script/
|
||||||
|
|
||||||
|
# Scripts will be added here as needed
|
||||||
|
# Example:
|
||||||
|
# bedtime:
|
||||||
|
# alias: "Bedtime Routine"
|
||||||
|
# sequence:
|
||||||
|
# - action: light.turn_off
|
||||||
|
# target:
|
||||||
|
# entity_id: all
|
||||||
|
# - action: switch.turn_off
|
||||||
|
# target:
|
||||||
|
# entity_id: switch.living_room_tv
|
||||||
|
|
@ -33,6 +33,11 @@ in
|
||||||
"/var/lib/containers/home/config:/config"
|
"/var/lib/containers/home/config:/config"
|
||||||
"/etc/localtime:/etc/localtime:ro"
|
"/etc/localtime:/etc/localtime:ro"
|
||||||
"/run/dbus:/run/dbus:ro"
|
"/run/dbus:/run/dbus:ro"
|
||||||
|
# Mount declarative configuration files
|
||||||
|
"/home/yanlin/.config/nix/config/homeassistant/configuration.yaml:/config/configuration.yaml:ro"
|
||||||
|
"/home/yanlin/.config/nix/config/homeassistant/automations.yaml:/config/automations.yaml:ro"
|
||||||
|
"/home/yanlin/.config/nix/config/homeassistant/scenes.yaml:/config/scenes.yaml:ro"
|
||||||
|
"/home/yanlin/.config/nix/config/homeassistant/scripts.yaml:/config/scripts.yaml:ro"
|
||||||
];
|
];
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue