-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Badges - Show timestamp the same way as timer #21298
Conversation
WalkthroughThe changes to the Changes
Sequence Diagram(s)sequenceDiagram
participant HaStateLabelBadge
participant Sensor
participant Timer
Note over HaStateLabelBadge: Interval Management Based on Device Class
HaStateLabelBadge ->> Sensor: Check `attributes.device_class`
alt is `SENSOR_DEVICE_CLASS_TIMESTAMP`
HaStateLabelBadge ->> HaStateLabelBadge: calculateTimestampRemaining()
HaStateLabelBadge ->> HaStateLabelBadge: Update State Value, Domain, and Unit
else is Not `SENSOR_DEVICE_CLASS_TIMESTAMP`
HaStateLabelBadge ->> Timer: Handle Timer Normally
HaStateLabelBadge ->> HaStateLabelBadge: Update State Value, Domain, and Unit
end
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
@matthiasdebaat could you please check this? Are PR reviewers not automatically assigned? |
Hi 👋 Also, I'm not sure it makes sense for all timestamps. For moon and sun, the date is always less than 1 day but for some others it can be many days. So, I guess it should be an option, not the default. |
Hi @piitaya , thanks for the info. The new badges looks cool. However, as they look completely different from the current ones, could the current ones be renamed to, let's say, alerts? That way thy could be uses in parallel to the new ones. Tbh, with the red circle, they even look like alerts, and I'm using them as such - to show plants that need watering, batteries that needs replacing, running timers etc. It would also be great if they can be used as cards (=anywhere on dashboard, not just on top). Anyway, whether you decide to completely replace current badges with the new ones, or have them side by side (under different names of course), it can take anywhere between 6 months to infinity :) And in that case, would it be possible to approve this PR, so we have at least something until the new badges arrive? This PR really does change it to better, looking at the before/after screenshots. |
We decided not to keep the old badges around and replace them fully. We are open to adding other types of badges, but they will have to fit in the new design system. It is also possible to create custom badges to keep using the old, or any other, style of badges. |
Proposed change
Badges currently support timer, where it nicely shows timer's icon and remaining time. This change handles sensor with device_class: timestamp the same way - icon with remaining time. That allows you to display remaining time to next sunrise, or next Alexa timer from Alexa Media Player integration (which is timestamp, not timer).
Before:
After:
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed:
Summary by CodeRabbit