A Python-based automation tool for controlling ecobee thermostats through the web interface using Selenium WebDriver. Available as a Home Assistant Add-on or standalone CLI tool.
- Home Assistant Integration: Available as a Home Assistant add-on with REST API
- Multiple Thermostats: Control Main Floor and Upstairs thermostats independently
- Web UI Automation: Automated navigation of the ecobee web portal
- Mode Switching: Switch between Heat and Aux Heat modes
- Headless Operation: Runs in background without visible browser
- Robust Error Handling: Comprehensive error handling with retry logic
- Configurable Settings: Flexible configuration through environment variables and YAML files
- Logging: Detailed logging for debugging and monitoring
- Screenshot Capture: Automatic screenshots on errors for debugging
-
Add this repository to your Home Assistant add-on store:
- Navigate to Supervisor → Add-on Store
- Click the 3-dot menu → Repositories
- Add:
https://github.com/JakubOleksy/ecobee.control - Find "Ecobee Web Control" and click Install
-
Configure the add-on with your Ecobee credentials
-
Start the add-on
-
Add REST commands to your
configuration.yaml(see addon/DOCS.md)
ecobee.control/
├── addon/ # Home Assistant Add-on files
│ ├── config.yaml # Add-on configuration
│ ├── Dockerfile # Container build instructions
│ ├── run.sh # Add-on startup script
│ ├── DOCS.md # Add-on documentation
│ └── README.md # Add-on readme
├── .github/
│ └── copilot-instructions.md # Project guidelines and instructions
├── src/
│ ├── __init__.py # Package initialization
│ ├── ecobee_automation.py # Main automation class
│ ├── config_manager.py # Configuration management
│ └── exceptions.py # Custom exception classes
├── config/
│ └── default.yml # Default configuration settings
├── cli.py # Command-line interface
├── api_server.py # REST API server (for add-on)
├── requirements.txt # Python dependencies
├── .env # Environment configuration
├── .secrets # Credentials (gitignored)
├── repository.json # Home Assistant repository config
└── README.md # This file
- Python 3.8 or higher
- Chrome browser installed
- Valid ecobee account with web portal access
-
Clone the repository:
git clone https://github.com/JakubOleksy/ecobee-web-automation.git cd ecobee-web-automation -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up configuration:
cp .env.template .env
Edit
.envand add your ecobee credentials:ECOBEE_USERNAME=your_username_here ECOBEE_PASSWORD=your_password_here
The application uses a layered configuration system:
- Default settings:
config/default.yml - Environment variables:
.envfile or system environment - Local overrides:
config/local.yml(optional, gitignored)
| Setting | Environment Variable | Default | Description |
|---|---|---|---|
ecobee.username |
ECOBEE_USERNAME |
- | Your ecobee username |
ecobee.password |
ECOBEE_PASSWORD |
- | Your ecobee password |
webdriver.headless |
WEBDRIVER_HEADLESS |
true |
Run browser in headless mode |
automation.delay |
AUTOMATION_DELAY |
2 |
Delay between actions (seconds) |
automation.screenshot_on_error |
SCREENSHOT_ON_ERROR |
true |
Take screenshots on errors |
from src.config_manager import ConfigManager
from src.ecobee_automation import EcobeeAutomation
# Load configuration
config = ConfigManager()
# Use the automation
with EcobeeAutomation(config) as automation:
# Login to ecobee
if automation.login():
# Get current status
status = automation.get_heating_status()
print(f"Current temp: {status.current_temp}°F")
print(f"Target temp: {status.target_temp}°F")
print(f"Mode: {status.mode}")
# Change heating mode
automation.set_heating_mode('heat')
# Set target temperature
automation.set_temperature(72.0)Run the main script directly:
python src/ecobee_automation.pylogin(): Authenticate with ecobee web portalget_heating_status(): Retrieve current thermostat statusset_heating_mode(mode): Change heating mode ('heat','cool','auto','off')set_temperature(temp): Set target temperature (in Fahrenheit)
Contains current thermostat information:
current_temp: Current temperature readingtarget_temp: Target temperature settingmode: Current heating/cooling modeis_heating: Whether system is actively heating
- Web Element Selectors: Update selectors in
config/default.ymlif ecobee changes their UI - New Automation Methods: Add methods to
EcobeeAutomationclass - Configuration Options: Add new settings to config files and environment mappings
Create unit tests in the tests/ directory:
# tests/test_config_manager.py
import unittest
from src.config_manager import ConfigManager
class TestConfigManager(unittest.TestCase):
def test_config_loading(self):
config = ConfigManager()
self.assertIsNotNone(config.get('webdriver.headless'))Run tests:
python -m pytest tests/- Enable Screenshots: Set
SCREENSHOT_ON_ERROR=truein.env - Disable Headless Mode: Set
WEBDRIVER_HEADLESS=falseto see browser actions - Increase Logging: Set
LOG_LEVEL=DEBUGfor detailed logs - Check Logs: Review logs in
logs/ecobee_automation.log
- Never commit credentials: Use environment variables for sensitive data
- Use strong passwords: Enable 2FA on your ecobee account if available
- Rate limiting: Avoid too frequent automation runs to prevent account lockout
- Private repository: Keep your automation code private to protect selectors and logic
-
Login Failures:
- Verify credentials in
.envfile - Check if ecobee has changed their login flow
- Enable 2FA bypass for automation if needed
- Verify credentials in
-
Element Not Found Errors:
- Ecobee may have updated their UI
- Update selectors in
config/default.yml - Take screenshots to see current page state
-
WebDriver Issues:
- Update Chrome browser to latest version
- Clear Chrome user data if needed
- Check ChromeDriver compatibility
-
Network Timeouts:
- Increase timeout values in configuration
- Check internet connection stability
- Verify ecobee service availability
The application includes comprehensive error handling:
- Automatic retries for transient failures
- Screenshot capture on errors for debugging
- Detailed logging with timestamps and context
- Graceful degradation when non-critical operations fail
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes with appropriate tests
- Update documentation if needed
- Submit a pull request
This project is for personal use. Ensure compliance with ecobee's terms of service when using this automation.
This tool is for educational and personal automation purposes. Users are responsible for:
- Complying with ecobee's terms of service
- Securing their account credentials
- Using automation responsibly
- Any consequences of automated actions
The authors are not responsible for any damages or service disruptions caused by this tool.
For issues and questions:
- Check the troubleshooting section above
- Review logs in
logs/ecobee_automation.log - Create an issue in the GitHub repository with:
- Error messages and logs
- Steps to reproduce
- Configuration details (without credentials)
- Screenshots if helpful