I’ve been through a bunch of topics and posts (and tests) but I have not seen someone attempt something close enough that I can copy it close enough.
When my dryer switches from idle to drying state, I want to start a “timer” of time elapsed to display in minutes:seconds on my entity card for the timer. I can’t count down because different cycles have different times and its simpler to give the user/me the elapsed time. Bonus would be the ability to resume the timer if the state change is close enough (so if you pause it for 30 seconds to take a single article of clothing out - but start back at zero the next time a load is started.
I’ve tried history_stats and I got this working but it doesn’t reset to zero its cumulative (which I understand is the point of that function) and I have to adjust the templating to really get it to display in mintues:seconds. Next I tried timer.start function but it also counted down, so i found someone counting up with a step calculation separate automation but It wasn’t clear to me how to translate it. Thanks for any guidance.
You could record the time (as a timestamp) when it gets to drying, and then create a template sensor that calculates ‘(as_timestamp(now()) - as_timestamp(recorded_time|int))| timestamp_custom("%H:%M")’
That would show time since the drying started.
How you record is could vary, but I’ve just published it to an MQTT topic, and then subscribed a sensor to that topic to read the value back.
I wanted to have some indication how long ago the last sensor’s reading arrived and ended up with a template sensor that I update every 5 seconds via trigger: time_pattern because you cannot use timer.remaining for that.
Would love to see a better solution.
I think just minutes would be fine could you post an example of how you did that? I thought a minutes:seconds would look more professional, but technically it’s only counting minutes to give a general idea to the person who started the laundry if it might be done soon.
It would be helpful to know how to get/show seconds, but this process is typically 44 min (and not always known if its 34 - 50 min) (some cycles are auto-dry and you don’t have an exact idea) so a margin of error of 60 seconds will not matter.
it’s not about counting but about how often your counter increments.
if you increment it every second like
- seconds: /1
you’ll have seconds in your counter.
then you will probably need a template sensor that displays it in minutes:seconds and that’s exactly where you’ll need your tempting skills - have a look here and here.