MeasureIt: Measure all you need based on time and templates!

To achieve this, you don’t need the template sensor but instead create 3 measureit time configurations.
You would name the first one ‘Glucose low’ and use this template as a condition:

 {{ states('sensor.emily_glucose_value') | float < 5.5 }}

Then create similar configs for InRange and High.

This is a great measuring tool!
But can we nest/combine (multiple) conditions?

I can not make it work for 2 conditions:

attr(‘media_player.vsx933’, ‘source’ == ‘Video 2’)
and
attr(‘media_player.vuduo2’, ‘source’ == ‘That Channel’)
Only when both are met the counter may get activated.

How can I make this work?

Yes you can, I suggest to test your templates in the Template under Developer Tools.
I guess it should be something like this:

{{ state_attr('media_player.vsx933', 'source') == 'Video 2' and state_attr('media_player.vuduo2', 'source') == 'That Channel' }}
2 Likes

Great!

I think the quotes did not play nice on me, it is working now.

Thank you.

:santa: Santa is coming :christmas_tree:and 2025 :partying_face:

@danieldotnl
Many thanks for your handy MeasureIt integration, and for the support throughout the year.
Merry Christmas and all the best for the New Year!

2 Likes

@danieldotnl Hi, many thanks for providing this integration! I have been using it for about 9 months now to track TV time. I have following sensors for TV time:
Day, Week, Month, Year.
At first all was working as expected, and HA was displaying sensors in automatic format (seconds, then minutes, then hours, …) but since november or so, HA now always displays the time in seconds for all sensors…
I did not configure a specific format for the sensors.
Any idea?
Thanks in advance! :slight_smile:

Late reaction but I appreciate it, @nicknol!

Last MeasureIt release was from October and didn’t change anything regarding the formatting of the sensors. I’m also not aware of HA core changes influencing this.
I actually measure the TV time myself as well and format it in the frontend like this in a mushroom chip:

- type: custom:mushroom-chips-card
    chips:
      - type: template
        icon: mdi:eye-circle
        content: >-
          Today - {{ '%2d:%02d' % ((states('sensor.tvtime_day')|int/3600)|int,
          (states('sensor.tvtime_day')|int%3600)/60) }} uur
      - type: template
        icon: mdi:eye-circle
        content: >-
          Week - {{ '%2d:%02d' % ((states('sensor.tvtime_week')|int/3600)|int,
          (states('sensor.tvtime_week')|int%3600)/60) }} uur
1 Like

Hi @danieldotnl

Thank you for your integration !
I just wanted to report a “small” issue : currently, the version “0.8.2” is available from HACS, but when installed, when viewing the integration, it states “0.5.0”
→ in fact, I think the “manifest.json” file update has been omitted

Cheers

1 Like

Hello,

I’m trying to measure my sleeping time.
So I need a time period that crosses midnight and it’s configured like mentioned in documentation. (from time later than till time)

Unfortunale time is still resetting at midnight.
What I’ doing wrong?

Thanks.

grafik

Solid 8 hours of sleep! :slight_smile:

The time interval you set is for determining when MeasureIt will measure. E.g. if you go to sleep between 10-14, it will not be counted.

What you need is to change the reset time (in the next config screen). You picked there ‘day’ which always resets at midnight. If you provide their a cron value, you can reset it at any time you want. E.g. this will reset daily at midday: 0 12 * * *

Thank you very much!
The cron did the trick, I did not get that right at the beginning.

Now it’s working as it should. Great!

1 Like

Solved somehow ?
I’m in the same situation, I have to change the sensor that starts the counter

Is it possible to change the configuration of a sensor ?
I changed a device, which started a counter, so now obviously the timer no longer starts. I can’t find a way to edit the configuration so that it listens to the new device for the timer to start

@bycippy @danieldotnl
Unfortunately, no solution/response so far.

1 Like

hello, it’s actually very simple.
to see the code, I changed my browser
1 measureIt integration
2 configure (the sensor you want to modify)
3 edit main config
4 change the string

@bycippy
did you do it for a counter or for a time measurement?

time measurement

danieldotnlDaniel

Oct 2024

Sorry forgot about this post. I think I understand what you mean. Probably best to call it ‘before next session’, right? But I’m not so sure if it won’t be confusing to the average user. Because actually the current state will then contain info about the last session which is finished, so not current… Hmm I will think about it.

How you name it doesn’t really matter. It shall just work.

Time meters measure in seconds but the sensors update every minute.

Any chance to have it update more frequently? (e. g. through config) I wanted to build a shot-timer for my coffee machine but not possible with that limitation.