Sensor Calculation

Can someone tell me what mistake I am making here.

I get a value of “0” for tank_gallons. I was expecting 43*4 = 172

When I display sensor.tank_percentage on an entity card I get 43. I am getting my sensor.tank_percentage value from a multi scrape.

sensor:
        - select: "div.lblvalue-Estimatedtank:nth-child(1)"
          value_template: '{{ value.split("%")[0]}}'
          name: tankpercentage
          unique_id: tank_percentage

tank_gallons calculation - simple math *4

- platform: template
    sensors:
      tank_gallons:
        value_template: "{{(((states.sensor.tank_percentage) | int)*4) }}"

states.sensor.tank_percentage.state OR

states('sensor.tank_percentage')

Perfect - Thanks

1 Like

From what I can see, you don’t need a separate template sensor for that. You can just add it in the multiscrape value_template.

Thanks. I did not even consider that.