Visual Studio is telling me, that some of the device_classes I have set for some sensors are currently not allowed.
It is providing a link with more information, where the device class which I am using IS listed…
- sensor:
- name: oilfox_fuelused
unique_id: 'oilfox_fuelused'
unit_of_measurement: L
device_class: volume
state_class: measurement
state: >
{% set max_filllevel = 1000 | float(0) %}
{% set current_illlevel = states('sensor.oilfox_filllevelquantity') | float(0) %}
{% set fuelused = max_filllevel - current_filllevel | float(0) %}
{{ '{:.2f}'.format(fuelused) }}
- sensor:
- name: odometer_custom
unique_id: 'odometer_custom'
unit_of_measurement: km
device_class: distance
state_class: total_increasing
icon: 'mdi:speedometer'
state: "{{ states('sensor.odometer') | float(0) }}"
VS Code is reporting:
Sets the class of the device, changing the device state and icon that is displayed on the UI (see below). It does not set the unit_of_measurement.
https://www.home-assistant.io/integrations/template#device_class
Value is not accepted. Valid values: "apparent_power", "aqi", "battery", "carbon_dioxide", "carbon_monoxide", "current", "date", "duration", "energy", "frequency", "gas", "humidity", "illuminance", "monetary", "nitrogen_dioxide", "nitrogen_monoxide", "nitrous_oxide", "ozone", "pm1", "pm10", "pm25", "power", "power_factor", "pressure", "signal_strength", "sulphur_dioxide", "temperature", "timestamp", "volatile_organic_compounds", "voltage".yaml-schema: http://schemas.home-assistant.io/configuration(1)
but this is not the complete list according to this documentation: