Skip to main content

Home automation monitoring suite for energy (HomeWizard), weather (OpenWeatherMap), and heating (Honeywell Evohome)

Project description

dvm-mesura - Home Automation Monitoring Suite

A comprehensive monitoring solution for home automation systems with energy meter polling, weather data collection, and SQLite storage.

Quick Start

Prerequisites

This project uses uv for dependency management.

# Install dependencies and create virtual environment
uv sync

# Install dependencies and create virtual environment
uv sync

# Run interactive setup to create .env
uv run mesura-all --setup

Configuration

Required .env File

Create a .env file in the monitor directory:

# Evohome Credentials
EVOHOME_EMAIL=your_email@example.com
EVOHOME_PASSWORD=your_password_here

# OpenWeatherMap API
OPENWEATHER_API_KEY=your_api_key_here

API Configuration

Energy Meter: Edit API_URL in src/dvm_mesura/energymeter.py:

API_URL = "http://p1meter-231dbe.local./api/v1/data"

Features and Usage

1. Energy Meter Polling

Continuously polls P1 Energy Meter API and logs data to SQLite and CSV.

Features:

  • Configurable polling intervals (10s to 120m)
  • CSV output with automatic flattening of nested JSON
  • SQLite database for time-series analysis
  • On-screen table display with key metrics
  • Interactive keyboard controls ('L' for header)

Usage:

# Default poll (1 minute)
uv run mesura-energy

2. Weather Data Collection

Fetches weather data from OpenWeatherMap API and correlates with heating data.

Features:

  • OpenWeatherMap API integration
  • CSV and SQLite logging with timestamps
  • Configurable polling intervals
  • Weather condition tracking

Usage:

# Default poll (10 minutes)
uv run mesura-weather

3. Room Temperature Polling

Fetches temperature data from Honeywell Evohome API.

Features:

  • Evohome TCC API integration
  • CSV and SQLite logging for room-level data
  • Standardized CLI arguments

Usage:

# Default poll (5 minutes)
uv run mesura-evohome

Unified vs Separate Databases

By default, all monitors share a single database:

  • sqlite3 data/monitor.db

Alternatively, you can use separate databases per monitor:

uv run mesura-all --separate

Command Line Overrides

All environment variables can be overridden via CLI flags:

  • --weather-key: OpenWeatherMap API Key
  • --evohome-user: Evohome Username
  • --evohome-pass: Evohome Password
  • --lat / --lon: Location coordinates
  • --data-dir: Data storage path

Auxiliary Scripts

mesura-combine-db

If you previously used separate databases or legacy scripts (e.g., weatherdata.db, rooms.db) and wish to migrate this historical data into the unified tracking file, use the utility script:

uv run mesura-combine-db --data-dir data --target-db monitor.db

This script intelligently automatically detects legacy databases matching predefined mappings (e.g., transferring rooms.db:readings into monitor.db:evohome). It inserts data while avoiding duplicate timestamps.

mesura-combine-csv

If you have legacy CSV files (energy.csv, weatherdata.csv, temp.csv, etc.) and want to migrate their data into the unified SQLite database, you can use:

uv run mesura-combine-csv --data-dir data --target-db monitor.db

Similar to the database merging script, it maps these CSVs to the appropriate tables (energy, weather, evohome) and automatically skips duplicate records based on timestamps.

mesura-export-csv

If you want to extract the data stored in the unified SQLite database back into raw CSV format (e.g., for external backups or analysis), you can use the export script. This script reads the tables from monitor.db and overwrites energy.csv, weather.csv, and evohome.csv in the data directory using identical database schemas.

uv run mesura-export-csv --data-dir data --source-db monitor.db

This creates:

  • sqlite3 data/energy.db
  • sqlite3 data/weather.db
  • sqlite3 data/evohome.db

Folder Structure

monitor/
├── pyproject.toml     # Project metadata and dependencies
├── uv.lock           # Frozen dependencies
├── .env               # Environment variables (required)
├── .gitignore         # Git ignore file
├── logs/              # Log directory
├── src/               # Source code
│   └── dvm_mesura/   # Core package
│       ├── energymeter.py
│       ├── openweathermap.py
│       └── evohome.py
├── data/              # Data storage (SQLite & CSV files)
│   ├── energy.db / energy.csv
│   ├── rooms.db / rooms.csv
│   └── weatherdata.db / weatherdata.csv
├── tests/             # Unit tests
└── docs/              # Documentation

Data Flow

graph TD
    A[Monitor Scripts] --> B[CSV Storage]
    A --> C[SQLite Storage]
    B --> D[Historical Analysis]
    C --> E[Grafana / Business Intelligence]

Testing

Run tests using uv:

uv run pytest

Related Projects

  • evohome-async - Async client for Honeywell TCC API
  • SQLite - Relational database
  • Grafana - Visualization platform
  • Home Assistant - Home automation platform

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

dvm_mesura-1.0.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

dvm_mesura-1.0.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file dvm_mesura-1.0.0.tar.gz.

File metadata

  • Download URL: dvm_mesura-1.0.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dvm_mesura-1.0.0.tar.gz
Algorithm Hash digest
SHA256 01dc78fb6aab1a6b23d07460898fe53ddbcceb1540e18b71b3abea1d9606b2ee
MD5 391368d79b7a8368b191839165d13c9d
BLAKE2b-256 706e0c98a25aabe8b6bf1e8b2b49d0f49629223c9de2abccea66d8ac998ef050

See more details on using hashes here.

Provenance

The following attestation bundles were made for dvm_mesura-1.0.0.tar.gz:

Publisher: publish.yaml on divyavanmahajan/monitor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dvm_mesura-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dvm_mesura-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dvm_mesura-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ced44e564ca798a107b130670f5404e84f03fe828a8644945c36a1fc96abbe9
MD5 6bfb5e434074fb83b89738b6fda64b86
BLAKE2b-256 7cb8b9d4156b6420b69f5607a00d17cc40abcf0a6ae357ab7dfc4d7aca9cd2f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for dvm_mesura-1.0.0-py3-none-any.whl:

Publisher: publish.yaml on divyavanmahajan/monitor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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