Skip to content

Add support for last_changed / last_updated in start_time and improved duration calculation#233

Open
studiobts wants to merge 1 commit intorianadon:mainfrom
studiobts:feature/start-time-last-changed-updated
Open

Add support for last_changed / last_updated in start_time and improved duration calculation#233
studiobts wants to merge 1 commit intorianadon:mainfrom
studiobts:feature/start-time-last-changed-updated

Conversation

@studiobts
Copy link
Copy Markdown

This PR introduces two new features:

Support for last_changed and last_updated properties

start_time can now be set to use the entity’s last_changed or last_updated directly.

Example:

start_time:  
  last_changed: true

Automatic duration calculation

When both start_time and remain_time are available, the card now computes the duration automatically.

The calculation has a margin of error of about one second due to approximation, but it is sufficient for most use cases.

Use case:

I manage several electric valves (switches) that expose only the remaining time before they close.
Thanks to this change, I no longer need to create helper entities. I can simply use the last_changed timestamp of the switch as the start_time, while relying on the existing remain_time attribute to infer the total duration.

…d calculation of duration with start_time and remain_time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant