Strange readings from an Energy sensor

Hi,

I have a really odd problem that I can’t work out. I have an energy sensor as a template. The reading get pushed in to an InfluxDB database.

In HA the sensor readings show an slowing increasing unit cost, but in InfluxDB there are additional entries that are also increasing but off by thousands.

I created a duplicate sensor and that one only shows the correct units in InfluxDB. I have no idea where the additional readings are coming from. I have grep’d through the whole HA directory to look for random automations or calculations that are sending the numbers off, but the only reference to the sensor are in the configuration.yaml.

Does anyone has an explanation? Or a way to see what HA is pushing to Influx so I can find out what is causing it?

I could obviously just delete the sensor that is off, but I am really curious about what could be causing it.

The Sensors look like this

template:
  sensor:
    # Energy Costs
    - name: "Smart Meter Electricity: Cost (Today) v2"
      unique_id: smart_meter_electricity_cost_today_v2
      device_class: monetary
      unit_of_measurement: "GBP"
      state_class: "total_increasing"
      icon: mdi:cash
      state: "{{ (
          states('sensor.smart_meter_electricity_import_today') | float
          * states('sensor.smart_meter_electricity_import_unit_rate') | float
          + states('sensor.smart_meter_electricity_import_standing_charge') | float
        ) | round(2) }}"
    - name: "Smart Meter Electricity: Cost (Today)"
      unique_id: smart_meter_electricity_cost_today
      device_class: monetary
      unit_of_measurement: "GBP"
      state_class: "total_increasing" # requires "last_reset" for use to track costs in energy dashboard
      icon: mdi:cash
      state: "{{ (
          states('sensor.smart_meter_electricity_import_today') | float
          * states('sensor.smart_meter_electricity_import_unit_rate') | float
          + states('sensor.smart_meter_electricity_import_standing_charge') | float
        ) | round(2) }}"```
 
And the InFlux Data looks like


> SELECT * FROM "autogen"."energy" WHERE ("entity_id" = 'smart_meter_electricity_cost_today' OR "entity_id" = 'smart_meter_electricity_cost_today_v2') GROUP BY * ORDER BY DESC LIMIT 10
name: energy
tags: domain=sensor, entity_id=smart_meter_electricity_cost_today_v2, friendly_name=, instance=xxx, source=HA
time                device_class_str friendly_name friendly_name_str                        icon_str last_reset last_reset_str state state_class_str  unit_of_measurement_str value
----                ---------------- ------------- -----------------                        -------- ---------- -------------- ----- ---------------  ----------------------- -----
1700306973635646000 monetary                       Smart Meter Electricity: Cost (Today) v2 mdi:cash                                 total_increasing GBP                     4.33
1700306873433111000 monetary                       Smart Meter Electricity: Cost (Today) v2 mdi:cash                                 total_increasing GBP                     4.32
1700306753732114000 monetary                       Smart Meter Electricity: Cost (Today) v2 mdi:cash                                 total_increasing GBP                     4.31
1700306663577176000 monetary                       Smart Meter Electricity: Cost (Today) v2 mdi:cash                                 total_increasing GBP                     4.3
1700306563379562000 monetary                       Smart Meter Electricity: Cost (Today) v2 mdi:cash                                 total_increasing GBP                     4.29
1700306454317131000 monetary                       Smart Meter Electricity: Cost (Today) v2 mdi:cash                                 total_increasing GBP                     4.28
1700306323555375000 monetary                       Smart Meter Electricity: Cost (Today) v2 mdi:cash                                 total_increasing GBP                     4.27
1700306183757187000 monetary                       Smart Meter Electricity: Cost (Today) v2 mdi:cash                                 total_increasing GBP                     4.26
1700306073555732000 monetary                       Smart Meter Electricity: Cost (Today) v2 mdi:cash                                 total_increasing GBP                     4.25
1700305983482351000 monetary                       Smart Meter Electricity: Cost (Today) v2 mdi:cash                                 total_increasing GBP                     4.24

name: energy
tags: domain=sensor, entity_id=smart_meter_electricity_cost_today, friendly_name=, instance=xxx source=HA
time                device_class_str friendly_name friendly_name_str                     icon_str last_reset last_reset_str state state_class_str  unit_of_measurement_str value
----                ---------------- ------------- -----------------                     -------- ---------- -------------- ----- ---------------  ----------------------- -----
1700306983587261000 monetary                       Smart Meter Electricity: Cost (Today) mdi:cash                                 total_increasing GBP                     3851.88
1700306973636871000 monetary                       Smart Meter Electricity: Cost (Today) mdi:cash                                 total_increasing GBP                     4.33
1700306973598013000 monetary                       Smart Meter Electricity: Cost (Today) mdi:cash                                 total_increasing GBP                     4.33
1700306973592158000 monetary                       Smart Meter Electricity: Cost (Today) mdi:cash                                 total_increasing GBP                     3850.19
1700306963660825000 monetary                       Smart Meter Electricity: Cost (Today) mdi:cash                                 total_increasing GBP                     3849.07
1700306953566214000 monetary                       Smart Meter Electricity: Cost (Today) mdi:cash                                 total_increasing GBP                     3847.94
1700306943621754000 monetary                       Smart Meter Electricity: Cost (Today) mdi:cash                                 total_increasing GBP                     3847.1
1700306933509101000 monetary                       Smart Meter Electricity: Cost (Today) mdi:cash                                 total_increasing GBP                     3845.98
1700306923523146000 monetary                       Smart Meter Electricity: Cost (Today) mdi:cash                                 total_increasing GBP                     3844.85
1700306913511711000 monetary                       Smart Meter Electricity: Cost (Today) mdi:cash                                 total_increasing GBP                     3844.01