Could you elaborate a bit more on your use case and the issue?
By the way, it updates every minute + immediately when a condition becomes true/false.
I have a binary sensor āBrühvorgang aktivā which switches to āonā once the brewing process starts. Iād like to create a shot timer, that basically counts up the seconds for this process and display it in a browser-mod popup (i have a tablet positioned right next to the coffee machine, running HA + wallpanel).
After the brewing process is stopped, I would want to reset the timer to 0. Itās obviously important to not have a big delay for when the timer starts but also have the ability to show the timer itself on a realtime basis to make this use case work.
This thread https://community.home-assistant.io/t/stopwatch-with-start-stop-resume-lap-and-reset/443994?u=juergenjw might help.
MeasureIt it not really made for this usecase with live counting. It might be as simple as changing the update interval, but Iām not sure of the side effects. Better go with a regular timer like @juergenjw mentioned.
Thanks for pointing me to that other thread! Havenāt found that one before, might consider implementing that.
Iām still wondering how to edit the template for a MeasureIt counter
Someone else raised an issue on Github for this topic recently:
It would be great to be able to edit the template not only for timers but as well for counters.
Iām just not sure what it would mean to edit a sensor template. You suddenly measure different things and the history of your sensor doesnāt make sense anymore. Why wouldnāt you just create a new one then?
You let me guess without providing the logs, but I think the reason is that timestamp_custom outputs a string that cannot be interpreted anymore by the device class and UoM.
@danieldotnl, thanks a lot for picking this up ![]()
for me there are several reasons, e.g.
- for a long time, I was identifying runs of my (old) dishwasher based on its power consumption profile, now I got a new dishwasher which provides an API that allows to identify the end of a run by a sensor.
- for quite some time I used a simple door-sensor to count openings of my physical mailbox, now I want to use a combination of sensors to be more sure that mail has arrived. Hence I want to change the template of the MeasureIT sensor to consider the combined sensors.
- I am counting āsunny daysā based on a condition taking illuminance into consideration, but now I want to change the lux threshold.
Of course, I could create new MeasureIT sensors, use the calibration service to set the former values, ⦠and I would loose history
For the future I could consider creating a template sensor which I pass to MeasureIT as the template condition, and if I want to adjust I would re-configure the template sensor.
Since I am a big fan of MeasureIt (and advertising it here and there) I was hoping for the option to edit the template of a MeasureIT counter.
Hi guys,
Iāve been trying to figure something out all day and itās doing my head in. I hope someone can help.
Yes Iām a noob!
I have 2 sensors already set up, one to measure anything below 4
{{ states(āsensor.sophia11032014_glucose_valueā) | float < 4 }}
And another to select anything above 7
{{ states(āsensor.sophia11032014_glucose_valueā) | float > 7 }}
What I canāt figure out is how to select all values between 4 and 7
Is anyone able to help me please before I go completely crazy ![]()
try it this solution in your templet editor first
Hereās the simplest Jinja2 template that will return true when the glucose value is between 4 and 7 (inclusive), and false otherwise:
{{ 4 <= states('sensor.sophia11032014_glucose_value') | float <= 7 }}
Usage examples:
- As a binary sensor:
binary_sensor:
- platform: template
sensors:
glucose_in_range:
value_template: "{{ 4 <= states('sensor.sophia11032014_glucose_value') | float <= 7 }}"
- In an automation condition:
condition: "{{ 4 <= states('sensor.sophia11032014_glucose_value') | float <= 7 }}"
- As a template sensor state:
template:
- sensor:
- name: "Glucose In Normal Range"
state: "{{ 4 <= states('sensor.sophia11032014_glucose_value') | float <= 7 }}"
This template will evaluate to true when the value is ā„4 and ā¤7, and false for any other values.
You are a star!
I could kiss you right nowš
condition: ā{{ 4 <= states(āsensor.sophia11032014_glucose_valueā) | float <= 7 }}ā
This is exactly what I was looking for.
Thank you so much steve
Hi there!
This looks like itās exactly what I need, but Iām a bit lost on the value template part.
I am trying to make a counter that logs duration (hours) that the hot water system is on. I have a sensor that measures it the power draw of the hot water circuit in W. (When on, itās typically around 1700W or so).
Iāve set up MeasureIt to read time, with the condition as:
{{ states('sensor.ctmeter_ch6_hws_power') | float(0) > 1000 }}
Sensor
name: hours
value template: ???
unit of measurement: h
device class: duration
state class: total
The main question is - what is the value template? I didnāt spot any examples in this thread, and searching HA comes up with no results.
The value_template configuration variable is optional and is used to modify the output of sensor.
In your case, the value_template will be a mathematical expression to convert the number of seconds returned by the Time option into you desired output of hours.
{{ value / 3600 }}
Thanks for that. It really didnāt seem intuitive.
It turns out that I didnāt need to set a value template, and my hot water sensor is working as it should. I think thatās because I set measure it to report hours.
Iām now trying to figure out how to get a daily maximum that can be its own history graph, summarising each day in to n hours of use.
At present, the measureIt counter will tell me the current amount of hours (determined by when the HWS is drawing 1000W or more). It would be useful to see the total hours per day plotted as a bar chart over time.
And whoever said that AI is poisoned by a load of old answers and broken ādoes this workā type scenarios because it puts out some crazy suggestions.



