Combine two sensors in groups

Greetings,

Basically what I want to do is use the two top sensors shown in the picture below and combine them. I dont want them to be linked in any way, just visually show as one.
Below code is what my config looks like at the moment.

group:
Volvo:
name: Volvo XC70
entities:
- sensor.xc70_fuel_amount
- sensor.xc70_fuel_level
- sensor.xc70_range

What I would like to do is basically

group:
Volvo:
name: Volvo XC70
entities:
- sensor.xc70_fuel_amount + sensor.xc70_fuel_level
- sensor.xc70_range

Preferably I would like it to show up as
Bränsle 41L (58%)

As both are already counted on VolvoOnCall’s part I dont need to count/add/sum the values, I just need them to visually show up as one.

Capture

make a template sensor that combines them. Hide the originals from the UI.

sensor:
  - platform: template
    sensors:
      combined_volvo_fuel:
        friendly_name: Bränsle
        value_template: "{{ states('sensor.xc70_fuel_amount') }} ({{ states('sensor.xc70_fuel_level') }})"

then in your group, have the 2 sensors:

group:
  volvo:
    name: Volvo XC70
    entities:
      - sensor.combined_volvo_fuel
      - sensor.xc70_range

Also, Don’t use capitals as section headers in yaml. (like you did for the section header “Volvo” in your group.)

Wow thanks for the extremely quick answer, it works as intended. However if I may ask how would I add L after the first value “sensor.xc70_fuel_amount” and a percentage sign after the second value “sensor.xc70_fuel_level”?

EDIT: I fixed it, ohh damn my brain is not with me at all times. Thank you so much for the help :slight_smile:

value_template: “{{ states(‘sensor.xc70_fuel_amount’) }}L ({{ states(‘sensor.xc70_fuel_level’) }}%)”

Kind regards,

2 Likes