WTH stopwatch or timer helper

Hi,

I’d like to be able to use timers in several situations and it seems like I can only create countdown helpers which doesn’t ‘help’ or work.

Thanks

You means like a referse countdown? So a count up?

3 Likes

Yeah that would work.

1 Like

So I assume you’re trying to time something? You can do it with a timer as long as you have a rough idea of how long it should take.

Like if you know 2 hours is way more time then needed for the task you can do this:

  1. start a timer for 2 hours
  2. pause it when the task is done
  3. 2 hours - time remaining is time of your task

A stopwatch would be better obviously but that could be a workaround.

Out of curiousity, can you describe one of the use cases? I use timers a bunch but I’ve never found a need for a stopwatch in an automation myself.

Second this. I would like to have a “stopwatch” helper, similar to “timer” helper but counting up (without a limit) instead of counting down.

Example use case: count how long I have been sitting on my chair with a chair occupancy sensor. Display that stopwatch value in a dashboard, and trigger some actions when I’m sitting too long.

There seem to be some ways how to hack around this using configuration.yaml: Stopwatch with start/stop/resume, lap and reset

However, this seems like this would be much easier with a “stopwatch” helper.

2 Likes

Third this. Find it very useful.

Example: when I begin preheating my grill/oven I generally start a stopwatch not to loose track of how long it’s on when I’m doing something else. Then I generally reset/restart it when I put something on the grill/oven.

Timer helper already exist, maybe it’s not that difficult to include a stopwatch.

Thanks in advance anyhow!

1 Like

Fourth this: I was also looking for a stopwatch helper to track the time how long my washing machine and tumble dryer is running. These devices are no smart devices and I’m using a zigbee plug with power measurement function and a boolean helper to detect if the device is still running. This works like a charm and I can notify on my mobile phone if the washing machine or tumble dryer is finished. Sometime we have the situation that we want to know how long the device is already running and for this use case I want to create a stopwatch timer. The reason why I cant use a counter is the different programs of these devices. The running time is not always the same. Its simpler to create a stopwatch which will count up with no limit and reset it if its finished or the next run is started.

1 Like

Same for me. I looked for this twice recently. I don’t remember the first, but the most recent was:

I start a timer when I take the dog out as part of our training. Timer/countdown does not do everything we need, as we don’t want to bring the dog in at exactly the same time - in this case it is more helpful to make decisions “on-the-fly” by looking at a running timer, based on the various attributes of sensor.pem884 (joke: I mean, my real-time observations :grinning:).

1 Like

As the author of Stopwatch with start/stop/resume, lap and reset I agree with this, of course.

It was not easy to create a simple stopwatch using the existing elements in HA.

3 Likes

Same for me. I want to restart a stopwatch whenever an automation detects my vacuum as completed a full clean. Then I can know how long it’s been since a full clean.

I know I can do this with date math but that’s just clunky.

2 Likes

Same! A ‘reverse timer’ would be the easiest way to keep track of how long something is active/on.

1 Like

You have a binary_sensor, eg.
binary_sensor.tank_limiter_tank_pump_status, that gives you ‘on’ and ‘off’.
In this case, if a pump is running or not.

Create an input.number helper. f.e input_number.tank_pump_runtime

Then create 2 automations:

automation:
  - id: reset_tank_pump_runtime
    alias: "Reset Tank Pump Runtime on Pump Start"
    trigger:
      - platform: state
        entity_id: binary_sensor.tank_limiter_tank_pump_status
        to: 'on'
    action:
      - service: input_number.set_value
        data:
          entity_id: input_number.tank_pump_runtime
          value: 0
 mode: single

automation:
  - id: tank_pump_runtime
    alias: "Tank Pump Runtime"
    description: "Increase input_number.tank_pump_runtime every second while binary_sensor.tank_limiter_tank_pump_status is 'on'"
    trigger:
      - platform: time_pattern
        seconds: /1
    condition:
      - condition: state
        entity_id: binary_sensor.tank_limiter_tank_pump_status
        state: 'on'
    action:
      - service: input_number.increment
        data:
          entity_id: input_number.tank_pump_runtime
    mode: single

This will give you a counter, which will count up every second of the runtime of this pump. As soon as the pump stops, the last count will stay visible in input_number.tank_pump_runtime.
As soon as the pump restarts, the stopwatch will be set on 0 seconds and the measuring of the runtime will be started again.

YES PLEASE!

Why not enhance the timer for counting upwards, use a config. parameter (up/down)?

4 Likes

Folks, I am in need of a timer that counts up rather than counts down. Trying to track how long my air conditioners (have two) are on each day, But I can think of many other scenarios where a count up timer is needed. Essentially, they all follow in the same path where trying to track something over a period of a day.

So, something exactly like the current count down timer helper, but instead counting up.

Working on a custom sensor which uses the built in timer but subtracts 23:59:00 to gain the amount of time respective device has been on. Works, but doesn’t seem to update as the timer helper is active (counting down from 24:00:00). Will update once timer helper is paused. Not ideal, but works for now.

Many use cases for this - essentially tracking how long something has occurred, or not occurred.

  • Track length air conditioner has been on. But I suppose perhaps someone wants the off time.
  • Track how long I have been away from the house.
  • Track how long I have been on the phone.
  • etc. etc. etc. etc.

Thank you,
Krumpy

History stats sensor. No timers needed.

1 Like

I was thinking the same, track how long my AC was on. I don’t understand how the history stats sensor works for an attribute on my climate device that is not already a sensor?

you might consider the MeasureIt integration:

it could create counters and measures durations