Five Tree Wood AI
AI-powered aircon temperature prediction for Home Assistant.
About
Five Tree Wood AI is a machine learning model for predicting indoor temperature using environmental sensor data. It can be used as a standalone application or as a Home Assistant add-on.
Home Assistant Add-on Installation
Method 1: Add Repository (Recommended)
- In Home Assistant, go to Supervisor → Add-on Store
- Click the ⋮ menu → Repositories
- Add this repository URL:
https://github.com/Swamp-Ig/five-tree-wood-ai - Find "Five Tree Wood AI" in the add-on store and click Install
- Configure the add-on (see Configuration section)
- Start the add-on
Method 2: Manual Installation
- Clone this repository to your Home Assistant
addonsfolder - Restart Home Assistant Supervisor
- The add-on will appear in your local add-ons list
Standalone Installation
1. Configuration
Copy the secrets template and configure your InfluxDB connection:
cp secrets.ini.template secrets.ini
# Edit secrets.ini with your actual InfluxDB credentials
2. Install Dependencies
Install the package in development mode with all dependencies:
# Install package with production dependencies
pip install -e .
# Or install with development dependencies
pip install -e .[dev]
Alternatively, you can still use requirements.txt:
pip install -r requirements.txt
3. Setup Code Formatting (Optional)
# Install git hooks for automatic formatting
python scripts/install_hooks.py
# Or manually format code anytime
python scripts/format_code.py
Package Structure
src/
└── five_tree_wood/
└── ai/
└── aircon/
├── train.py # Model training functionality
├── predict.py # Model prediction functionality
└── __init__.py # Package-level exports
scripts/
├── format_code.py # Code formatting script
├── check_tools.py # Tool availability checker
├── install_hooks.py # Git hooks installer
└── pre_commit_hook.py # Pre-commit hook implementation
Usage
Package-level imports
from five_tree_wood.ai.aircon import train_model, predict_temperature
# Train a model
model, features = train_model()
# Make a prediction
prediction = predict_temperature(
time="2025-09-08T14:30:00",
inside_temperature=22.5,
outside_temperature=15.0,
roof_temperature=18.0
)
Usage
Training the Model
# Using the installed script
aircon-ai train
# Or directly with Python
python src/main.py train
Making Predictions
# Using the installed script
aircon-ai predict now 22.5 15.0 18.0
# Or directly with Python
python src/main.py predict now 22.5 15.0 18.0
Running the API Server
# Using the installed script
aircon-ai api
# Or directly with Python
python src/main.py api
Direct Package Usage
# Simple package-level imports
from five_tree_wood.ai.aircon import train_model, predict_temperature
# Train a model
model, features = train_model()
# Make a prediction
prediction = predict_temperature(
time="2025-09-08T14:30:00",
inside_temperature=22.5,
outside_temperature=15.0,
roof_temperature=18.0
)
API Endpoints
POST /predict- Make temperature predictionsGET /health- Health checkGET /info- API informationPOST /train- Train the model
Configuration
The application uses secrets.ini for sensitive configuration:
[influxdb]
url = http://your-influxdb-server:8086
token = your-influxdb-token
org = your-organization
bucket = your-bucket-name
Important: Never commit secrets.ini to version control. Use secrets.ini.template as a reference.
Development
Installation for Development
# Install in editable mode with dev dependencies
pip install -e .[dev]
# Or install dev tools separately
pip install black isort pylint pytest
Running Tests
# Using pytest directly
python -m pytest tests/ -v
# Or with setuptools
python -m pytest
Code Formatting
This project uses automated PEP8 code formatting with the following tools:
- Black: Code formatter for consistent style
- isort: Import statement organizer
- pylint: Style guide enforcement
Manual Formatting
# Format all code
black src tests
# Check with pylint
pylint src tests
License
MIT License - see the LICENSE file for details.
Format all code using our script
python scripts/format_code.py
Or use tools directly
python -m black src/ python -m isort src/ python -m pylint src/
#### Automatic Formatting
- **Git hooks**: Install with `python scripts/install_hooks.py`
- **VS Code**: Automatic formatting on save (configured in `.vscode/settings.json`)
#### Configuration
Tool configuration is centralized in modern Python standards:
- **pyproject.toml**: Black, isort, and pytest configuration
# (flake8 configuration removed; pylint is now used)
## Node-RED Integration
Import the flow from `node-red-aircon-flow.json` to integrate with Node-RED.
Metadata
Release files for five-tree-wood-ai 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| five_tree_wood_ai-1.0.1.tar.gz | 14.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| five_tree_wood_ai-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.0 kB
Release files / five_tree_wood_ai-1.0.1.tar.gz
| Download URL | five_tree_wood_ai-1.0.1.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f763e8456dd19f61c57f5e0e8c96ff68693ff79024492a53de3c1b47fa26d866
|
|
BLAKE2b-256 checksum How to use checksums |
3ebfa2b27af462651def583a74f322ddb3fd773d65fb468172433bf67d8ed189
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Release files / five_tree_wood_ai-1.0.1-py3-none-any.whl
| Download URL | five_tree_wood_ai-1.0.1-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
692870eac208d92930ff1c3ca6a980abf9b4143094247f38163f57913c1dc275
|
|
BLAKE2b-256 checksum How to use checksums |
70a829d1f472493aec2e5f8654917b0a88f9b0dd1d3d02382de777043208220c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|