Skip to content

VitisEK/barometric-pressure-card

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hacs_badge

Barometric Pressure Card (Home Assistant)

A Lovelace custom card that displays barometric pressure with an optional dual-scale gauge (hPa + inHg), trend, low/normal/high bands, and a simple forecast (Zambretti-inspired). Includes i18n (EN/CZ) and a built-in GUI editor.

Barometric Pressure Card

Features

  • Pressure value (display unit can be auto, hPa, kPa, mmHg, inHg)
  • Optional MSL normalization (sea-level pressure) using HA elevation, optionally temperature-adjusted
  • Trend: rising / falling / steady (uses entity attribute if available, otherwise local delta tracking)
  • Level classification: low / normal / high based on configurable thresholds
  • Gauge:
    • dual mode (outer inHg + inner hPa) with dual sync (inHg ring derived from hPa min/max)
    • hPa-only or inHg-only modes
    • smart outer label placement and optional range arcs
  • Forecast chip:
    • zambretti (simplified) or simple heuristic
    • optional wind direction influence when wind_entity is provided

Installation

HACS (recommended)

  1. HACS → FrontendCustom repositories
  2. Add your GitHub repo URL and select Lovelace
  3. Install Barometric Pressure Card
  4. Reload resources (or restart Home Assistant)

Add the resource:

  • Settings → Dashboards → Resources → Add resource
  • URL: /hacsfiles/barometric-pressure-card/barometric-pressure-card.js
  • Type: JavaScript Module

Manual

  1. Copy barometric-pressure-card.js to:
    • /config/www/barometric-pressure-card.js
  2. Add the resource:
  • URL: /local/barometric-pressure-card.js
  • Type: JavaScript Module

Usage

Minimal

type: custom:barometric-pressure-card
entity: sensor.pressure

Typical example (dual gauge + forecast)

type: custom:barometric-pressure-card
name: Barometric Pressure
entity: sensor.outdoor_pressure
unit: auto
decimals: 1

normalize_msl: true
temperature_entity: sensor.outdoor_temperature

gauge_scale: dual
dual_sync: true

low_hpa: 1005
high_hpa: 1025

forecast_mode: zambretti
wind_entity: sensor.wind_bearing
hemisphere: north
season_mode: auto

Configuration

Core

Key Type Default Description
entity string required Pressure sensor entity.
name string Card title (falls back to entity friendly name).
unit string auto Display unit: auto, hPa, kPa, mmHg, inHg.
decimals number 1 Decimal places for the displayed value.
lang string auto auto, cs, en.
show_trend boolean true Show trend chip.
trend_threshold_hpa number 0.4 Threshold used for derived trend when no trend attribute is present.

MSL normalization

Key Type Default Description
normalize_msl boolean true Convert station pressure to sea-level pressure using HA elevation.
temperature_entity string Optional temperature entity for temperature-adjusted SLP.

Thresholds (low/high level)

You can define thresholds either in hPa or inHg.

Key Type Default Description
threshold_unit string auto auto, hpa, inhg.
low_hpa / high_hpa number 1005 / 1025 Thresholds in hPa (MSL).
low_inhg / high_inhg number Thresholds in inHg (MSL). If used, they are converted to hPa internally.
show_level boolean true Show level chip (low/normal/high).

Gauge

Key Type Default Description
show_gauge boolean true Show gauge.
gauge_scale string dual dual, hpa, inhg.
dual_sync boolean true In dual mode, derive inHg ring min/max from hPa min/max.
gauge_start_deg number -120 Gauge start angle.
gauge_sweep_deg number 240 Gauge sweep angle.
gauge_width / gauge_height number 320 / 210 Rendered SVG size.
gauge_offset_x / gauge_offset_y number 0 / 0 Shift gauge inside the SVG canvas.
inhg_label_offset / hpa_label_offset number 12 / 12 Label offsets for outer/inner scales.
scale_hpa_min / scale_hpa_max number 980 / 1040 hPa mapping range.
scale_hpa_major / scale_hpa_minor number 10 / 2 hPa major/minor step.
scale_inhg_min / scale_inhg_max number 28 / 31 inHg mapping range (used when not dual-synced).
scale_inhg_major / scale_inhg_minor number 0.5 / 0.1 inHg major/minor step.
contrast_mode string auto auto, dark, light for ticks/needle contrast.
show_range_arcs boolean true Show LOW/NORMAL/HIGH arcs.
range_arc_width number 8 Arc thickness.

Forecast

Key Type Default Description
show_forecast boolean true Show forecast chip.
forecast_mode string zambretti zambretti or simple.
wind_entity string Optional wind direction entity (affects zambretti category).
hemisphere string north north or south.
season_mode string auto auto, summer, winter.

Notes

  • In dual gauge mode, the needle mapping is anchored to hPa so both rings align perfectly.
  • If the pressure sensor does not provide a trend attribute, the card stores the last pressure in localStorage and computes trend from the delta.

Changelog

  • v1.9.1
    • Fix: template handler typo
    • Dual mode: robust needle mapping anchored to hPa
    • Thresholds: definable in hPa or inHg, plus threshold_unit
    • Improved outer labels and dual ring sync

About

Barometric pressure card for Home Assistant

Topics

Resources

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors