-
-
Notifications
You must be signed in to change notification settings - Fork 401
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 device_class attribute to battery and WiFi sensors for Home Assistant #1910
Conversation
This is not a bug fix as you initially selected. It's a feature for which there is no category in the PR template because I'm not interested in feature PRs. The reason for that is that they're just more trouble then they're worth. For example, one thought that comes to mind is "how does this affect the minimum required Home Assistant Version?" because there's a schema validation in HAs MQTT feature meaning that this will break hard on older versions, likely making use of Valetudo impossible. Did you consider those implications? Probably not.
No, absolutely not. That will never happen. See also #1890 |
Wow. I'm sorry, I didn't know. I understand you're just trying to protect your sanity (e.g. #1664), and I appreciate the work you've done but it saddens me to see such hostility towards potential contributors.
You're right. I hadn't and that's a very valid concern. Personally, I think the beauty of PRs is that we can have that discussion now. FWIW Additionally the MQTT discovery documentation (https://www.home-assistant.io/integrations/mqtt#discovery-payload) indicates that unknown keys are ignored to in effort to allow backwards compatibility. Regards, |
I do get that perspective but IMO that is part of that fake story about FOSS, big corpo started telling people to get them to exploit themselves for corporate profits. The probably a bit harsh truth there is that for this project, contributers 80% of the time are a net negative. They take time to deal with, they usually add stuff to the codebase that then needs to be maintained by yours truly and at the end of the day they're "solving" something there is no shortage of: Coding. I can do the coding just fine - after all that's why the project even exists. I hope you don't take this personally because it's not a personal issue. It's cultural. Every talking head on the internet tells you that you should contribute because contributing is oh so great, then you do invest the time to actually do that and then suddenly the maintainer tells you to F off. What a frustrating experience for everyone involved. Everyone but the talking heads of course who continue to bring this nonsense upon random people for their own personal gain. aaanyway, I do very much appreciate that you took the time to put in the effort of researching if there might be any trouble with that change even after having received this rather harsh reply! |
Type of change
Description
This PR add the
device_class
attribute to the battery and WiFi sensors for Home Assistant. Having a properdevice_class
attribute allows HA to apply some extra styles to entity.e.g. For battery level, the icon is color-coded depending on state and the device page shows the battery level
Icon Colored
Battery On Device Page
I didn't notice any obvious changes for the WiFi sensor to report here.
Possible additional changes
The following additional updates might be possible.
unit !== stateAttrs.ConsumableStateAttribute.UNITS.PERCENT
There is also a BinarySensorDeviceClass which can be seen here but I didn't find an applicable classes to the current binary sensors.
A future improvement could expose if an update is available with the UPDATE class.