my question: on the home assistant are the timers, which displayed show a countdown β¦ is it possible to have an integration that shows the time like stopwatch, from start to finish ??
Could be possible, need to check, however Iβm wondering what the use case for this is? You have some end goal in mind?
curiosity killed the cat! :Sorridi: In this bad quarantine period I set up a system with a simple pir sensor to count and time my running laps around the garden β¦ only I miss the stopwatch
In itβs simplest form, this will create notifications of times you pass the PIR (to the microsecond).
trigger:
platform: state
entity_id: binary_sensor.garden_pir
to: 'on'
action:
service: persistent_notification.create
data_template:
message: "{{now()}}"
title: "Lap Timestamp"
To display how long it took to do the lap instead (in seconds, to the nearest 10th of a second):
Automation:
trigger:
platform: state
entity_id: binary_sensor.garden_pir
to: 'on'
action:
- service: input_text.set_value
data_template:
entity_id: input_text.this_time
value: "{{ as_timestamp(now()) }}"
- service: persistent_notification.create
data_template:
message: "{{ (states('input_text.this_time')|float - states('input_text.last_time')|float)|round(1) }}"
title: "Lap Time"
- service: input_text.set_value
data_template:
entity_id: input_text.last_time
value: "{{ states('input_text.this_time')|float }}"
Input Texts:
this_time:
name: This Time
initial: 0
last_time:
name: Last Time
initial: 0
This will miscalculate your first lap time unless you start running just before the PIR trigger area.
If you want to display the lap times in a Lovelace card you can use the custom homefeed card.
Although your question is a old, maybe you or somebody else can find this useful:
https://community.home-assistant.io/t/stopwatch-with-start-stop-resume-lap-and-reset/443994