# Building integrations

> Everything an integration is made of, from the manifest and the config flow to fetching data, discovery, and diagnostics.

Source: https://contributors.home-assistant.io/core/integrations/

An [integration](https://contributors.home-assistant.io/glossary/integration/) connects Home Assistant to a device, a service, or an idea. It lives in its own folder, describes itself in a manifest, sets itself up from a config entry, and hands its data to Home Assistant as entities.

This part of the site walks through all of it, task by task. It is written for people who write Python. You do not need to read it front to back: start with the tutorial, and come back for the rest when your integration needs it.

> [!TIP]
> Want to add support for a new device or service? Read [how an integration fits in](https://contributors.home-assistant.io/core/integrations/concepts/), then build one in the [tutorial](https://contributors.home-assistant.io/core/integrations/tutorial/). Check first whether it [belongs in core](https://contributors.home-assistant.io/core/integrations/create/#does-it-belong-in-core): the project recommends publishing a new integration in the [Marketplace](https://contributors.home-assistant.io/marketplace/) first, and new integrations in core need to reach at least the Bronze tier of the [quality scale](https://contributors.home-assistant.io/core/quality-scale/).

## Getting started

- [How an integration fits in](https://contributors.home-assistant.io/core/integrations/concepts/): integrations, config entries, platforms, entities, devices, coordinators, and the event loop, in plain language.
- [Build your first integration](https://contributors.home-assistant.io/core/integrations/tutorial/): a complete integration, step by step, from the scaffold to the pull request.
- [Build a Python library](https://contributors.home-assistant.io/core/integrations/api-library/): the library every integration uses to talk to its device or service.
- [Create an integration](https://contributors.home-assistant.io/core/integrations/create/): what is accepted in core, the scaffold script, and the smallest possible integration.
- [File structure](https://contributors.home-assistant.io/core/integrations/file-structure/): which file does what, and where Home Assistant looks for integrations.
- [Writing tests](https://contributors.home-assistant.io/core/development/tests/), in the development workflow: how to test an integration, with fixtures, mocks, and snapshots.

## Setup and configuration

- [Config entries](https://contributors.home-assistant.io/core/integrations/config-entries/): set up, unload, and migrate an integration, and keep its runtime data.
- [Config flow](https://contributors.home-assistant.io/core/integrations/config-flow/): let users add your integration from the UI.
- [Forms, menus, and progress](https://contributors.home-assistant.io/core/integrations/flow-steps/): the building blocks of every flow.
- [Options flow](https://contributors.home-assistant.io/core/integrations/options-flow/): let users change how the integration behaves.
- [Subentries](https://contributors.home-assistant.io/core/integrations/subentries/): store repeatable parts of a config entry, like locations.
- [Reauthentication and reconfiguration](https://contributors.home-assistant.io/core/integrations/reauth-reconfigure/): fix credentials and connection details without removing the integration.
- [OAuth 2.0 and application credentials](https://contributors.home-assistant.io/core/integrations/oauth2/): link a user's account at a cloud service.
- [YAML configuration](https://contributors.home-assistant.io/core/integrations/yaml/): when it is still allowed, and how it works.
- [Setup failures and exceptions](https://contributors.home-assistant.io/core/integrations/setup-failures/): retry when a device is offline, and raise the right errors.

## Data and updates

- [Fetching data](https://contributors.home-assistant.io/core/integrations/fetching-data/): polling, push, and the data update coordinator.
- [Events](https://contributors.home-assistant.io/core/integrations/events/): fire events, and listen to what happens in Home Assistant.
- [Instance URL](https://contributors.home-assistant.io/core/integrations/instance-url/): find the URL a device or service can reach Home Assistant on.

## Discovery

- [Discovery](https://contributors.home-assistant.io/core/integrations/discovery/): how Home Assistant finds devices and starts your config flow.
- [Network discovery](https://contributors.home-assistant.io/core/integrations/network-discovery/): the zeroconf, SSDP, DHCP, USB, and network APIs.
- [Bluetooth integrations](https://contributors.home-assistant.io/core/integrations/bluetooth/): best practices and the Bluetooth API.
- [Fetching Bluetooth data](https://contributors.home-assistant.io/core/integrations/bluetooth-data/): coordinators driven by advertisements.

## Devices and registries

- [Device registry](https://contributors.home-assistant.io/core/integrations/device-registry/): register devices, and link and split them.
- [Entity registry](https://contributors.home-assistant.io/core/integrations/entity-registry/): look up and migrate the entities of your integration.
- [Area registry](https://contributors.home-assistant.io/core/integrations/area-registry/): what Home Assistant knows about areas.

## Integration features

- [Actions](https://contributors.home-assistant.io/core/integrations/actions/): register actions that users can call from automations and scripts.
- [Device automations](https://contributors.home-assistant.io/core/integrations/device-automations/): device triggers, conditions, and actions.
- [Triggers and conditions](https://contributors.home-assistant.io/core/integrations/triggers-and-conditions/): provide automation triggers and conditions.
- [Diagnostics](https://contributors.home-assistant.io/core/integrations/diagnostics/): let users download data to troubleshoot.
- [System health](https://contributors.home-assistant.io/core/integrations/system-health/): show the state of your integration on the system information page.
- [Repairs](https://contributors.home-assistant.io/core/integrations/repairs/): tell users about problems, and help them fix them.
- [Asking for a restart](https://contributors.home-assistant.io/core/integrations/restart-required/): tell Home Assistant it needs a restart to apply a change.
- [Reproduce state](https://contributors.home-assistant.io/core/integrations/reproduce-state/): make scenes work with your entities.
- [Significant change](https://contributors.home-assistant.io/core/integrations/significant-change/): tell exporters which state changes matter.
- [Backup](https://contributors.home-assistant.io/core/integrations/backup/): store backups somewhere, or prepare for one.
- [Media source](https://contributors.home-assistant.io/core/integrations/media-source/): expose browsable and playable media.

## Reference

- [The manifest](https://contributors.home-assistant.io/core/integrations/manifest/): every key of `manifest.json`.
- [Integration brands and images](https://contributors.home-assistant.io/core/integrations/brands/): icons, logos, and grouping integrations under one brand.
- [Translations](https://contributors.home-assistant.io/core/integrations/translations/): every section of `strings.json`, references, and placeholders.

## Related topics

- [Entities and platforms](https://contributors.home-assistant.io/core/entities/): the entity types your integration provides, like sensors and lights.
- [Development workflow](https://contributors.home-assistant.io/core/development/): the environment, tests, code style, and submitting your work.
- [How core works](https://contributors.home-assistant.io/core/internals/): the `hass` object, the event loop, and the APIs beneath your integration.
- [Make your strings translatable](https://contributors.home-assistant.io/translate/guides/developers/): how to write strings that translators can work with.
- [Document your integration](https://contributors.home-assistant.io/writing/guides/integration/): every integration has a page on [home-assistant.io](https://www.home-assistant.io/).

## Who to talk to

- Ask in the [**#core**](https://discord.com/channels/330944238910963714/1475552721515053268) channel on the [Home Assistant Discord](https://www.home-assistant.io/join-chat/). Share a link to your branch, so people can see the code you are asking about.
- Look at a well maintained integration that does something similar. Many integrations at the Platinum tier of the quality scale, like `airgradient`, are good examples of current patterns.
- Not sure if your idea fits Home Assistant? Open a discussion in the [architecture repository](https://github.com/home-assistant/architecture/discussions) before you write a lot of code.
