Home Assistant Study - sunbang123/Graduation_Project GitHub Wiki

ESPHome

(์ •๋ณด๋ฅผ ํ™•์ธํ•˜๋ ค๋ฉด ํด๋ฆญํ•˜์„ธ์š”!)

ESPHome ํ†ตํ•ฉ ๊ตฌ์„ฑ ๊ฐ€์ด๋“œ

๊ฐœ์š”

ESPHome ํ†ตํ•ฉ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ฉด ESPHome ๊ธฐ๊ธฐ๋ฅผ ๋„ค์ดํ‹ฐ๋ธŒ ESPHome API๋ฅผ ํ†ตํ•ด Home Assistant์— ์ง์ ‘ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๋ฌธ์„œ๋Š” ESPHome ๊ธฐ๊ธฐ๋ฅผ Home Assistant์— ์„ค์ •ํ•˜๊ณ  ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•ˆ๋‚ดํ•ฉ๋‹ˆ๋‹ค.

์„ค์ • ๋ฐฉ๋ฒ•

์ž๋™ ๊ฒ€์ƒ‰ ๋ฐฉ์‹

  1. Home Assistant๊ฐ€ ์ž๋™์œผ๋กœ ESPHome ๊ธฐ๊ธฐ๋ฅผ ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  2. ๊ธฐ๊ธฐ๊ฐ€ ๋ฐœ๊ฒฌ๋˜๋ฉด "Discovered"๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.
  3. ์ฆ‰์‹œ ์„ค์ •์„ ์ง„ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ˆ˜๋™ ์„ค์ • ๋ฐฉ์‹

์ž๋™์œผ๋กœ ๊ฒ€์ƒ‰๋˜์ง€ ์•Š์„ ๊ฒฝ์šฐ, ๋‹ค์Œ ๋‹จ๊ณ„๋ฅผ ๋”ฐ๋ผ ์ˆ˜๋™์œผ๋กœ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

  1. Home Assistant ์ธ์Šคํ„ด์Šค์— ์ ‘์†ํ•ฉ๋‹ˆ๋‹ค.
  2. Settings(์„ค์ •) > Devices & Services(๊ธฐ๊ธฐ ๋ฐ ์„œ๋น„์Šค)๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
  3. ์šฐ์ธก ํ•˜๋‹จ์˜ "Add Integration"(ํ†ตํ•ฉ ์ถ”๊ฐ€) ๋ฒ„ํŠผ์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.
  4. ๋ชฉ๋ก์—์„œ "ESPHome"์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.
  5. ํ™”๋ฉด์˜ ์ง€์‹œ์‚ฌํ•ญ์— ๋”ฐ๋ผ ์„ค์ •์„ ์™„๋ฃŒํ•ฉ๋‹ˆ๋‹ค.

Home Assistant ์ž‘์—…

  • ESPHome ๊ธฐ๊ธฐ๋Š” ๋ชจ๋“  Home Assistant ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์ด ๊ธฐ๋Šฅ์€ ์ƒˆ๋กœ ๊ตฌ์„ฑ๋œ ๊ธฐ๊ธฐ์—์„œ ๊ธฐ๋ณธ์ ์œผ๋กœ ๋น„ํ™œ์„ฑํ™”๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๊ฐ ๊ธฐ๊ธฐ๋ณ„๋กœ ์˜ต์…˜ ์„ค์ •์„ ํ†ตํ•ด ํ™œ์„ฑํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์˜ต์…˜ ์„ค์ • ๋ฐฉ๋ฒ•

  1. Home Assistant ์ธ์Šคํ„ด์Šค์— ์ ‘์†ํ•ฉ๋‹ˆ๋‹ค.
  2. Settings > Devices & Services๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
  3. ์—ฌ๋Ÿฌ ESPHome ์ธ์Šคํ„ด์Šค๊ฐ€ ๊ตฌ์„ฑ๋œ ๊ฒฝ์šฐ ์„ค์ •ํ•˜๋ ค๋Š” ์ธ์Šคํ„ด์Šค๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.
  4. ํ†ตํ•ฉ์„ ์„ ํƒํ•œ ํ›„ "Configure"๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

์—”ํ‹ฐํ‹ฐ ์ด๋ฆ„ ์ง€์ • ๋ฐ ID

๊ถŒ์žฅ ์ด๋ฆ„ ์ง€์ • ๋ฐฉ์‹

  • ESPHome configuration.yaml์—์„œ friendly_name์„ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค.
  • ์—”ํ‹ฐํ‹ฐ ์ด๋ฆ„์€ ์นœ์ˆ™ํ•œ ์ด๋ฆ„๊ณผ ๊ตฌ์„ฑ์š”์†Œ ์ด๋ฆ„์˜ ์กฐํ•ฉ์ž…๋‹ˆ๋‹ค.
  • ์—”ํ‹ฐํ‹ฐ ID๋Š” ๊ธฐ๊ธฐ ์ด๋ฆ„์ด ์•ž์— ์ถ”๊ฐ€๋œ ์—”ํ‹ฐํ‹ฐ ์ด๋ฆ„์—์„œ ํŒŒ์ƒ๋ฉ๋‹ˆ๋‹ค.

์˜ˆ์‹œ ๊ตฌ์„ฑ:

esphome:
   name: "livingroomdesk"
   friendly_name: "Living room desk"

sensor:
   name: "Temperature"

๊ฒฐ๊ณผ:

  • ์—”ํ‹ฐํ‹ฐ ์ด๋ฆ„: "Living room desk Temperature"
  • ์—”ํ‹ฐํ‹ฐ ID: "sensor.livingroomdesk_temperature"

๋ ˆ๊ฑฐ์‹œ ์ด๋ฆ„ ์ง€์ • ๋ฐฉ์‹

friendly_name์ด ์„ค์ •๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ ์šฉ๋˜๋Š” ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค:

  • ์—”ํ‹ฐํ‹ฐ ์ด๋ฆ„์€ ๊ตฌ์„ฑ์š”์†Œ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.
  • ๊ธฐ๊ธฐ ์ด๋ฆ„์€ ์—”ํ‹ฐํ‹ฐ ์ด๋ฆ„์— ์ถ”๊ฐ€๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
  • ์—”ํ‹ฐํ‹ฐ ID๋Š” ์—”ํ‹ฐํ‹ฐ ์ด๋ฆ„์—์„œ๋งŒ ํŒŒ์ƒ๋ฉ๋‹ˆ๋‹ค.

์˜ˆ์‹œ ๊ตฌ์„ฑ:

esphome:
   name: "livingroomdesk"

sensor:
   name: "Temperature"

๊ฒฐ๊ณผ:

  • ์—”ํ‹ฐํ‹ฐ ์ด๋ฆ„: "Temperature"
  • ์—”ํ‹ฐํ‹ฐ ID: "sensor.temperature"

๊ธฐ์ˆ  ์ •๋ณด

  • Home Assistant 0.85 ๋ฒ„์ „๋ถ€ํ„ฐ ๋„์ž…๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
  • ํ™œ์„ฑ ์„ค์น˜์˜ 24.5%์—์„œ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
  • IoT ํด๋ž˜์Šค: Local Push
  • ํ’ˆ์งˆ ๋“ฑ๊ธ‰: Platinum
  • ๋กœ์ปฌ ๋„คํŠธ์›Œํฌ๋ฅผ ํ†ตํ•ด Home Assistant์™€ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

์ฐธ๊ณ  ์‚ฌํ•ญ

  • ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ๊ฒฝ์šฐ GitHub์—์„œ ์ด์Šˆ๋ฅผ ํ™•์ธํ•˜๊ฑฐ๋‚˜ ๋ณด๊ณ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์ž์„ธํ•œ ๊ธฐ์ˆ  ๋ฌธ์„œ๋Š” ESPHome ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์‹ญ์‹œ์˜ค.

MQTT

(์ •๋ณด๋ฅผ ํ™•์ธํ•˜๋ ค๋ฉด ํด๋ฆญํ•˜์„ธ์š”!)

MQTT ํ†ตํ•ฉ ๊ตฌ์„ฑ ๊ฐ€์ด๋“œ

๊ฐœ์š”

MQTT(Message Queuing Telemetry Transport)๋Š” TCP/IP ๊ธฐ๋ฐ˜์˜ ๊ฒฝ๋Ÿ‰ ๋ฉ”์‹œ์ง• ํ”„๋กœํ† ์ฝœ๋กœ, IoT ๊ธฐ๊ธฐ๋“ค ๊ฐ„์˜ ํ†ต์‹ ์— ๋„๋ฆฌ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. Home Assistant์™€์˜ ํ†ตํ•ฉ์„ ํ†ตํ•ด ๋‹ค์–‘ํ•œ IoT ๊ธฐ๊ธฐ๋“ค์„ ํšจ๊ณผ์ ์œผ๋กœ ์ œ์–ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ธฐ๋ณธ ์„ค์ •

๋ธŒ๋กœ์ปค ์„ค์ • ๋ฐฉ๋ฒ•

  1. ์ž๋™ ์„ค์ • (๊ถŒ์žฅ)

    • Mosquitto Broker ์• ๋“œ์˜จ ์„ค์น˜
    • MQTT ํ†ตํ•ฉ ๊ตฌ์„ฑ ์‹œ ์ž๋™์œผ๋กœ ์•ˆ์ „ํ•œ ์‚ฌ์šฉ์ž๋ช…๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ƒ์„ฑ
    • ์ถ”๊ฐ€ ๋กœ๊ทธ์ธ์€ Mosquitto ์• ๋“œ์˜จ ์„ค์ •์—์„œ ๊ตฌ์„ฑ ๊ฐ€๋Šฅ
  2. ์ˆ˜๋™ ์„ค์ •

    • Settings > Devices & Services ์ด๋™
    • Add Integration ๋ฒ„ํŠผ ํด๋ฆญ
    • MQTT ์„ ํƒ
    • ํ™”๋ฉด์˜ ์ง€์‹œ์— ๋”ฐ๋ผ ์„ค์ • ์™„๋ฃŒ

๋ธŒ๋กœ์ปค ๊ณ ๊ธ‰ ์„ค์ •

๊ณ ๊ธ‰ ์„ค์ •์— ์ ‘๊ทผํ•˜๋ ค๋ฉด:

  1. Settings > Devices & Services๋กœ ์ด๋™
  2. MQTT ํ†ตํ•ฉ ์„ ํƒ
  3. Configure ์„ ํƒ ํ›„ Re-configure MQTT ์„ ํƒ
  4. Advanced options ํ™œ์„ฑํ™”

์ฃผ์š” ๊ณ ๊ธ‰ ์„ค์ • ์˜ต์…˜:

  • ์ปค์Šคํ…€ ํด๋ผ์ด์–ธํŠธ ID ์„ค์ •
  • ํด๋ผ์ด์–ธํŠธ ์ธ์ฆ์„œ ์„ค์ •
  • ๋ธŒ๋กœ์ปค ์ธ์ฆ์„œ ๊ฒ€์ฆ
  • MQTT ํ”„๋กœํ† ์ฝœ ๋ฒ„์ „ ์„ ํƒ (3.1.1 ๋˜๋Š” 5)
  • WebSocket ์ „์†ก ์„ค์ •

MQTT Discovery (์ž๋™ ๊ฒ€์ƒ‰)

๊ฐœ์š”

  • ๊ธฐ๋ณธ์ ์œผ๋กœ ํ™œ์„ฑํ™”๋˜์–ด ์žˆ์Œ
  • ์ตœ์†Œํ•œ์˜ ์„ค์ •์œผ๋กœ MQTT ๊ธฐ๊ธฐ ์‚ฌ์šฉ ๊ฐ€๋Šฅ
  • ๊ฒ€์ƒ‰ ํ† ํ”ฝ ํ˜•์‹: <discovery_prefix>/<component>/[<node_id>/]<object_id>/config

Discovery ๋ฉ”์‹œ์ง€ ๊ตฌ์„ฑ

{
  "dev": {
    "ids": "๊ณ ์œ ID",
    "name": "๊ธฐ๊ธฐ์ด๋ฆ„",
    "mf": "์ œ์กฐ์‚ฌ",
    "mdl": "๋ชจ๋ธ๋ช…",
    "sw": "์†Œํ”„ํŠธ์›จ์–ด๋ฒ„์ „"
  },
  "o": {
    "name": "์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด๋ฆ„",
    "sw": "์†Œํ”„ํŠธ์›จ์–ด๋ฒ„์ „",
    "url": "์ง€์›URL"
  },
  "state_topic": "์ƒํƒœํ† ํ”ฝ",
  "command_topic": "๋ช…๋ นํ† ํ”ฝ",
  "unique_id": "์—”ํ‹ฐํ‹ฐ๊ณ ์œ ID"
}

์ˆ˜๋™ YAML ๊ตฌ์„ฑ

YAML์—์„œ ๋‘ ๊ฐ€์ง€ ์Šคํƒ€์ผ๋กœ ๊ตฌ์„ฑ ๊ฐ€๋Šฅ:

  1. ํ•ญ๋ชฉ๋ณ„ ๋‚˜์—ด ๋ฐฉ์‹
mqtt:
  - binary_sensor:
      name: "์„ผ์„œ1"
      state_topic: "home/sensor1"
  - switch:
      name: "์Šค์œ„์น˜1"
      command_topic: "home/switch1"
  1. ๋„๋ฉ”์ธ๋ณ„ ๊ทธ๋ฃนํ™” ๋ฐฉ์‹
mqtt:
  binary_sensor:
    - name: "์„ผ์„œ1"
      state_topic: "home/sensor1"
    - name: "์„ผ์„œ2"
      state_topic: "home/sensor2"

์ž์ฃผ ์‚ฌ์šฉ๋˜๋Š” ์˜ˆ์ œ

1. ๋ชจ์…˜ ์„ผ์„œ ์„ค์ •

{
   "name": null,
   "device_class": "motion",
   "state_topic": "homeassistant/binary_sensor/garden/state",
   "unique_id": "motion01ad",
   "device": {
      "identifiers": ["01ad"],
      "name": "์ •์›"
   }
}

2. ์˜จ์Šต๋„ ์„ผ์„œ ์„ค์ •

{
   "device_class": "temperature",
   "state_topic": "homeassistant/sensor/bedroom/state",
   "unit_of_measurement": "ยฐC",
   "value_template": "{{ value_json.temperature}}",
   "unique_id": "temp01ae",
   "device": {
      "identifiers": ["bedroom01ae"],
      "name": "์นจ์‹ค"
   }
}

์ž๋™ํ™” ์˜ˆ์ œ

automation:
  alias: "๋„์ฐฉ ์‹œ ๋ฉ”์‹œ์ง€ ์ „์†ก"
  triggers:
    - trigger: state
      entity_id: device_tracker.me
      to: "home"
  actions:
    - action: mqtt.publish
      data:
        topic: "home/notification"
        payload: "์ง‘์— ๋„์ฐฉํ–ˆ์Šต๋‹ˆ๋‹ค"
        retain: true

๋ฌธ์ œ ํ•ด๊ฒฐ

๋กœ๊น… ์„ค์ •

logger:
  default: warning
  logs:
    homeassistant.components.mqtt: debug

์ฃผ์˜์‚ฌํ•ญ

  1. ๋ธŒ๋กœ์ปค ์žฌ์„ค์น˜ ์‹œ ๋ฐ˜๋“œ์‹œ ์ถ”๊ฐ€ ๋กœ๊ทธ์ธ ์ •๋ณด ๋ฐฑ์—…
  2. ์ž๋™ ๊ฒ€์ƒ‰ ์‚ฌ์šฉ ์‹œ ๊ณ ์œ  ID ์„ค์ • ๊ถŒ์žฅ
  3. ์ƒํƒœ ํ† ํ”ฝ์—๋Š” ๊ฐ€๋Šฅํ•œ retain ํ”Œ๋ž˜๊ทธ ์‚ฌ์šฉ
  4. ๋ณด์•ˆ์„ ์œ„ํ•ด ํ•ญ์ƒ ์‚ฌ์šฉ์ž ์ธ์ฆ ์„ค์ •

์ง€์›๋˜๋Š” ์„œ๋“œํŒŒํ‹ฐ ๋„๊ตฌ

  • ESPHome
  • Zigbee2MQTT
  • Tasmota
  • OpenMQTTGateway
  • ๊ธฐํƒ€ ๋‹ค์ˆ˜์˜ ํ†ตํ•ฉ ๋„๊ตฌ ์ง€์›

Home Assistant Configuration.yaml

(์ •๋ณด๋ฅผ ํ™•์ธํ•˜๋ ค๋ฉด ํด๋ฆญํ•˜์„ธ์š”!)

Home Assistant Configuration.yaml ์„ค์ • ๊ฐ€์ด๋“œ

๊ฐœ์š”

Configuration.yaml์€ Home Assistant์˜ ํ•ต์‹ฌ ์„ค์ • ํŒŒ์ผ์ž…๋‹ˆ๋‹ค. ๋Œ€๋ถ€๋ถ„์˜ ์„ค์ •์€ UI๋ฅผ ํ†ตํ•ด ๊ฐ€๋Šฅํ•˜์ง€๋งŒ, ์ผ๋ถ€ ํ†ตํ•ฉ ๊ธฐ๋Šฅ์€ ์ด ํŒŒ์ผ์„ ์ง์ ‘ ํŽธ์ง‘ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

ํŒŒ์ผ ์ ‘๊ทผ ๋ฐ ํŽธ์ง‘ ๋ฐฉ๋ฒ•

์„ค์น˜ ๋ฐฉ์‹๋ณ„ ํŒŒ์ผ ์ ‘๊ทผ ๋ฐฉ๋ฒ•

  1. Home Assistant Operating System ์‚ฌ์šฉ์ž

    • File editor ์• ๋“œ์˜จ ์„ค์น˜ (์ดˆ๋ณด์ž ์ถ”์ฒœ)
    • Studio Code Server ์• ๋“œ์˜จ ์„ค์น˜ (๊ณ ๊ธ‰ ๊ธฐ๋Šฅ ํ•„์š” ์‹œ)
    • Samba ์• ๋“œ์˜จ ์„ค์น˜ (๋กœ์ปฌ ํŽธ์ง‘๊ธฐ ์‚ฌ์šฉ ์‹œ)
  2. Home Assistant Supervised ์‚ฌ์šฉ์ž

    • File editor ์• ๋“œ์˜จ
    • Studio Code Server ์• ๋“œ์˜จ
    • Samba ์• ๋“œ์˜จ
  3. Home Assistant Container/Core ์‚ฌ์šฉ์ž

    • ์ง์ ‘ ํŒŒ์ผ์‹œ์Šคํ…œ ์ ‘๊ทผ

์„ค์ • ๋””๋ ‰ํ† ๋ฆฌ ์œ„์น˜

์„ค์น˜ ๋ฐฉ์‹๋ณ„ ๊ธฐ๋ณธ ์œ„์น˜:

  • Operating System: /config ํด๋”
  • Container: ๋งˆ์šดํŠธ๋œ config ํด๋”
  • Core: ~/.homeassistant (๊ธฐ๋ณธ๊ฐ’)

์„ค์ • ๋””๋ ‰ํ† ๋ฆฌ ํ™•์ธ ๋ฐฉ๋ฒ•:

  1. Settings > System > Repairs ์ด๋™
  2. ์šฐ์ธก ์ƒ๋‹จ ๋ฉ”๋‰ด(์  3๊ฐœ) > System information ์„ ํƒ
  3. Configuration directory ํ•ญ๋ชฉ ํ™•์ธ

์„ค์ • ํŒŒ์ผ ๊ฒ€์ฆ

์„ค์ • ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ ๋ฐฉ๋ฒ•

  • ์„ค์ • ๋ณ€๊ฒฝ ํ›„ ์ž๋™์œผ๋กœ ๊ฒ€์‚ฌ๋จ
  • Home Assistant ์žฌ์‹œ์ž‘ ์‹œ ์ž๋™ ๊ฒ€์‚ฌ
  • ์ˆ˜๋™ ๊ฒ€์‚ฌ ๊ฐ€๋Šฅ (์„ค์น˜ ์œ ํ˜•๋ณ„ ๋ฐฉ๋ฒ• ์ƒ์ด)

์„ค์น˜ ์œ ํ˜•๋ณ„ ๊ฒ€์‚ฌ ๋ฐฉ๋ฒ•

  1. Operating System: ์‹œ์Šคํ…œ ํŒจ๋„์—์„œ ๊ฒ€์‚ฌ
  2. Supervised: ๊ด€๋ฆฌ์ž ํŒจ๋„์—์„œ ๊ฒ€์‚ฌ
  3. Container: Docker ๋ช…๋ น์–ด๋กœ ๊ฒ€์‚ฌ
  4. Core: ์ปค๋งจ๋“œ๋ผ์ธ์—์„œ ๊ฒ€์‚ฌ

์„ค์ • ์ ์šฉํ•˜๊ธฐ

์„ค์ • ๋ฆฌ๋กœ๋“œ

  1. Settings ๋ฉ”๋‰ด๋กœ ์ด๋™
  2. ์šฐ์ธก ์ƒ๋‹จ ๋ฉ”๋‰ด(์  3๊ฐœ) ์„ ํƒ
  3. Restart Home Assistant > Quick reload ์„ ํƒ

์ „์ฒด ์žฌ์‹œ์ž‘

์„ค์ •์ด ์ ์šฉ๋˜์ง€ ์•Š์„ ๊ฒฝ์šฐ:

  1. Settings ๋ฉ”๋‰ด๋กœ ์ด๋™
  2. Restart Home Assistant ์„ ํƒ
    • ์ฃผ์˜: ์ž๋™ํ™”์™€ ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ์ค‘๋‹จ๋จ

๋ฌธ์ œ ํ•ด๊ฒฐ ํŒ

์ผ๋ฐ˜์ ์ธ ๋ฌธ์ œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

  1. ๊ตฌ๋ฌธ ์˜ค๋ฅ˜ ํ™•์ธ
  2. ๋“ค์—ฌ์“ฐ๊ธฐ ํ™•์ธ (YAML์€ ๋“ค์—ฌ์“ฐ๊ธฐ์— ๋ฏผ๊ฐ)
  3. ๋กœ๊ทธ ํ™•์ธ
  4. ๋ฐฑ์—… ์œ ์ง€

YAML ์ž‘์„ฑ ์‹œ ์ฃผ์˜์‚ฌํ•ญ

# ์˜ฌ๋ฐ”๋ฅธ ์˜ˆ์‹œ
light:
  - platform: mqtt
    name: "๊ฑฐ์‹ค๋“ฑ"
    state_topic: "home/light/status"

# ์ž˜๋ชป๋œ ์˜ˆ์‹œ
light:
- platform: mqtt
  name: "๊ฑฐ์‹ค๋“ฑ"
    state_topic: "home/light/status"  # ๋“ค์—ฌ์“ฐ๊ธฐ ๋ถˆ์ผ์น˜

๊ณ ๊ธ‰ ์„ค์ • ์˜ต์…˜

์„ค์ • ํŒŒ์ผ ๋ถ„ํ• 

ํฐ ์„ค์ • ํŒŒ์ผ์„ ๊ด€๋ฆฌํ•˜๊ธฐ ์‰ฝ๊ฒŒ ๋ถ„ํ• ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

# configuration.yaml
homeassistant:
  packages: !include_dir_named packages

# ๋ถ„ํ• ๋œ ์„ค์ • ํŒŒ์ผ๋“ค์€ packages/ ๋””๋ ‰ํ† ๋ฆฌ์— ์ €์žฅ

๋น„๋ฐ€ ์ •๋ณด ๊ด€๋ฆฌ

๋ฏผ๊ฐํ•œ ์ •๋ณด๋Š” ๋ณ„๋„์˜ secrets.yaml ํŒŒ์ผ์— ์ €์žฅ:

# secrets.yaml
mqtt_password: "your_secret_password"

# configuration.yaml
mqtt:
  password: !secret mqtt_password

์œ ์šฉํ•œ ํŒ

  1. ๋ณ€๊ฒฝ ์ „ ํ•ญ์ƒ ๋ฐฑ์—…
  2. ์ž‘์€ ๋‹จ์œ„๋กœ ๋ณ€๊ฒฝ ํ›„ ํ…Œ์ŠคํŠธ
  3. ์ฃผ์„ ํ™œ์šฉํ•˜์—ฌ ์„ค์ • ๋ฌธ์„œํ™”
  4. ์ •๊ธฐ์ ์œผ๋กœ ์„ค์ • ๊ฒ€์ฆ
  5. ์ค‘์š” ๋ณ€๊ฒฝ ์‹œ ์ „์ฒด ์žฌ์‹œ์ž‘ ๊ถŒ์žฅ

๊ด€๋ จ ์ฃผ์ œ

  • YAML ๋ฌธ๋ฒ•
  • ๋ฐฑ์—… ์ƒ์„ฑ ๋ฐ ๋ณต์›
  • ๊ฐœ๋ฐœ์ž ๋„๊ตฌ๋ฅผ ํ†ตํ•œ YAML ์„ค์ • ๋ฆฌ๋กœ๋“œ
  • ํŒŒ์ผ ์ ‘๊ทผ ์„ค์ •
  • ๋ณด์•ˆ ์„ค์ •

Home Assistant ๋ฌธ์ œ ํ•ด๊ฒฐ ๊ฐ€์ด๋“œ

(์ •๋ณด๋ฅผ ํ™•์ธํ•˜๋ ค๋ฉด ํด๋ฆญํ•˜์„ธ์š”!)

Home Assistant ๋ฌธ์ œ ํ•ด๊ฒฐ ๊ฐ€์ด๋“œ

๊ธฐ๋ณธ ๋ฌธ์ œ ํ•ด๊ฒฐ ์ ˆ์ฐจ

1. ๋กœ๊ทธ ํ™•์ธํ•˜๊ธฐ

  • ์œ„์น˜: configuration ๋””๋ ‰ํ† ๋ฆฌ์˜ home-assistant.log ํŒŒ์ผ
  • ๋กœ๊ทธ ํŒŒ์ผ์€ Home Assistant ์‹œ์ž‘ ์‹œ ์ดˆ๊ธฐํ™”๋จ
  • ๋ชจ๋“  ๊ฒฝ๊ณ ์™€ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๊ฐ€ ๊ธฐ๋ก๋จ

์ผ๋ฐ˜์ ์ธ ๋ฌธ์ œ ํ•ด๊ฒฐ

ํ†ตํ•ฉ๊ตฌ์„ฑ์ด ํ‘œ์‹œ๋˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ

  1. home-assistant.log ํŒŒ์ผ์—์„œ ๊ด€๋ จ ์˜ค๋ฅ˜ ํ™•์ธ
  2. ์„ค์ • ํŒŒ์ผ์˜ ๊ตฌ๋ฌธ ์˜ค๋ฅ˜ ํ™•์ธ
  3. ํ•„์ˆ˜ ์ข…์†์„ฑ ์„ค์น˜ ์—ฌ๋ถ€ ํ™•์ธ
  4. Home Assistant ์žฌ์‹œ์ž‘ ์‹œ๋„

์„ค์ • ํŒŒ์ผ ๋ฌธ์ œ

์ผ๋ฐ˜์ ์ธ ์„ค์ • ํŒŒ์ผ ๋ฌธ์ œ

  1. UTF-8 ์ธ์ฝ”๋”ฉ ํ™•์ธ
  2. YAML ๊ตฌ๋ฌธ ๊ฒ€์ฆ
  3. ์ค‘๋ณต ์„น์…˜ ํ™•์ธ
  4. ํ•„์ˆ˜ ์„ค์ • ๋ˆ„๋ฝ ํ™•์ธ
# ์˜ฌ๋ฐ”๋ฅธ ๊ตฌ์„ฑ ์˜ˆ์‹œ
sensor:
  - platform: forecast
    ...
  - platform: bitcoin
    ...

# ์ž˜๋ชป๋œ ๊ตฌ์„ฑ ์˜ˆ์‹œ (์ค‘๋ณต ์„น์…˜)
sensor:
  platform: forecast
    ...
sensor:
  platform: bitcoin
    ...

์—ฌ๋Ÿฌ ํŒŒ์ผ ์‚ฌ์šฉ ์‹œ ์ฃผ์˜์‚ฌํ•ญ

# configuration.yaml
light: !include devices/lights.yaml
sensor: !include devices/sensors.yaml

# lights.yaml
- platform: hyperion
  host: 192.168.1.98
  
# sensors.yaml
- platform: mqtt
  name: "๋ฐฉ ์Šต๋„"
  state_topic: "room/humidity"

์—”ํ‹ฐํ‹ฐ ์ด๋ฆ„ ๊ทœ์น™

์œ ํšจํ•œ ๋ฌธ์ž:

  • ์†Œ๋ฌธ์ž
  • ์ˆซ์ž
  • ๋ฐ‘์ค„(_)

์ฃผ์˜์‚ฌํ•ญ:

  • ๋ฐ‘์ค„๋กœ ์‹œ์ž‘ํ•˜๊ฑฐ๋‚˜ ๋๋‚˜๋ฉด ์•ˆ ๋จ
  • ๋‹ค๋ฅธ ํŠน์ˆ˜๋ฌธ์ž ์‚ฌ์šฉ ๋ถˆ๊ฐ€
  • UI์—์„œ ์ž๋™ ๊ฒ€์ฆ๋จ

๋””๋ฒ„๊ทธ ๋กœ๊ทธ ํ™œ์„ฑํ™” ๋ฐ ์ง„๋‹จ

๋””๋ฒ„๊ทธ ๋กœ๊ทธ ํ™œ์„ฑํ™” ๋ฐฉ๋ฒ•

  1. Settings > Devices & services ์ด๋™
  2. ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š” ํ†ตํ•ฉ๊ตฌ์„ฑ ์นด๋“œ ์„ ํƒ
  3. 'Enable Debug Logging' ์„ ํƒ
  4. ์˜ค๋ฅ˜ ์žฌํ˜„
  5. 'Disable Debug Logging' ์„ ํƒํ•˜์—ฌ ๋กœ๊ทธ ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ

์ง„๋‹จ ์ •๋ณด ๋‹ค์šด๋กœ๋“œ

  1. ํ†ตํ•ฉ๊ตฌ์„ฑ ์ƒ์„ธ ํŽ˜์ด์ง€์—์„œ ๋ฉ”๋‰ด(์  3๊ฐœ) ์„ ํƒ
  2. 'Download Diagnostics' ์„ ํƒ
  3. ์ง„๋‹จ ํŒŒ์ผ ์ €์žฅ

์˜ˆ๊ธฐ์น˜ ์•Š์€ ์žฌ์‹œ์ž‘์ด๋‚˜ ์ถฉ๋Œ ์ฒ˜๋ฆฌ

๋””๋ฒ„๊ทธ ๋ชจ๋“œ ํ™œ์„ฑํ™”:

# configuration.yaml
homeassistant:
  debug: true

์ฃผ์˜: ์„ฑ๋Šฅ์— ์˜ํ–ฅ์„ ์ค„ ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์žฅ๊ธฐ ์‚ฌ์šฉ์€ ๊ถŒ์žฅํ•˜์ง€ ์•Š์Œ

์ข…์†์„ฑ ๋ฌธ์ œ ํ•ด๊ฒฐ

์ข…์†์„ฑ ์„ค์น˜ ์‹คํŒจ ์‹œ

  1. Home Assistant ์žฌ์‹œ์ž‘
  2. ๋กœ๊ทธ์—์„œ ๊ตฌ์ฒด์ ์ธ ์˜ค๋ฅ˜ ํ™•์ธ
  3. ํ•„์š”ํ•œ ํŒจํ‚ค์ง€ ์ˆ˜๋™ ์„ค์น˜
  4. ์žฌ์‹œ์ž‘ ํ›„ ์žฌํ™•์ธ

๋ฌธ์ œ ๋ณด๊ณ  ์‹œ ์ค€๋น„์‚ฌํ•ญ

  1. ๋””๋ฒ„๊ทธ ๋กœ๊ทธ ํŒŒ์ผ
  2. ์ง„๋‹จ ์ •๋ณด ํŒŒ์ผ
  3. ์„ค์ • ํŒŒ์ผ ๊ด€๋ จ ๋‚ด์šฉ
  4. ์˜ค๋ฅ˜ ์žฌํ˜„ ๋ฐฉ๋ฒ•
  5. Home Assistant ๋ฒ„์ „ ์ •๋ณด

๊ณ ๊ธ‰ ๋ฌธ์ œ ํ•ด๊ฒฐ ํŒ

๋กœ๊ทธ ๋ ˆ๋ฒจ ์„ค์ •

logger:
  default: warning
  logs:
    homeassistant.components.๋ฌธ์ œ_์ปดํฌ๋„ŒํŠธ: debug

์•ˆ์ „ ๋ชจ๋“œ ์‹œ์ž‘

์‹ฌ๊ฐํ•œ ๋ฌธ์ œ ๋ฐœ์ƒ ์‹œ ์•ˆ์ „ ๋ชจ๋“œ๋กœ ์‹œ์ž‘ํ•˜์—ฌ ๋ฌธ์ œ ํ•ด๊ฒฐ:

  1. Home Assistant ์ค‘์ง€
  2. ์„ค์ • ํŒŒ์ผ ๋ฐฑ์—…
  3. ์ตœ์†Œ ์„ค์ •์œผ๋กœ ์‹œ์ž‘
  4. ๋‹จ๊ณ„์ ์œผ๋กœ ์„ค์ • ์ถ”๊ฐ€

์„ฑ๋Šฅ ๋ฌธ์ œ ํ•ด๊ฒฐ

  1. ๋กœ๊ทธ ๋ชจ๋‹ˆํ„ฐ๋ง
  2. ๋ฆฌ์†Œ์Šค ์‚ฌ์šฉ๋Ÿ‰ ํ™•์ธ
  3. ๋ถˆํ•„์š”ํ•œ ํ†ตํ•ฉ๊ตฌ์„ฑ ๋น„ํ™œ์„ฑํ™”
  4. ์ž๋™ํ™” ๊ทœ์น™ ์ตœ์ ํ™”

Home Assistant ์„ค์ • ํŒŒ์ผ ๋ถ„ํ•  ๊ฐ€์ด๋“œ

(์ •๋ณด๋ฅผ ํ™•์ธํ•˜๋ ค๋ฉด ํด๋ฆญํ•˜์„ธ์š”!)

Home Assistant ์„ค์ • ํŒŒ์ผ ๋ถ„ํ•  ๊ฐ€์ด๋“œ

์„ค์ • ํŒŒ์ผ ๋ถ„ํ•  ๊ธฐ๋ณธ ๊ฐœ๋…

ํ•ต์‹ฌ ์„ค์ • ํŒŒ์ผ ๊ตฌ์กฐ

# configuration.yaml ํ•ต์‹ฌ ๊ตฌ์„ฑ
homeassistant:
  # Home Assistant ์ธ์Šคํ„ด์Šค ์ด๋ฆ„
  name: "๋‚ด ํ™ˆ์–ด์‹œ์Šคํ„ดํŠธ"
  # ์ผ์ถœ/์ผ๋ชฐ ๊ณ„์‚ฐ์„ ์œ„ํ•œ ์œ„์น˜ ์ •๋ณด
  latitude: 37
  longitude: 127
  # ๋‹จ์œ„ ์‹œ์Šคํ…œ ('metric' ๋˜๋Š” 'us_customary')
  unit_system: metric
  # ์‹œ๊ฐ„๋Œ€ ์„ค์ •
  time_zone: "Asia/Seoul"
  # ์‚ฌ์šฉ์ž ์ •์˜ ์„ค์ • ํฌํ•จ
  customize: !include customize.yaml

ํŒŒ์ผ ๋ถ„ํ•  ๋ฐฉ๋ฒ•

1. ๊ธฐ๋ณธ ๋ถ„ํ•  ๋ฐฉ์‹

์ฃผ์š” ๊ธฐ๋Šฅ๋ณ„๋กœ ํŒŒ์ผ ๋ถ„๋ฆฌ:

# configuration.yaml
automation: !include automation.yaml
zone: !include zone.yaml
sensor: !include sensor.yaml
switch: !include switch.yaml
device_tracker: !include device_tracker.yaml

2. ๊ณ ๊ธ‰ ๋ถ„ํ•  ๋ฐฉ์‹

4๊ฐ€์ง€ ๊ณ ๊ธ‰ include ์˜ต์…˜:

  1. !include_dir_list

    • ๋””๋ ‰ํ† ๋ฆฌ์˜ ๋‚ด์šฉ์„ ๋ฆฌ์ŠคํŠธ๋กœ ๋ฐ˜ํ™˜
    • ํŒŒ์ผ๋ช… ์•ŒํŒŒ๋ฒณ ์ˆœ์œผ๋กœ ์ •๋ ฌ
    # configuration.yaml
    automation: !include_dir_list automation/presence/
  2. !include_dir_named

    • ๋””๋ ‰ํ† ๋ฆฌ ๋‚ด์šฉ์„ ํŒŒ์ผ๋ช… ๊ธฐ์ค€ ์‚ฌ์ „์œผ๋กœ ๋ฐ˜ํ™˜
    # configuration.yaml
    alexa:
      intents: !include_dir_named alexa/
  3. !include_dir_merge_list

    • ์—ฌ๋Ÿฌ ํŒŒ์ผ์˜ ๋ฆฌ์ŠคํŠธ๋ฅผ ํ•˜๋‚˜๋กœ ๋ณ‘ํ•ฉ
    # configuration.yaml
    automation: !include_dir_merge_list automation/
  4. !include_dir_merge_named

    • ์—ฌ๋Ÿฌ ํŒŒ์ผ์˜ ์„ค์ •์„ ํ•˜๋‚˜์˜ ์‚ฌ์ „์œผ๋กœ ๋ณ‘ํ•ฉ
    # configuration.yaml
    group: !include_dir_merge_named group/

์‹ค์ œ ์ ์šฉ ์˜ˆ์‹œ

1. ์ž๋™ํ™” ์„ค์ • ๋ถ„ํ• 

# automation/lights/
# turn_light_on.yaml
alias: "์กฐ๋ช… ์ผœ๊ธฐ"
triggers:
  - platform: sun
    event: sunset
actions:
  - service: light.turn_on
    target:
      entity_id: light.living_room

# turn_light_off.yaml
alias: "์กฐ๋ช… ๋„๊ธฐ"
triggers:
  - platform: sun
    event: sunrise
actions:
  - service: light.turn_off
    target:
      entity_id: light.living_room

2. ๊ทธ๋ฃน ์„ค์ • ๋ถ„ํ• 

# groups/interior.yaml
๊ฑฐ์‹ค:
  name: "๊ฑฐ์‹ค"
  entities:
    - light.living_room
    - media_player.tv
    - climate.living_room

์นจ์‹ค:
  name: "์นจ์‹ค"
  entities:
    - light.bedroom
    - climate.bedroom

3. ์„ผ์„œ ์„ค์ • ๋ถ„ํ• 

# sensors/environmental.yaml
- platform: temperature
  name: "๊ฑฐ์‹ค ์˜จ๋„"
  entity_id: sensor.living_room_temp

- platform: humidity
  name: "๊ฑฐ์‹ค ์Šต๋„"
  entity_id: sensor.living_room_humidity

์ฃผ์˜์‚ฌํ•ญ ๋ฐ ํŒ

๋“ค์—ฌ์“ฐ๊ธฐ ๊ทœ์น™

  • ๊ธฐ๋ณธ ๋“ค์—ฌ์“ฐ๊ธฐ: 2์นธ
  • ๋ฆฌ์ŠคํŠธ ํ•ญ๋ชฉ: ํ•˜์ดํ”ˆ(-) ๋‹ค์Œ 1์นธ
  • ์ž˜๋ชป๋œ ๋“ค์—ฌ์“ฐ๊ธฐ๋Š” ์˜ค๋ฅ˜์˜ ์ฃผ์š” ์›์ธ

ํŒŒ์ผ ํ™•์žฅ์ž

  • .yaml ํ™•์žฅ์ž๋งŒ ์ง€์›
  • .yml์€ ์ง€์›๋˜์ง€ ์•Š์Œ

์ฃผ์„ ์‚ฌ์šฉ

### ์กฐ๋ช… ์ž๋™ํ™” ###############
- platform: light
  name: living_room
  # ๊ฑฐ์‹ค ๋ฉ”์ธ ์กฐ๋ช…
  entities:
    - light.ceiling
    - light.table_lamp

### ์„ผ์„œ ์„ค์ • ################
- platform: temperature
  # ์˜จ๋„ ์„ผ์„œ ์„ค์ •

UI์™€ YAML ํ˜ผํ•ฉ ์‚ฌ์šฉ

# configuration.yaml
# ์ˆ˜๋™ ์ž‘์„ฑ ์ž๋™ํ™”
automation manual: !include_dir_merge_list automations/

# UI์—์„œ ์ƒ์„ฑํ•œ ์ž๋™ํ™”
automation ui: !include automations.yaml

๋””๋ฒ„๊น… ๋ฐ ๋ฌธ์ œ ํ•ด๊ฒฐ

์„ค์ • ๊ฒ€์ฆ

  1. Home Assistant ์„ค์ • ๊ฒ€์‚ฌ ๋„๊ตฌ ์‚ฌ์šฉ
  2. YAML ๋ฌธ๋ฒ• ๊ฒ€์‚ฌ๊ธฐ ํ™œ์šฉ
  3. ๋กœ๊ทธ ํŒŒ์ผ ํ™•์ธ

์ผ๋ฐ˜์ ์ธ ์˜ค๋ฅ˜

  • ๋“ค์—ฌ์“ฐ๊ธฐ ๋ถˆ์ผ์น˜
  • ํŒŒ์ผ ๊ฒฝ๋กœ ์˜ค๋ฅ˜
  • ์ค‘๋ณต๋œ ์„ค์ •
  • ์ž˜๋ชป๋œ ์ฐธ์กฐ

๋ชจ๋ฒ” ์‚ฌ๋ก€

  1. ๋…ผ๋ฆฌ์ ์ธ ํŒŒ์ผ ๊ตฌ์กฐ ์œ ์ง€
  2. ๋ช…ํ™•ํ•œ ํŒŒ์ผ ์ด๋ฆ„ ์‚ฌ์šฉ
  3. ์ฃผ์„์œผ๋กœ ์„ค์ • ๋ฌธ์„œํ™”
  4. ์ •๊ธฐ์ ์ธ ๋ฐฑ์—… ์œ ์ง€
  5. ๋ณ€๊ฒฝ ์‚ฌํ•ญ ๋‹จ๊ณ„์  ์ ์šฉ
โš ๏ธ **GitHub.com Fallback** โš ๏ธ