Setting up a development environment
You need a development environment if you wish to develop ESPHome — new components or otherwise.
In short, ESPHome is set up to use a Python virtual environment.
This guide will walk you through the steps to set up an environment you can use for development.
NOTE
The instructions that follow apply for Linux and macOS. Windows users can still develop ESPHome and its components, but the process is slightly different and covered at the bottom of this guide.
Requirements
Section titled “Requirements”- Python 3.11 or newer
pip(Python package manager)- Familiarity with
gitand GitHub
NOTE
ESPHome’s code and documentation is hosted on GitHub; we use this to collaborate on all changes.
As a deep-dive into how git and GitHub works is beyond the scope of this documentation,
we’ll assume that you’re already familiar with these tools and just walk through the basic steps required to get
started.
If you’re not familiar with git and/or GitHub or if you’d just like more detail on any of
the steps that follow, you should read through the
GitHub documentation. While there’s a lot there (and it’s consequently probably a
bit daunting), if you just want to submit your own work to ESPHome, we might suggest you start with the
Fork a repo guide.
Set up the local repository
Section titled “Set up the local repository”Before you start, you need your own fork of the ESPHome repository cloned to your computer. Follow
Creating a pull request from a fork to create the fork, clone it and add the
upstream remote, then come back here.
Run the setup script
Section titled “Run the setup script”Once the local clone is set up, you can now run the setup script.
Linux/macOS
script/setupOn Windows with python install manager:
script\setup.batThis will create a Python virtual environment and install various other requirements.
Activate the virtual environment
Section titled “Activate the virtual environment”To use the virtual environment, you need to activate it. This needs to be done for each new terminal session and is done by running:
Linux/macOS:
source venv/bin/activateWindows (PowerShell):
venv\Scripts\Activate.ps1Run esphome
Section titled “Run esphome”With the virtual environment activated, ESPHome can be run directly from that terminal:
esphome compile some-config-file.yaml…or:
esphome run some-config-file.yaml --device /dev/tty.your_usb_deviceCreate your config directory
Section titled “Create your config directory”At this point, it is also good to create an empty directory named config. You should store all of your ESPHome
configurations in this directory.
This folder is conveniently listed in the ESPHome .gitignore file, so it will not be added to git.
Make your changes
Section titled “Make your changes”You’re now ready to make (and test!) your changes. Do your work on a new branch, then commit it, push it to your fork and open a PR, as described in Creating a pull request from a fork.
Windows
Testing Development Changes on Windows
Section titled “Testing Development Changes on Windows”In the examples below:
usernameis your GitHub username.branchis the branch name you’ve used for your work.
To test changes when using Windows:
-
Create a branch in your remote fork of the main ESPHome GitHub repo
-
Install from your fork in the same manner you would install ESPHome manually but with one of the following commands:
Terminal window pip install --pre https://github.com/username/esphome/archive/branch.zipOR
Terminal window pip install git+https://github.com/username/esphome.git@branch -
To test changes to the repo without modifying version numbers, a subsequent pip update can be performed using flags
--no-depsalong with--force-reinstallas follows:Terminal window pip install git+https://github.com/username/esphome.git@branch --no-deps --force-reinstallThis will ensure that pip only compiles and reinstalls ESPHome and not its dependencies.
-
If
uvis installed, which can be done usingpip install uv, it massively simplifies the above process. UV automagically takes care of all the checks using just one command:Terminal window uv pip install git+https://github.com/username/esphome.git@branch --systemThe
--systemflag is only necessary when running Python on Windows.
Copyright © 2026 ESPHome - A project from the Open Home Foundation