본문 바로가기
Homeassistant/Developer Docs

[Homeassistant] Integration Configuration

by miumida 2021. 1. 14.

끄적끄적

 

커스텀 컴포넌트를 통합구성요소로 등록할 수 있게 하기 위해서는 config_flow를 추가해주는 작업이 필요하다.
HA의 요즘 추세가 YAML 편집이 아니라 UI에서 앱을 설치하는 IOS의 앱스토어나 안드로이드의 플레이스토어와 비슷해지는 느낌이랄까?

어쨌든 HA에서 통합구성요소로 편하게 추가하기 위해서는 Core Intergation으로 등록되는게 제일 좋지만,,,

Core Intergration이 아니라면 Custom Intergration으로 작업해주는 것이 좋다.

 

개인적인 생각으로 config_flow를 추가하기 전에는 Custom Component라고 하고,

config_flow가 추가된 상태로 통합구성요소를 통해서 설정가능한 상태를 Custom Intergration이라고 구분지어져야할 것 같다.

물론 이건 지극히 개인적인 생각일뿐.

 

update the manifest

먼저 manifest.json 파일에 config_flow 항목을 추가해주고 true로 지정해주면 된다.

config_flow: true

 

defining your config flow

커스텀 컴포넌트 경로에 config_flow.py 파일을 추가해준다.

config_flow.py 파일에서 작성되는 코드들로 통합구성요소로 추가할 때 입력되는 부분들이 보여지게 될거다.

가장 기본적인 코드는 개발자 문서에 있는 코드정도? 실제로는 앞으로 넘어야할 산들이 더 많은거 같지만,,,

from homeassistant import config_entries
from .const import DOMAIN


class ExampleConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
    """Example config flow."""

 

 

작성중...

 

 

Integration Configuration | Home Assistant Developer Docs

Integrations can be set up via the user interface by adding support for a config flow to create a config entry. Components that want to support config entries will need to define a Config Flow Handler. This handler will manage the creation of entries from

developers.home-assistant.io

 

댓글