Skip to content

Conversation

timmo001
Copy link
Member

@timmo001 timmo001 commented Aug 15, 2025

Breaking change

Proposed change

  • Change clock style from digital to analog
  • Provides dedicated options to add border and change amount of ticks
  • Supports seconds
  • Uses standard theme variables
  • Adds or removes default analog options when switching styles
  • Supports 3 clock sizes based on original options. Ensures card minimums are set for this
screenrecording-2025-08-15_14-53-47.mp4
image image

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

clock_style: analog
clock_size: large
show_seconds: true
type: clock
analog_options:
  border: false
  ticks: minute

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@timmo001 timmo001 marked this pull request as ready for review August 15, 2025 14:26
@MindFreeze MindFreeze requested a review from Copilot August 20, 2025 09:42
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds analog clock style support to the existing clock card, providing users with both digital and analog visual options. The implementation maintains all existing functionality while introducing comprehensive customization options for the analog style.

Key changes:

  • Adds analog clock style option with visual customization controls
  • Refactors existing digital clock into separate component for better maintainability
  • Updates grid layout handling to accommodate analog clock sizing requirements

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/translations/en.json Adds translation keys for clock style selection and analog-specific options
src/panels/lovelace/editor/config-elements/hui-clock-card-editor.ts Extends editor with clock style selector and conditional analog options form
src/panels/lovelace/cards/types.ts Updates type definitions to include analog clock configuration
src/panels/lovelace/cards/hui-clock-card.ts Refactors main card to delegate rendering to style-specific components
src/panels/lovelace/cards/clock/hui-clock-card-digital.ts Extracts digital clock implementation into dedicated component
src/panels/lovelace/cards/clock/hui-clock-card-analog.ts Implements new analog clock component with customizable features

@timmo001 timmo001 force-pushed the feature/card-clock-style-analog branch from da1eb5e to d429d17 Compare August 20, 2025 14:51
@bramkragten bramkragten added the Needs UX Pull requests requiring a review from the Home Assistant design team label Aug 25, 2025
@bramkragten
Copy link
Member

bramkragten commented Aug 25, 2025

I wonder if this should just be a seperate card instead of the same card as the digital clock, as it also has its own options and is code split anyway.

locale = { ...locale, time_format: this.config.time_format };
}

this._dateTimeFormat = new Intl.DateTimeFormat(this.hass.locale.language, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care out the format if we are going to show it analog anyway? I think we should always use the same rules here to make it easier to for ourselves?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only for time zone, I've removed the additional options which were leftover from the digital version

@timmo001
Copy link
Member Author

After discussion, we've decided to keep this on the "clock" card, but move the conditionally rendered options to the root of the editor and hide the unused options for analog dependent on the style

Also for the future, we may want to allow numbers instead of ticks and additional theming of the clock hands (watch faces similar to watches etc.)

@timmo001 timmo001 force-pushed the feature/card-clock-style-analog branch from cf8061a to 077c4de Compare August 26, 2025 08:17
@timmo001 timmo001 marked this pull request as draft August 26, 2025 08:17
@timmo001 timmo001 marked this pull request as ready for review August 26, 2025 09:59
const second = secondStr ? parseInt(secondStr, 10) : 0;

// Analog face: 12-hour based rotation
const hourOn12 = hour % 12;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed now we dont have 24 hour style anymore I think?

timmo001 and others added 3 commits August 26, 2025 12:51
@timmo001 timmo001 merged commit edaaa00 into home-assistant:dev Aug 27, 2025
15 checks passed
@timmo001 timmo001 deleted the feature/card-clock-style-analog branch August 27, 2025 09:15
@timmo001 timmo001 added the Noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) label Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Needs UX Pull requests requiring a review from the Home Assistant design team Noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants