I use this code to track the combined kWh energy usage of 2 sonoff s31 plugs, then I calculate the electricity cost. But I can’t figure out how to display the sum of the last 30 days electricity cost in an entity card
sensor:
- platform: integration
source: sensor.sonoff_10014f7842_power
name: grow_tent1_kWh
unit_prefix: k
unit: kWh
round: 2
all_grow_tent_kwh_cost:
friendly_name: "Total electricity cost (Grow tents)"
unit_of_measurement: '$'
value_template: "
{{
( float(states('sensor.grow_tent1_kwh')) + float(states('sensor.grow_tent2_kwh')) ) * 0.09502
}}
"