Prerequisites
Before you begin, ensure you have:- Python 3.14.2 or later installed
- Git for cloning the repository
- A Linux, macOS, or Windows (WSL) system
- Basic knowledge of Python and asyncio
Quick Setup
1
Clone the Repository
Clone the Home Assistant Core repository:
2
Create a Virtual Environment
Create and activate a Python virtual environment:
Using a virtual environment is highly recommended to isolate dependencies.
3
Install in Development Mode
Install Home Assistant in editable mode with development dependencies:This installs the
hass command and all core dependencies.4
Run Home Assistant
Start Home Assistant for the first time:Home Assistant will:
- Create a default configuration directory at
./config - Generate
configuration.yamlwith default settings - Start the web server on
http://localhost:8123
Understanding the Command Line
Thehass command (defined in homeassistant/__main__.py) provides several useful options:
Accessing the Web Interface
Once Home Assistant is running:- Open your browser to http://localhost:8123
- Complete the onboarding process:
- Create an owner account
- Set your home location
- Configure basic settings
- Explore the dashboard
Creating Your First Integration
Let’s create a simple “Hello World” integration to understand the basics.Integration Structure
Create a new directory for your integration:Manifest File
Createmanifest.json to define your integration:
manifest.json
Integration Code
Create__init__.py with the setup logic:
__init__.py
Add to Configuration
Add your integration toconfig/configuration.yaml:
configuration.yaml
Restart and Test
1
Restart Home Assistant
Stop Home Assistant (Ctrl+C) and restart it:
2
Call Your Service
Open the Developer Tools in the web UI (http://localhost:8123/developer-tools/service) and call your service:
3
View the State
Check the States tab in Developer Tools to see
hello_world.greeting with the value “Hello, Developer!”Understanding the Code
Let’s break down what’s happening:The async_setup Function
The HomeAssistant Object
Thehass object provides access to:
hass.services- Service registryhass.states- State machinehass.bus- Event bushass.data- Shared data storagehass.config- Configuration access
Registering Services
Setting States
- entity_id - Unique identifier (format:
domain.object_id) - state - The current value (string, max 255 chars)
- attributes - Dictionary of additional data
Adding a Sensor Platform
Let’s extend our integration with a sensor that shows random numbers. Createsensor.py:
sensor.py
configuration.yaml to enable the sensor:
configuration.yaml
Next Steps
Now that you have a working development environment:Installation Guide
Learn about detailed installation options and requirements
Configuration
Explore Home Assistant configuration options
Developer Docs
Read the comprehensive developer documentation
Integration Development
Deep dive into creating integrations