Skip to main content

Home Assistant adapter for the Ratebook rate engine: tariff pricing, price schedule, and cheapest-charge-window helpers.

Project description

Ratebook for Home Assistant

A Home Assistant custom integration that turns a Ratebook tariff into live electricity-price sensors and a cheapest-charge-window sensor — the price signal that EV chargers, evcc, EMHASS, and HA automations need to answer "what does a kWh cost right now, and when should I charge?"

It is a thin shell over the deterministic ratebook rate engine. The price math lives in the ratebook_ha package (unit-tested without Home Assistant); custom_components/ratebook is the HA binding (config flow, coordinator, sensors).

Entities

  • sensor.ratebook_electricity_price — the current marginal price ($/kWh). Attributes today / tomorrow carry the full hourly price schedule ({start, price} per hour), the shape evcc and price-aware automations consume.
  • sensor.ratebook_cheapest_charge_window — the start time of the cheapest contiguous charge block in the next 24 hours (timestamp). Attributes: end, avg_rate, hours.

Configuration

Add via Settings → Devices & Services → Add Integration → Ratebook. Pick a bundled example tariff (a generic time-of-use or flat residential plan) or paste a Ratebook tariff JSON, then set the charge-window length (hours) and currency.

A ready-made Lovelace dashboard (current price + hourly forecast chart + cheapest-charge-window) is in examples/dashboard.yaml.

Install

The integration is self-contained: the ratebook engine and ratebook_ha adapter are vendored under custom_components/ratebook/vendor/, so it has no PyPI or network dependencies.

Manual copy (works today): copy the custom_components/ratebook directory into your Home Assistant config/custom_components/ directory, restart Home Assistant, then add the integration via Settings → Devices & Services → Add Integration → Ratebook.

HACS: install from the distribution repo cbetz/ratebook-homeassistant — HACS → ⋮ → Custom repositories → add it as an Integration. That repo is a synced mirror of this directory with the root-level custom_components/ layout HACS requires (regenerate it with scripts/sync_dist_repo.sh).

Status: v0. Prices are the tariff's energy marginal price (time-of-use signal); demand charges and tier-vs-baseline position are not modeled — see the engine docs.

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

ratebook_ha-0.1.0.tar.gz (96.5 kB view details)

Uploaded Source

Built Distribution

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

ratebook_ha-0.1.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file ratebook_ha-0.1.0.tar.gz.

File metadata

  • Download URL: ratebook_ha-0.1.0.tar.gz
  • Upload date:
  • Size: 96.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for ratebook_ha-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e434eec11bdf51e72e3f51b0aed9cffcd9ab62174f6e81f91cad68cd99e17715
MD5 bce2acb3860625ffa93d39061cfb53af
BLAKE2b-256 f9c05fb10c7478e6caa36c91db62b70127c80abff0ef8e751db0ccc02de2e663

See more details on using hashes here.

File details

Details for the file ratebook_ha-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ratebook_ha-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 efbf5ece131a6a88a6ad247dde03678a50d54f8da69b0b1756c69b04c7928390
MD5 32c1c4fe36f6aafaff14196ed6ab32e5
BLAKE2b-256 8821b9ba5b62b9b69e47404cc182bd97ed5f6bae275d379b1e6e36acbfd845e5

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