Utility Meter- Looking for confirmation of setup

I have several Sonoff POW R2 flashed with Tasmota, and I’d like to confirm I have them setup correctly, so that I can calculate my energy costs.

Within my configuration.yaml, I have the following set up for each POW.

utility_meter:
  daily_energy_powermeter1:
    source: sensor.powermeter1_energy_power
    cycle: daily
  weekly_energy_powermeter1:
    source: sensor.powermeter1_energy_power
    cycle: weekly
  monthly_energy_powermeter1:
    source: sensor.powermeter1_energy_power
    cycle: monthly

It appears energy_power is in Watts.

further down, within configuration.yaml, I have:

sensor:
   - platform: template
     sensors: 
 
      powermeter1_cost_daily:
        friendly_name: "Current cost this day"
        unit_of_measurement: '$'
        icon_template: mdi:currency-usd
        value_template: >-
          {{ (states('sensor.daily_energy_powermeter1') | float * 0.0029) | round(2) }}

      powermeter1_cost_weekly:
        friendly_name: "Current cost this week"
        unit_of_measurement: '$'
        icon_template: mdi:currency-usd
        value_template: >-
          {{ (states('sensor.weekly_energy_powermeter1') | float * 0.0029) | round(2) }}    
    
      powermeter1_cost_month:
        friendly_name: "Current cost this month"
        unit_of_measurement: '$'
        icon_template: mdi:currency-usd
        value_template: >-
          {{ (states('sensor.monthly_energy_powermeter1') | float * 0.0029) | round(2) }}
          
      powermeter1_cost_last_daily:
        friendly_name: "Yesterday's cost"
        unit_of_measurement: '$'
        icon_template: mdi:currency-usd
        value_template: >-
          {{ (state_attr('sensor.daily_energy_powermeter1' , 'last_period') | float * 0.0029) | round(2) }}  

      powermeter1_cost_last_week:
        friendly_name: "Last week's cost"
        unit_of_measurement: '$'
        icon_template: mdi:currency-usd
        value_template: >-
          {{ (state_attr('sensor.weekly_energy_powermeter1' , 'last_period') | float * 0.0029) | round(2) }}              
          
      powermeter1_cost_last_month:
        friendly_name: "Last month's cost"
        unit_of_measurement: '$'
        icon_template: mdi:currency-usd
        value_template: >-
          {{ (state_attr('sensor.monthly_energy_powermeter1' , 'last_period') | float * 0.0029) | round(2) }}

My cost for electricity is MXN$2.90/KW, which is where the 0.0029 is coming from, since the energy_power is only in watts.

Am I using the correct ‘power’ property in this case?

Thanks in advance,

If the unit is Watts that is a power sensor.

You need the energy sensor which will have a KiloWattHour (KWh) unit.

Thanks for the reply.

Looking at my entities, it looks like I should be using energy_today, correct?

No. That won’t work as it resets daily. You want the one below it, energy_total for use with the utility meters.

1 Like

thanks for your time!