Skip to main content

Перенастройка HomeAssistant с ChatGPT

Configuration.yaml

# ===============================
# Home Assistant — базовые настройки
# ===============================

homeassistant:
  name: Home Assistant
  latitude: !secret latitude_coord
  longitude: !secret longitude_coord
  elevation: 86
  unit_system: metric
  time_zone: Europe/Samara
  country: RU
  customize: !include customize.yaml
  packages: !include_dir_named packages


# ===============================
# Базовая функциональность
# ===============================

default_config:

logger:
  default: warning


# ===============================
# Сервисы
# ===============================

wake_on_lan:

tts:
  - platform: google_translate


# ===============================
# Хранилище и БД
# ===============================

recorder: !include includes/recorder.yaml
sql: !include includes/sql.yaml


# ===============================
# YAML-логика
# ===============================

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

sensor: !include_dir_merge_list includes/sensor
switch: !include_dir_merge_list includes/switch


# ===============================
# HTTP / Reverse Proxy
# ===============================

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 192.168.1.200


# ===============================
# Frontend
# ===============================

fontawesome:

frontend:
  extra_module_url:
    - /hacsfiles/lovelace-card-mod/card-mod.js
    - /hacsfiles/ha-yandex-icons/yandex-icons.js
  themes: !include_dir_merge_named themes


# ===============================
# Интеграции
# ===============================

narodmon:
  devices:
    - name: "Narodmon"
      scan_interval: "01:00"
      sensors:
        - temperature
        - humidity
        - pressure
  timeout: 120


# ===============================
# Панели (устаревшее, но оставляем)
# ===============================

panel_custom:
  - name: ha_integ
    sidebar_title: "Устройства и службы"
    sidebar_icon: mdi:devices
    js_url: /api/hassio/app/entrypoint.js
    url_path: "config/integrations"
    embed_iframe: true
    require_admin: true

  - name: ha_auto
    sidebar_title: "Автоматизации и сцены"
    sidebar_icon: mdi:robot
    js_url: /api/hassio/app/entrypoint.js
    url_path: "config/automation"
    embed_iframe: true
    require_admin: true

Пакет koridor.yaml

# --------------------------
# Коридор — пакет управления светом
# --------------------------

# Таймер авто-выключения
timer:
  koridor_auto_off:
    duration: '03:00:00'

# Автоматизации управления светом
automation:

  # Одинарное нажатие Switch_Coridor (левая клавиша)
  - alias: Коридор — Switch_Coridor одинарное
    mode: restart
    trigger:
      - platform: state
        entity_id: sensor.switch_coridor_action
        to: single_left
    action:
      - choose:
          # Если свет включен → выключаем + сброс таймера
          - conditions:
              - condition: state
                entity_id: light.koridor_osnovnoi
                state: 'on'
            sequence:
              - service: light.turn_off
                target:
                  entity_id: light.koridor_osnovnoi
              - service: timer.cancel
                target:
                  entity_id: timer.koridor_auto_off
          # Если свет выключен → включаем с умной яркостью + старт таймера
          - conditions:
              - condition: state
                entity_id: light.koridor_osnovnoi
                state: 'off'
            sequence:
              - choose:
                  - conditions:
                      - condition: sun
                        after: sunset
                      - condition: time
                        after: '23:00:00'
                    sequence:
                      - service: light.turn_on
                        target:
                          entity_id: light.koridor_osnovnoi
                        data:
                          brightness_pct: 50
                  - conditions: []
                    sequence:
                      - service: light.turn_on
                        target:
                          entity_id: light.koridor_osnovnoi
                        data:
                          brightness_pct: 100
              - service: timer.start
                target:
                  entity_id: timer.koridor_auto_off

  # Двойное нажатие Switch_Coridor
  - alias: Коридор — Switch_Coridor двойное
    mode: single
    trigger:
      - platform: state
        entity_id: sensor.switch_coridor_action
        to: double_left
    action:
      - service: light.turn_on
        target:
          entity_id: light.koridor_osnovnoi
        data:
          brightness_pct: 100
      - service: timer.start
        target:
          entity_id: timer.koridor_auto_off

  # Одинарное нажатие Switch_Kitchen (правая клавиша)
  - alias: Коридор — Switch_Kitchen одинарное
    mode: restart
    trigger:
      - platform: state
        entity_id: sensor.switch_kitchen_action
        to: single_right
    action:
      - choose:
          # Если свет включен → выключаем + сброс таймера
          - conditions:
              - condition: state
                entity_id: light.koridor_osnovnoi
                state: 'on'
            sequence:
              - service: light.turn_off
                target:
                  entity_id: light.koridor_osnovnoi
              - service: timer.cancel
                target:
                  entity_id: timer.koridor_auto_off
          # Если свет выключен → включаем с умной яркостью + старт таймера
          - conditions:
              - condition: state
                entity_id: light.koridor_osnovnoi
                state: 'off'
            sequence:
              - choose:
                  - conditions:
                      - condition: sun
                        after: sunset
                      - condition: time
                        after: '23:00:00'
                    sequence:
                      - service: light.turn_on
                        target:
                          entity_id: light.koridor_osnovnoi
                        data:
                          brightness_pct: 50
                  - conditions: []
                    sequence:
                      - service: light.turn_on
                        target:
                          entity_id: light.koridor_osnovnoi
                        data:
                          brightness_pct: 100
              - service: timer.start
                target:
                  entity_id: timer.koridor_auto_off

  # Двойное нажатие Switch_Kitchen
  - alias: Коридор — Switch_Kitchen двойное
    mode: single
    trigger:
      - platform: state
        entity_id: sensor.switch_kitchen_action
        to: double_right
    action:
      - service: light.turn_on
        target:
          entity_id: light.koridor_osnovnoi
        data:
          brightness_pct: 100
      - service: timer.start
        target:
          entity_id: timer.koridor_auto_off

  # Оба нажатия на любом выключателе → выключить всё
  - alias: Коридор — Обе клавиши выключить все
    mode: single
    trigger:
      - platform: state
        entity_id: sensor.switch_coridor_action
        to: single_both
      - platform: state
        entity_id: sensor.switch_coridor_action
        to: double_both
      - platform: state
        entity_id: sensor.switch_kitchen_action
        to: single_both
      - platform: state
        entity_id: sensor.switch_kitchen_action
        to: double_both
    action:
      - service: light.turn_off
        target:
          entity_id: 
            - light.koridor_osnovnoi
            # Добавьте другие светильники по необходимости
      - service: timer.cancel
        target:
          entity_id: timer.koridor_auto_off

  # Таймер сбрасывается при ручном выключении света
  - alias: Коридор — Сброс таймера при выключении света
    mode: single
    trigger:
      - platform: state
        entity_id: light.koridor_osnovnoi
        to: 'off'
    action:
      - service: timer.cancel
        target:
          entity_id: timer.koridor_auto_off

  # Авто-выключение по окончании таймера
  - alias: Коридор — Авто-выключение по таймеру
    mode: single
    trigger:
      - platform: event
        event_type: timer.finished
        event_data:
          entity_id: timer.koridor_auto_off
    action:
      - service: light.turn_off
        target:
          entity_id: light.koridor_osnovnoi

# --------------------------
# Сцены
# --------------------------
scene:
  - name: Koridor On
    entities:
      light.koridor_osnovnoi: 
        state: on
        brightness_pct: 100
  - name: Koridor Off
    entities:
      light.koridor_osnovnoi: 
        state: off