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.
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.
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.
- 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).
- 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.
- 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.
- 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 theunit_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.