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 icons for new sensor device classes #13895

Merged
merged 4 commits into from
Sep 28, 2022
Merged

Add icons for new sensor device classes #13895

merged 4 commits into from
Sep 28, 2022

Conversation

emontnemery
Copy link
Collaborator

Proposed change

Add icons for new sensor device classes

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

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

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:

@@ -121,6 +122,7 @@ export const FIXED_DEVICE_CLASS_ICONS = {
carbon_monoxide: mdiMoleculeCo,
current: mdiCurrentAc,
date: mdiCalendar,
distance: mdiSpeedometer,
Copy link
Contributor

Choose a reason for hiding this comment

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

Would ruler not be better for distance?

Suggested change
distance: mdiSpeedometer,
distance: mdiRuler,

Copy link
Member

Choose a reason for hiding this comment

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

This is an error :)
We also discussed using:

CleanShot 2022-09-28 at 09 40 31

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated the icon to what was intended, but I agree @epenet's suggestion would work too:
image
Or maybe:
image

sulphur_dioxide: mdiMolecule,
temperature: mdiThermometer,
timestamp: mdiClock,
volatile_organic_compounds: mdiMolecule,
voltage: mdiSineWave,
// volume: TBD, => no well matching icon found
Copy link
Contributor

@epenet epenet Sep 28, 2022

Choose a reason for hiding this comment

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

Not ideal, but maybe mdiCupWater or mdiCarCoolantLevel as default?

Copy link
Collaborator Author

@emontnemery emontnemery Sep 28, 2022

Choose a reason for hiding this comment

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

A very quick browse of the use VOLUME_* constants shows that, where the context is clear, it's mostly either of:

  • gas
  • water
  • vehicle fuel

For gas, there's already a gas device class of course, so it's pretty much either an amount of water or vehicle fuel

The cup is not a great fit for vehicle fuel.

How about just doing this for the default:
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There's also:
image

Copy link
Contributor

@epenet epenet Sep 28, 2022

Choose a reason for hiding this comment

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

I like that mdiCarCoolantLevel shows a liquid inside a container.
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not a good fit for water or fuel consumption though.

Copy link
Contributor

@epenet epenet Sep 28, 2022

Choose a reason for hiding this comment

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

water makes me think of a leak
gauge makes me think of a speed

For car-coolant-level I don't like the name, but I do like the icon, which fits any liquid sploshing around in a container.

Copy link
Member

Choose a reason for hiding this comment

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

Let's hold off an icon and let's see over time what is being used by integrations.

Copy link
Collaborator Author

@emontnemery emontnemery Sep 28, 2022

Choose a reason for hiding this comment

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

Yes, it fits an amount of liquid in a container, but it doesn't fit the amount of water you've used in your home, or the amount of fuel your car has used which seem to be the two most common uses for sensors measuring volumes.

Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

I think this is OK to start with. We can always improve/change based on feedback provided by others in the future. Beta is close, and we should get some default in.

@bramkragten bramkragten merged commit f9d119d into dev Sep 28, 2022
@bramkragten bramkragten deleted the sensor_icons branch September 28, 2022 12:00
@epenet
Copy link
Contributor

epenet commented Sep 30, 2022

Hi
I was surprised by the comment from @balloob on this PR: home-assistant/core#79323, asking the user to drop the icon and effectively be left without a default icon.

Opposite, I left the existing icons in my PRs: home-assistant/core#79261, home-assistant/core#79263, home-assistant/core#79262, home-assistant/core#79253, home-assistant/core#79277, home-assistant/core#79285, home-assistant/core#77488

Same for @bdraco in home-assistant/core#79162

Do we need to go over these PRs a second time?

@bdraco
Copy link
Member

bdraco commented Sep 30, 2022

Icon to use in the frontend. Icons start with mdi: plus an identifier. You probably don't need this since Home Assistant already provides default icons for all entities according to its device_class. This should be used only in the case where there either is no matching device_class or where the icon used for the device_class would be confusing or misleading.

https://developers.home-assistant.io/docs/core/entity/

If the icon provided by the device class is not confusing or misleading it should be removed. If there is no icon provided by the device class it should likely still be set.

@epenet
Copy link
Contributor

epenet commented Sep 30, 2022

I reviewed my changes, and opened this PR: home-assistant/core#79348

@github-actions github-actions bot locked and limited conversation to collaborators Sep 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants