Skip to content
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

add icon to UISensor (perhaps others soon) #133

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Habbie
Copy link
Member

@Habbie Habbie commented Oct 21, 2024

this is draft pending #130

@Habbie
Copy link
Member Author

Habbie commented Nov 16, 2024

it turns out we'll have to learn about config/entity_registry/list_for_display and event_registry_updated events to get icons for most entities

@Habbie
Copy link
Member Author

Habbie commented Nov 19, 2024

it turns out we'll have to learn about config/entity_registry/list_for_display and event_registry_updated events to get icons for most entities

I was wrong, it's config/entity_registry/list_for_display followed by frontend/get_icons '{"category":"entity","integration":"sun"}' and frontend/get_icons '{"category":"entity","integration":"waze_travel_time"}' etc.

@Habbie
Copy link
Member Author

Habbie commented Dec 6, 2024

image

my dev/test dashboard, pretty nice

@Habbie
Copy link
Member Author

Habbie commented Dec 6, 2024

image

a dashboard I actually use. The first four items (Gad ...) were expected - those are SVG icons instead of mdi:. The others are a puzzle to solve.

@Habbie
Copy link
Member Author

Habbie commented Dec 6, 2024

I see HA requesting frontend/get_icons '{"category":"entity_component"}' too (right now we are only asking for category=entity) but this does not appear to be the whole story.

@Habbie
Copy link
Member Author

Habbie commented Dec 12, 2024

I see HA requesting frontend/get_icons '{"category":"entity_component"}' too (right now we are only asking for category=entity) but this does not appear to be the whole story.

for the Smart plug entries, they are called sensor.[whatever] and have device_class: power. Then it turns out .result.resources.sensor.power.default is mdi:flash.

For Print Estimated Finish Time, which is sensor.octoprint_estimated_finish_time with device_class: timestamp, .result.resources.sensor.timestamp.default is mdi:clock.

Then, BoomBoom End Time (sensor.a1_[whatever]), with no device_class, .result.resources.sensor._.default is mdi:eye.

All of these observations match what I see in HAweb.

@Habbie
Copy link
Member Author

Habbie commented Dec 12, 2024

So I think the first level key inside .result.resources is the domain, and the second is the device class.

@Habbie
Copy link
Member Author

Habbie commented Dec 12, 2024

image

with this commit, everything has the right icon (I put the Waze icon in there explicitly by setting an icon in HA, to test that variation) except the SVG ones, which are now explicitly rendered as border-none-variant.

@Habbie Habbie marked this pull request as ready for review December 12, 2024 19:52
@Habbie Habbie requested a review from cyclops1982 December 12, 2024 19:53
@Habbie
Copy link
Member Author

Habbie commented Dec 12, 2024

a downside to this PR I'm aware of: it turns more things into scrolling text. I hope to think a bit more about layout soon, which should help. I've (before this PR) already had comments about things being cramped, things not being grouped, the RGBLight icons being so close together, etc.

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