-
Notifications
You must be signed in to change notification settings - Fork 107
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 binary_sensors #318
Comments
The caveat is that there will be no more state-based icons, like motion |
I'm not sure if I'm onboard, users can easily change the icon to what they want if it's better to be more clear and the automatic icon is not important. If the automatic icon is disabled then for a user who wants that behavior, it would be practically impossible besides creating a separate template entity to do the same thing. |
I understand, and I think your concern is legit. The best to address this would be to have a feature in HA that would allow the user to "unset" an icon provided by the integration. Have in mind some things though:
So, if the goal is to allow the user to keep the original icons (which will have state-based icons), I suggest the following:
But personally, I would not advocate for it because I think the custom icons are better than one icon for all entities (which are state-based). That's because:
chrome_sX18s4uznH.mp4 |
Sensors don't have a switching behavior or a default icon so I think it is a different case.
I mean sure, I don't necessarily disagree for my own usage, but with the number of posts I see on Reddit and other places asking how to do switching icons based on state I don't think it's easy to dismiss it so quickly based on color being satisfactory personally. When the inevitable user comes and asks how to make the icons change based on state like their ONVIF integration (just a hypothetical example) I don't feel telling them to make a template entity is a great answer nor do I want to support them as they try templates. All that being said, it has occurred to me that as an integration we can still easily provide custom binary sensor icons by providing the icon as a property and setting it based on the current entity state. |
Got it. Makes sense.
Got it, I never stumbled upon this.
I guess you should consider my suggestion of adding it as per the integration configuration then if you care about this situation.
I did not understand how this would help... |
Right now the icon for every "presence" entity is a house with an outlined one being You could instead do @property
def icon(self) -> str:
"""Return the icon of the sensor."""
if self._is_on:
return ICON_PERSON
return ICON_PERSON_MISSING this way the binary sensors still have the state based icon and the icons can be more relevant like you are hoping to achieve here |
Oh yeah. Got it. Unfortunately, only a few icons provide meaningful variant to be able to leverage it. Still, we could do such a thing for the ones that we can, like "Person", "Car", "Dog". We could also request new icons (like horse-off, cat-off) for the ones missing, and add them in a later version once they get added to MDI. |
So, amazing, I totally agree, it's a great idea! |
Sounds like a good compromise to me. Where there's a good on/off variant pair, we use that -- otherwise we use the default (still allows a user to customize them to something different, non-state related, if they so choose). |
I think this can be closed, right? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
All binary sensors currently don't have an icon set. I think we should leverage our existing icons set to binary_sensor as well.
What do you guys think?
The text was updated successfully, but these errors were encountered: