WJDDesigns/Ultra-Vehicle-Card

Feature request: Fossil Volume Unit in L

Closed this issue · 1 comments

My Volvo HA integration presents the remaining fuel in L and not % of full. If an option could be added to select the unit for fossil volume that would be great!

If L is selected it's also required to have a field for entering max volume. If the presented volume is in L or % doesn't really matter.

Great card!

I do not think we have plans for this currently but you could always create a template that would convert it and create a sensor that can be pulled in to the card's fuel area.

Step-by-Step Guide to Create a Template Sensor

1.	Access Home Assistant Configuration:
•	Go to your Home Assistant dashboard.
•	Click on “Settings” (the gear icon).
•	Navigate to “Devices & Services,” and then click on “Entities.”
2.	Determine the Entity for Fuel Volume in Liters:
•	Find the entity that represents the remaining fuel volume in liters (e.g., sensor.volvo_fuel_liters).
3.	Edit the Configuration File:
•	Go to “Settings” > “Devices & Services” > “Entities.”
•	Click on “Add Custom Sensor” or edit the configuration directly by going to “Settings” > “Automations & Scenes” > “Helpers.”
•	Alternatively, you can directly edit your configuration.yaml file from the file editor or any other code editor.
4.	Add a Template Sensor in configuration.yaml:

sensor:

  • platform: template
    sensors:
    volvo_fuel_percentage:
    friendly_name: "Volvo Fuel Percentage"
    unit_of_measurement: '%'
    value_template: >
    {% set max_volume = 60 %} # Replace 60 with your vehicle's max fuel volume in liters
    {% if states('sensor.volvo_fuel_liters') | float > 0 %}
    {{ (states('sensor.volvo_fuel_liters') | float / max_volume * 100) | round(1) }}
    {% else %}
    0
    {% endif %}

    Explanation:
    • max_volume: Set this to your vehicle’s maximum fuel tank capacity in liters.
    • sensor.volvo_fuel_liters: Replace this with the actual entity ID that shows the fuel volume in liters.
    • The template calculates the percentage by dividing the current fuel volume by the maximum volume and then multiplying by 100.

    1. Save and Restart Home Assistant:
      • After adding the template sensor, save the changes to configuration.yaml.
      • Restart Home Assistant to apply the changes. Go to “Settings” > “System” > “Restart” or use the command from the Developer Tools.
    2. Use the New Sensor in Your Custom Card:
      • Now, you can use the new sensor sensor.volvo_fuel_percentage in your custom card to display the fuel level as a percentage.