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

mesura-show

To quickly inspect the latest data in the database, you can use the mesura-show command. It displays the most recent rows for each table (energy, weather, evohome) in CSV format. By default, it shows the last 5 rows.

# Show the last 5 rows of all tables
uv run mesura-show

# Show the last 10 rows
uv run mesura-show -n 10

# Show a specific table
uv run mesura-show --table energy

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.1.2.tar.gz (15.5 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.1.2-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dvm_mesura-1.1.2.tar.gz
  • Upload date:
  • Size: 15.5 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.1.2.tar.gz
Algorithm Hash digest
SHA256 07110d82d3b22a303c247dfd0e601ddad64fd10d5bc701234381b38bafbc2a63
MD5 e65eb6b9b7243fd7e217d3735a70d41a
BLAKE2b-256 aeaf65a3e8548886daab0726d3323647781196757dcd76d3d8f995701ad17255

See more details on using hashes here.

Provenance

The following attestation bundles were made for dvm_mesura-1.1.2.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.1.2-py3-none-any.whl.

File metadata

  • Download URL: dvm_mesura-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 25.7 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.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 714a0c038b9894f81302b9377b138738b78945ab4de5c78b89c4b89296c31a8e
MD5 eacc9520f2279ef6b0a2f171b53a4d8e
BLAKE2b-256 f242a1d869f204ba3bd0f7596ca696d63c8dc075ae0e4a8b1379369cb76eaf7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for dvm_mesura-1.1.2-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