Is there a list of device_classes in the core, or are they defined somewhere? I can’t find such a definition in the docs, just specific ones.
Thanks for the link. That did get me closer to finding such a list. I would have never thought of “customizing” as the vector.
I was looking for how to change my garage door open/close icons and I came across this:
binary_sensor:
- platform: gpio
device_class: garage_door
My first thought was, “wait! what? Device class?”
So, cool. Adding this line into my ESPHome code worked exactly how I wanted. So, I wondered what else I could modify with device_class. A search in Documentation - Home Assistant for “device_class” responded with every possible hit for “device” and “class”, but none for “device_class”. (A problem with the search feature?)
So, a bit more digging and I found such a list. Well, five lists.
Obviously, I had never heard of device_class before… Thanks.
can you share those lists?
That’s a rabbit hole with infinite branches. This is the most succinct and useless description of device_class that I have found in the docs.
Device_class sets the class of the device
Wow!. It continues:
, changing the device state and icon that is displayed on the UI (see below). It does not set the unit_of_measurement.
Think this lists them (at least used in ESPHome): esphome/esphome/const.py at ffc66f539f99fd193aa58aa7bbb8176565c00ece · esphome/esphome · GitHub
Thanks. That helps.
But my confusion is how do I decide which class to use in my DIY projects.
I’m not sure where the device class documentation is lacking. It seems to be quite clear to me.
If the entities in your DIY project are sensors choose the device class from this list.
Are they binary sensors? Choose from this list.
So and so forth for any entity in any domain that supports devices classes.
If your entities are templates, set the device class in the template definition.
- binary_sensor:
- name: "Alarm Clock Presence Alert"
unique_id: alarm_clock_presence_alert
icon: mdi:clock-alert
device_class: problem
state: >
If your entities are created by an integration, you can set the device class with YAML
homeassistant:
customize:
media_player.bedroom_tv:
device_class: tv
Or set it in the UI (for the domains that support it).
Device class is labeled “Show As” in the UI.
Which part exactly are you struggling with?
None, as of yout last post. Thanks for the clarification.
For the next person, from a log entry;
‘battery’, ‘battery_charging’, ‘carbon_monoxide’, ‘cold’, ‘connectivity’, ‘door’, ‘garage_door’, ‘gas’, ‘heat’, ‘light’, ‘lock’, ‘moisture’, ‘motion’, ‘moving’, ‘occupancy’, ‘opening’, ‘plug’, ‘power’, ‘presence’, ‘problem’, ‘running’, ‘safety’, ‘smoke’, ‘sound’, ‘tamper’, ‘update’, ‘vibration’, ‘window’
