Home Assistant.md 2.0 KB


title: Home Assistant date: 2026-02-15T19:23:05+08:00

lastmod: 2026-02-15T19:36:01+08:00

Home Assistant

  一、Home Assistant 插件商店

  设置→加载项→File editer

  设置→加载项→Terminal

  文件目录/homeassistant/configuration.yaml

  配置模板:

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

# Custom Panels
panel_custom:
  - name: Supervisor
    url_path: hassio/system # url_path needs to be unique for each panel_custom config
    sidebar_title: Supervisor
    sidebar_icon: mdi:home-assistant # https://materialdesignicons.com/
    module_url: /local/panel-redirect.js # 'local' is '/config/www/'

command_line:
  - switch:
      name: "家庭服务器"
      unique_id: pve_server_power
      command_on: "wakeonlan 04:7c:16:57:db:47"
      command_off: "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /config/ssh/id_rsa root@10.10.10.50 'systemctl poweroff'"   #linux关机配置
      command_state: "ping -c 1 -W 1 10.10.10.50 > /dev/null 2>&1 && echo 0 || echo 1"
      value_template: "{{ value == '0' }}"
      icon: "mdi:server"
      scan_interval: 10
  - switch:
      name: "书房电脑"
      unique_id: windows_game_server_power
      command_on: "wakeonlan 6c:1f:f7:b8:a6:35"  # 请替换为你的Windows游戏服务器的MAC地址
      command_off: "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /config/ssh/id_rsa zhens@10.10.10.19 'shutdown /s /f /t 0'"  # 请替换为正确的IP和用户名,提前把HA服务器的密钥发送给宿主机的
      command_state: "ping -c 1 -W 1 10.10.10.19 > /dev/null 2>&1 && echo 0 || echo 1"  # 检查服务器是否在线
      value_template: "{{ value == '0' }}"
      icon: "mdi:gamepad"
      scan_interval: 10

  ‍