How to graphically represent gas bottle contents

I have this graphic on my front end that shows the contents of LPG gas bottles and which bank is in use.

I was using six images to show content based on rough consumption calculations.

I now have a 0-100% sensor, the value of which I’d like to use to show the bottles emptying over time.

Essentially, I suppose this amounts to a custom gauge with a coloured rectangle that increases in height with the sensor value. I can mask the rectangle to get the shape.

I can handle the graphics, but I need help creating the gauge without resorting to 100 images.

Is it possible to create such a thing?

Where can I start?

Did you give up on this thread?

Quite the opposite. It’s having this in place that’s made the sensor available for me to develop the graphic.

Previously, I was calculating the contents from the manufacturer’s consumption figure, generator load and run time to estimate bottle contents.

Now, with weighing, I accurately know the contents.

Its definitely doable without having to use of any images. The iif statements( updates made iif obsolete) in the code need updated, but that’s an easy change.

Another method that could be applied…

Can you share your current card code?

1 Like

Also this great card:

2 Likes

Here’s the current card, as requested.

type: vertical-stack
cards:
  - type: custom:mushroom-chips-card
    chips:
      - type: entity
        entity: input_boolean.right_bottle_test
        name: Right
        tap_action:
          action: toggle
        content_info: name
      - type: entity
        entity: input_boolean.left_bottle_test
        tap_action:
          action: toggle
        content_info: name
        name: Left
      - type: entity
        entity: input_boolean.lpg_valve_status_test
        name: Valve
        tap_action:
          action: toggle
        content_info: name
    alignment: center
  - type: picture-elements
    image: /local/images/lpg_bottles/background-dark.png
    elements:
      - type: image
        entity: sensor.lpg_bottle_in_use_level
        style:
          left: 50%
          top: 50%
          width: 100%
        state_image:
          Bothfull: /local/images/lpg_bottles/4_full.png
          Right75: /local/images/lpg_bottles/right-75.png
          Right50: /local/images/lpg_bottles/right-50.png
          Right25: /local/images/lpg_bottles/right-25.png
          Rightempty: /local/images/lpg_bottles/left-full.png
          Leftfull: /local/images/lpg_bottles/left-full.png
          Left75: /local/images/lpg_bottles/left-75.png
          Left50: /local/images/lpg_bottles/left-50.png
          Left25: /local/images/lpg_bottles/left-25.png
          Leftempty: /local/images/lpg_bottles/right-full.png
      - type: image
        entity: sensor.lpg_bottle_in_use
        style:
          left: 50%
          top: 50%
          width: 100%
        state_image:
          Right: /local/images/lpg_bottles/right_in_use.png?v=2
          Left: /local/images/lpg_bottles/left_in_use.png?v=2
          Both: /local/images/lpg_bottles/both_in_use.png
      - type: image
        entity: sensor.lpg_valve_changeover_sensor
        style:
          left: 50%
          top: 50%
          width: 100%
        state_image:
          rightempty: /local/images/lpg_bottles/right_arrow.png
          leftempty: /local/images/lpg_bottles/left_arrow.png
          bothfull: /local/images/lpg_bottles/bothfull.png
      - type: image
        entity: input_select.generator_engine_state
        style:
          left: 50%
          top: 50%
          width: 100%
        state_image:
          Running: /local/images/lpg_bottles/feed-arrow.png
          Ready: /local/images/lpg_bottles/nofeed-arrow.png
          Exercising: /local/images/lpg_bottles/nofeed-arrow.png
          Cranking: /local/images/lpg_bottles/nofeed-arrow.png
      - type: state-label
        entity: sensor.available_run_days_based_on_last_outage_consumption
        title: Days remaining
        prefix: "Days remaining: "
        hold_action:
          action: more-info
        style:
          top: 97%
          left: 52%
          font-size: 15px
  - type: entities
    entities:
      - entity: sensor.left_lpg_bottle_level
      - entity: sensor.right_lpg_bottle_level
      - entity: sensor.lpg_bottle_in_use
      - entity: sensor.combined_lpg_bottle_levels
      - entity: sensor.lpg_bottle_in_use_level
      - entity: sensor.lpg_valve_changeover_sensor
      - entity: sensor.generator_estimated_fuel_in_tank

This is excellent. I’ll have a goat adapting it. Thank you.