Skip to main content

Five Tree Wood AI - AI utilities for home assistant

Project description

Five Tree Wood AI

Supports aarch64 Architecture Supports amd64 Architecture Supports armhf Architecture Supports armv7 Architecture Supports i386 Architecture

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)

  1. In Home Assistant, go to SupervisorAdd-on Store
  2. Click the menu → Repositories
  3. Add this repository URL: https://github.com/Swamp-Ig/five-tree-wood-ai
  4. Find "Five Tree Wood AI" in the add-on store and click Install
  5. Configure the add-on (see Configuration section)
  6. Start the add-on

Method 2: Manual Installation

  1. Clone this repository to your Home Assistant addons folder
  2. Restart Home Assistant Supervisor
  3. 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 predictions
  • GET /health - Health check
  • GET /info - API information
  • POST /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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

five_tree_wood_ai-1.0.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

five_tree_wood_ai-1.0.1-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file five_tree_wood_ai-1.0.1.tar.gz.

File metadata

  • Download URL: five_tree_wood_ai-1.0.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for five_tree_wood_ai-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f763e8456dd19f61c57f5e0e8c96ff68693ff79024492a53de3c1b47fa26d866
MD5 0febfff8679d4601682fb6b73007cd3b
BLAKE2b-256 3ebfa2b27af462651def583a74f322ddb3fd773d65fb468172433bf67d8ed189

See more details on using hashes here.

File details

Details for the file five_tree_wood_ai-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for five_tree_wood_ai-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 692870eac208d92930ff1c3ca6a980abf9b4143094247f38163f57913c1dc275
MD5 5264fcb99208cd2fb458f5f7eb6461b5
BLAKE2b-256 70a829d1f472493aec2e5f8654917b0a88f9b0dd1d3d02382de777043208220c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page