Add battery summary card and view strategy to home dashboard#30372
Add battery summary card and view strategy to home dashboard#30372Brookke wants to merge 3 commits intohome-assistant:devfrom
Conversation
| "count_media_playing": "{count} {count, plural,\n one {playing}\n other {playing}\n}" | ||
| "count_media_playing": "{count} {count, plural,\n one {playing}\n other {playing}\n}", | ||
| "count_batteries_low": "{count} {count, plural,\n one {low}\n other {low}\n}", | ||
| "all_batteries_good": "All good" |
There was a problem hiding this comment.
not entirely happy with this wording - open to suggestions
| climate: "deep-orange", | ||
| security: "blue-grey", | ||
| media_players: "blue", | ||
| batteries: "green", |
There was a problem hiding this comment.
right now all these colors are static, wonder if we should consider making it possible to make them dynamic e.g. batteries red if 1 or more batteries are low
MindFreeze
left a comment
There was a problem hiding this comment.
I wonder if this should be a full dashboard like lights. Or part of the Energy dashboard
| const computeBatteryTileCard = ( | ||
| hass: HomeAssistant, | ||
| areaName: string, | ||
| entityId: string | ||
| ): TileCardConfig => { | ||
| const stateObj = hass.states[entityId]; | ||
| const name = computeStateName(stateObj); | ||
| const strippedName = stripPrefixFromEntityName(name, areaName.toLowerCase()); | ||
|
|
||
| return { | ||
| type: "tile", | ||
| entity: entityId, | ||
| name: strippedName, | ||
| }; | ||
| }; |
There was a problem hiding this comment.
computeAreaTileCardConfig does this exactly. It could use this as a base instead so we don't duplicate the logic. Not a blocker but it's opportunity for improvement
There was a problem hiding this comment.
We should not string the name, we should use the device name so we don't repeat battery for every name.
name:
type: deviceAbout stripping the name, there is already a discussion here.
I would prefer to not have this as a requirement for this PR. We can update this view later.
There was a problem hiding this comment.
Will update this now.
Re not stripping the name are you referring to not removing the area prefix?
There was a problem hiding this comment.
Pushed up your suggested change @piitaya
piitaya
left a comment
There was a problem hiding this comment.
Small suggestion about entity naming
| const computeBatteryTileCard = ( | ||
| hass: HomeAssistant, | ||
| areaName: string, | ||
| entityId: string | ||
| ): TileCardConfig => { | ||
| const stateObj = hass.states[entityId]; | ||
| const name = computeStateName(stateObj); | ||
| const strippedName = stripPrefixFromEntityName(name, areaName.toLowerCase()); | ||
|
|
||
| return { | ||
| type: "tile", | ||
| entity: entityId, | ||
| name: strippedName, | ||
| }; | ||
| }; |
There was a problem hiding this comment.
We should not string the name, we should use the device name so we don't repeat battery for every name.
name:
type: deviceAbout stripping the name, there is already a discussion here.
I would prefer to not have this as a requirement for this PR. We can update this view later.
|
I think something like this is very much needed. First though, I think we would need to figure out what kind of dashboard this should be, and whether it should be a subview of the home overview or a full dashboard. I had a similar idea and made a "maintenance" dashboard which contains a batteries view based on the home overview layouts with an additional top section for batteries below a threshold. I made it into a custom dashboard strategy instead of a branch here, mostly due to personal requirements which are unlikely to match the project in it's entirety. This is what I have been tinkering with:
It was mostly coded by an LLM with my guidance and has way more than what we would ever probably want, hence why I made it custom in the first place. I made a few decisions in this custom dashboard like @piitaya's review comment here which made it much nicer to look at (not repeating battery) and added features to the cards (These shouldn't go in the first PR though IMO). There are other decisions I made here, I could probably write these up elsewhere though not to flood this PR (which I am already 😄). The idea here though is a "Maintenance" dashboard might be something we might want to consider, instead of a subview of home. It should still link to it like the energy card does though I don't think that this PR is a bad setup in any way though and it's a foundation we can iteratre on down the line. We could also move the subview to a full dashboard later on, like the media subview will eventually have once we figure out a solution on that. |
|
Hey @timmo001 thanks for taking a look!
More than happy to help this evolve over time based on what home assistants long term plans/philosophy is around when to subview vs full dashboard.
Yes I think this is much needed. Thought I would start with just batteries since its the one I imagine most people need. I think there's other improvements we can make over time too, like a default automation/blueprint (perhaps toggle-able in this screen) to alert users when batteries are low. This is my current dashboard for context.
Perhaps we can open a discussion about the maintenance dashboard and discuss ideas for it, and then refactor this out of the home sub view?
|



Proposed change
Enables users to see at a glance the status of their devices batteries.
It does so by introducing a button in the summaries tab of the overview dashboard, and it introduces a battery strategy that lists all the batteries (that a user hasn't marked as hidden) grouped by area
Screenshots
Type of change
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed:
To help with the load of incoming pull requests: