Which should then be the complete listing of classes for sensor, binary_sensor and cover?
Now how could I ask the devs if an ‘unknown’ state for device_class: timestamp could be displayed as ‘not set’ instead of the currently showing ‘Invalid date’…
well not really, that page is rather lacking on info on the available device_classes…I think Ive listed the available ones in the source code for those components, though am not sure if that is complete.
Im struggling with the device_class: timestamp, showing an ugly state for my alarms, when not set. If the alarm is set, it shows a beautiful ‘in xx minutes’, and even counts down the final minute, and first minute past the alarm. If not set, the state is unknown, and consequently shows ‘Invalid date’. Which is silly, because it should simply state ‘Not set’…
Either there is no timestamp or the documentation is incomplete. I generally feel the docs are VERY confusing. Always looking for properties or functions but i never find a clear and good documentation for them.
For example device_class should be a type/enum which has its own site showing all possible values. Same for functions like state_attr(), is_state_attr etc.
I compared each documentation page to the corresponding component’s source code and it’s all up to date. The timestamp device_class is part of the sensor component.
Bosbofne im not even close enough in the code to write any documentation.
123 Nope i know this page, still its a struggle. Look at Angular API docs for example: You can click on functions and types and they will lead you to separate pages explaining every little detail of inputs and outputs and example usage. On Home Assistant it is just searching, not finding answers and guessing.
ok, thnks, I guess we can assume all device_classes are described then, as I hoped to have found and shared in my first post, and @123 re-listed above.
now how would we have to go about changing the outcome of the timestamp device_class. It is programmed to be ‘unknown’ if not set, and then the frontend translates that to ‘Invalid date’.
Imho that is rather unfortunate, because, as in my case when used on several timer and alarm sensors, shows a list of ‘Invalid dates’ while they are simply not set.
Before, we could customize that using @andrey s custom-ui using _stateDisplay, but that has been deprecated unfortunately.
as tried in this topic ( see the test template in the screenshot) I’ve tried to mimic the device_class using a rather large template sensor, but that only is successful halfway. (the original timestamp has a very nice last minute countdown per second, and also displays how much time has passed since the set alarm.
really only need the ‘Not set’ to be changed…
So I figure the only thing left is a PR on that device_class?
Your topic title asks “Where can we find the available device_classes?” and several people replied, directing you to the documentation. I did as well, plus I also compared the code to the documentation and confirmed it is correct.
In addition, you stated the timestamp class was ‘not listed’, based on binary_sensor code. I explained it is listed as a sensor class . So 90% of your first post was answered/clarified/corrected. That’s much more than simply having ‘re-listed’ what you wrote.
The final question in your first post is effectively a Feature Request. I agree with you that displaying an unknown date as Invalid date is undesirable. I would vote for a Feature Request to have it display Unknown which more accurately reflects the situation.
So I figure the only thing left is a PR on that device_class?
Yes, as a Pull Request if you wish to submit code modifications/enhancements. Otherwise, this is a Feature Request (which are not accepted in the Github repo). If you believe it’s a bug, then it can be submitted as an Issue. I’d say this is a ‘cosmetic bug’ (wrong label) and submit it as an Issue.
to even be able to try a PR, I would need to know how these device_classes work, or are programmed. The source codes we discussed above don’t show that don’t they?
I mean where are the icons and states described, which replace the default on/off icons and states.
That must be done in some other HA source file, but havent found that yet.
really sorry you feel like I have been complaining about the documentation. Never had the intention to do so. Added to that, I always try to be as complete as possible so others can take advantage of that, if and when they are looking for answers to shared issues.
Please refrain from judging and blaming others.
Makes this community so much more enjoyable.
thanks.
When I tried using ‘battery_charging’ or ‘plug’ in my configuration.yaml for a sensor within mqtt I received an error message which included the list of expected device_class values: