Hi, longtime HA user here, but new to template creation.

Here is what I’m trying to accomplish:

I have a whole home energy monitor (Aeotec HEM g5). It is connected via SmartThings (ST) which in turn integrates into Home Assistant (HA). It reports Kwh, Watts, and Volts of my home energy use. Now I want to create custom lovelace dashboard with data and graphs displayed.

In an effort to accomplish my vision, I need to create templates and automations to manipulate data from HEM. I can figure out the charts/graphs, but the math/syntax is all together different…here.

**Data value variables I believe are needed**

mthly_kwh = monthly kilowatt per hour (stored in sensor)

base_kwh = flat 600 kwh (stored in helper)

base_rate = cost per first 600 kwh (stored in helper)

overage_rate = cost per kwh over base_kwh (stored in helper)

peak_rate = cost per kwh during peak season over base_kwh (stored in helper)

fuel_adj = adjusted cost for fuel fee calculated by mthly_kwh (stored in helper)

reg_adj = adjusted cost for regulatory fee calculated by mthly_kwh (stored in helper)

svc_chg = static fee service charge (stored in helper)

**Here is an example of the calculations needed for the offpeak monthly cost:**

mthly_cost = ((base_kwh * base_rate) + ((mthly_kwh - base_kwh) * overage_rate) + (mthly_kwh * fuel_adj) + (mthly_kwh * reg_adj) + svc_chg)

```
{{ ( states.sensor.energy_monthly_offpeak.state | float ) * ( states.input_number.energy_base_rate.state | float ) }}
```

Current Output: 5.236789

Desired Output: 5.24

Above is what I have thus far, the formula does appear to be giving accurate results, but the resulting value displays varying length decimal numbers. I want the result to appear as a dollar.cent value (USD). I tried adding “round(2)” in different places and ways, but get errors in developer tools. I’d appreciate you genius’s out there assist…Home Assist…get it?