I’m not sure that is a good use case for this integration. If you would have a total production sensor, you could use that one as a source, and measure per day/week/month. Sound like you are now trying to create that total number with measureit, but I guess wattage is all over the place with the sun coming and going and clouds in front of it.
I can only think of negative values if you start measuring while your panels are producing and after a while production decreases. MeasureIt would measure the difference between those moments. But once your reset at midnight, this shouldn’t occur anymore.
Can someone provide a sample of using it for counting times sensor is in on? i.e number of times a door is opened or lights are switched on. I am having problems getting it to count. thanks
It took some time but here you have a brand new MeasureIt. And I heard you! It contains:
a counter sensor . Count each time a template evaluates to True! E.g. {{ is_state('binary_sensor.front_door', 'on') }}
a reset service that can reset any sensor, now or at a future datetime
sensors that do not reset (automatically, but you can reset them with the reset service)
source sensors now update immediately when the source entity updates
the issues with the sensors sometimes resetting at UTC midnight has been fixed.
fixed issue with device_class and state_class that did not respect what you configured.
lots of automated tests
I think all of this deserves a version jump to 0.5.x!
A lot changed and have been rewritten but I tried to support your existing configurations as good as possible! If you still do encounter issues with those, please delete it a create a new config entry.
If you have sensors that were affected by the UTC reset time bug, you can set the correct datetime with the new reset service.
Documentation has been updated as well, so please re-read the README on github. (or the updated first post of this thread)
Last but not least, please share your use cases in this thread, so I can summarize them every now and then, in the first post to inspire other people!
You can now choose a sensor that will reset after each measuring session. E.g. when you want to measure some device that is running multiple times per day.
An issue with daylight savings time is fixed which caused the monthly pattern to finish 1 hour too early. Please fix your existing configurations manually with the reset service.
Thank you @misa1515 for providing Slovakian translations!
Changes
Fix issue with determining end of pattern with dst and add tests @danieldotnl (#99)
Implement sensor reset functionality after each measuring session. @danieldotnl (#100)
Add source entity attribute on source sensors @danieldotnl (#92)
First of all, Your unit_of_measurement should be s. Then, together with the device_class: duration, Home Assistant will automatically format the duration, usually in HH:MM:SS.
If that’s not desired, please check the FAQ in the readme.
Yes, I believe it does! I’m hoping for some more configuration options in the frontend soon, as I feel formatting durations is quite messy at the moment. The number of questions about it on the forum is significant.
The best thing in my opinion is to format in a frontend card. E.g. I’m using a mushroom chip template card to format tv time:
Sure: {{ states('sensor.psa_charge_rate') | float > 3 }}
Note that if this is the template for a counter sensor, it will only count when the value becomes higher than 3 and not after that when the value changes but is still higher than 3.
The template should first become False before it will be counted again.
Is there a built-in way to measure cycle times with this integration? Some duration examples:
refrigerator compressor
clothes dryer
irrigation zone
septic/sump pump
I think you could do it with a regular duration sensor that resets each time the monitored sensor switches from off to on, but I’m wondering if there’s a simpler way.
In the latest release you can choose for a reset period ‘after each session’. So it would reset each time the conditions become false. Would that be what you are looking for?
For source meter configurations: source entities that reset can now still be tracked if they have state_class total_increasing.
As an example: we can now measure the precipitation per hour/day/week/month etc. based on a source sensor that resets every day.
Changes
Support source entities that reset with state class total_increasing @danieldotnl (#104)
Make sure we are compatible with HA core change regarding event filters in 2024.4 @danieldotnl (#109)
till now I was using history_stats which has some drawbacks especially in regards to the recorder.
Question for you @danieldotnl: how could I initialize/set a measureIt counter with the value I’m currently having?
e.g. I counted the number of coffees my coffee machine has brewed, and each 400 cups I need to perform a maintenance. If my new coffee counter (based on measureIt) would start at 0 I would miss the right time for the maintenance.
till now I was using history_stats which has some drawbacks especially in regards to the recorder.
Happy to hear that, and spread the word!
Question for you @danieldotnl: how could I initialize/set a measureIt counter with the value I’m currently having?
That’s not yet possible. Could you please create a feature request at github? Thanks!
What you could do for now is to add the current number of cups in the value_template of the sensor, like: (value | int) + 102.
Once you clean it and reset the sensor, you should then also update the value_template.