Skip to content

Measure anything in Home Assistant based on time and conditions.

License

Notifications You must be signed in to change notification settings

kylehakala/ha-measureit

 
 

Repository files navigation

Measure It

MeasureIt can measure all kind of things happening in Home Assistant based on time and templates.

Some examples of use cases:

  • Measure the daily shower duration
  • Measure the number of planes during the night flying over your home (e.g. in combination with this awesome integration.
  • Measure the time your kids are watching tv every day
  • Measure how many times the door opens when the AC is on

Some of the use cases can also be achieved with the history_stats integration, but MeasureIt is much simpler to set up, and can measure only when a template evaluates to true. There are also some similarities with the way the utility_meter is working.

Automated Installation Using HACS

hacs_badge hacs installs

MeasureIt is included the standard HACS repositories.

Install MeasureIt via the standard HACS installation steps:

  • Search for MeasureIt in the Integrations section of HACS,
  • Choose 'MeasureIt' and select the Download button,
  • Restart HomeAssistant to complete the installation.

Configuration

I spent a lot of time on the config flow to make it as convenient as possible, but I will provide some further explanation here.

4f11475e065068a10f4b3ba958ffd2a79d1047a6

  1. In this first screen you can choose WHAT you want to measure. You choose if you want to create a time meter that measure everything time related, or if you want to measure the change of a value of another sensor (e.g. m3 gas consumption).

efd53d1770af2e4f22de8dc98c5b4259ce06bd9b

  1. After clicking next you provide a name for the meter, which will be used for logging and as a prefix for the sensor names. If you choose to measure a source sensor, you can configure it here.

35cdd851781ea60cefe174c30171c3e69d13d7a8

  1. The next screen is the most interesting. Here you configure WHEN your want to measure. First of all a template condition can be provided. E.g.:
{{ is_state('media_player.tv', 'on') and is_state('person.daniel', 'away') }}

You can also select on which days you want to measure (e.g. only during the week) and a time window.

061bfae57ef30b2d736fcf6534fef06b7f19319a

  1. After that you configure which sensor you want to create. A sensor shows the measurement for a certain period. E.g. per day/week/month/year. A value_template can be provided like in other sensor to manipulate the value of the sensor, and the usual classes like the unit_of_measurement, device_class, etc.

Finally, you hit next and the integration will be set up! You will now have your new sensors available. There is also a flow for configuring MeasureIt after it has been set up. You can add/remove sensor or change the main config.

About

Measure anything in Home Assistant based on time and conditions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.5%
  • Shell 1.5%