Skip to main content

Standalone history browser for Home Assistant

Project description

HiBro: a standalone history browser for Home Assistant

HiBro is a standalone history browser for Home Assistant based on Plotly Dash. It displays graphs based on a history database and allows to specify the graphs to be shown with a YAML cofiguration file similar in format to Home Assistant configuration files.

In addition to plain time series graphs, it also allows to apply basic statistical operations to the time series, like mean (or max or min) values in specified time intervals (e.g. hourly or daily). Box plots showing statistics about the value of a sensor and pie charts that can be used to monitor energy consumption, for instance, are also supported.

Further graph types are straightforward to add using Dash & Plotly. Pull requests are welcome.

Installation

python3 -m pip install --user hibro

Quick start

Generate a file named hibro-config.yaml and fill it following the instructions below. Minimal example:

db_url: "sqlite:////path/to/home-assistant_v2.db"
elements:
  - type: line
    entities:
      - sensor.some_entity

Then run hibro (or python3 -m hibro) and access the dashboard at http://127.0.0.1:8456.

Configuration

A full configuration file looks like:

db_url: ...
title: ...
elements:
  - type: ...
    entities:
      - ...
      ...
  - type: ...
    entities:
      - ...
      ...
  ...

Top-level keys:

  • db_url: (string, required) A database URI. See the Home Assistant recorder docs for details.
  • title: (string, optional) A title overriding the default one.
  • elements: (list, required) The list of graphs.

There are currently three valid values for "type": line, box, or pie.

The items in the entity lists can either be strings or mappings to specify further options:

entities:
  - sensor.my_sensor
  - entity: sensor.my_sensor
    resample: D

Like in this example, you can mix both styles in a single list.

Line charts

A line chart (type: line) by default (when given a list of entities) shows a line chart of the entities' states for the past 24 hours. This can be customized by specifying the list items as mappings rather than strings with the following possible keys:

  • duration: (optional, mapping) Specify the time interval (from now to the past) for which to display data. Defaults to 24 hours. values have to be specified by a mapping, e.g.:
duration:
  hours: 3

(also days or minutes work).

  • attribute: (optional, string) Specify a numerical attribute to plot instead of the state itself.
  • resample: (optional, string) Specify a time interval to resample the data to. This is useful for instance when looking at finely grained data (seconds or minutes) over a long time period (days). The strings must be in the format of pandas time offset strings, see the documentation for details. Examples: D for daily, H for hourly.
  • aggregate: (optional, string) When resampling data, this is the aggregate function applied to each interval. Defaults to mean, i.e. the data will be averaged over the interval. Possible other values include median, min or max (with obvious meanings) or ptp ("peak to peak", the difference between maximum and minimum).

Full example:

- type: line
  entities:
    - entity: climate.living_room
      attribute: current_temperature
      resample: '15min'
      aggregate: max
      duration:
        hours: 12
    - sensor.outdoor_temperature

Box plots

Box plots (type: box) show the median and quartiles of numerical sensor data for the entire time period. It supports the attribute and duration arguments just as line charts, but resampling and aggregation does not make sense.

Full example:

- type: box
  entities:
    - entity: climate.living_room
      attribute: current_temperature
      duration:
        hours: 12
    - sensor.outdoor_temperature

Pie charts

Pie charts (type: pie) show aggregated values of numerical sensors for the entire time period as pieces of a pie. This makes sense especially for energy sensors to display the fraction of total energy consumed by a device. Pie charts also have attribute and duration options (but no resample option). The aggregate option in this case refers to the function applied over the entire time period. By default, this is ptp (peak to peak), i.e. the difference between the minimum and maximum value. This makes sense for energy sensors where it returns the total energy consumed.

Full example:

- type: pie
  entities:
    - entity: sensor.some_device
      attribute: power_consumption
      duration:
        hours: 12
      aggregate: ptp
    - sensor.some_device_energy

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

hibro-0.2.1.tar.gz (10.1 kB view details)

Uploaded Source

File details

Details for the file hibro-0.2.1.tar.gz.

File metadata

  • Download URL: hibro-0.2.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for hibro-0.2.1.tar.gz
Algorithm Hash digest
SHA256 fa22869bbb3db2ffd937bbc5505b981b4a8ab0c3f96e1c98e113890ea49fef58
MD5 ae5595d3279eaa2a5d2e775d3c76fda0
BLAKE2b-256 3509d9fafbafe4cea8073895aa4e78343662b38017646ca1c35425df3d62a87f

See more details on using hashes here.

Supported by

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