Jumps in utility meter since update

Just noticed that since around the time I updated from 2023.4.2 to 2023.4.4 on April 13th I now have funky jumps in my utility meter result graphs. Its random looking, nothing to do with restarting or anything I can tell.

Anyone else finding this?

The source looks fine though:

utility_meter:
  monthly_electric_meter:
    name: "Monthly Electric Meter"
    source: sensor.iw_total_power_wh
    cycle: monthly
    offset:
      days: 0

  weekly_electric_meter:
    name: "Weekly Electric Meter"
    source: sensor.iw_total_power_wh
    cycle: weekly

  daily_electric_meter:
    name: "Daily Electric Meter"
    source: sensor.iw_total_power_wh
    cycle: daily

  hourly_electric_meter:
    name: "Hourly Electric Meter"
    source: sensor.iw_total_power_wh
    cycle: hourly
  - platform: template
    sensors:

      dominion_kwh_cost_flat_rate:
        friendly_name: "Dominion kWH Cost Flat Rate"
        unit_of_measurement: "$"
        value_template: 0.14
        # Jul 2022 increase 0.11 -> 0.14 basic rates

      monthly_electric_cost:
        friendly_name: "Monthly Electric Cost"
        unit_of_measurement: "$"
        value_template: >-
          {{ ( states('sensor.monthly_electric_meter') | float(0) / 1000.0 * states('sensor.dominion_kwh_cost_flat_rate') | float(0) ) | round(2,default=-1) }}

      weekly_electric_cost:
        friendly_name: "Weekly Electric Cost"
        unit_of_measurement: "$"
        value_template: >-
          {{ ( states('sensor.weekly_electric_meter') | float(0) / 1000.0 * states('sensor.dominion_kwh_cost_flat_rate') | float(0)) | round(2,default=-1)  }}

      daily_electric_cost:
        friendly_name: "Daily Electric Cost"
        unit_of_measurement: "$"
        value_template: >-
          {{ ( states('sensor.daily_electric_meter') | float(0) / 1000.0 * states('sensor.dominion_kwh_cost_flat_rate') | float(0) ) | round(2,default=-1) }}

      hourly_electric_cost:
        friendly_name: "Hourly Electric Cost"
        unit_of_measurement: "$"
        value_template: >-
          {{ ( states('sensor.hourly_electric_meter') | float(0) / 1000.0 * states('sensor.dominion_kwh_cost_flat_rate') | float(0) ) | round(2,default=-1) }}


What does the graph for sensor.weekly_electric_meter meter look like?

That also looks fine to me:

It’s your

Give them an availability_template you wont see the vertical lines.

I don’t understand what this means?

And there shouldn’t be vertical lines? The input is steady?

You’re telling the system to use a default value of 0 when sensor.monthly_electric_meter is not a number when you use | float(0).

So anytime your sensor goes unavailable or produces a non numeric value, that calculation will use 0 in it’s place.

That’s creating those vertical lines.

Oh. Any idea why that would suddenly have become a problem at almost exactly the same time as the recent update?

I’ve had these sensors working flawlessly for months without this issue. And I think I had to add some default value because it spams errors/warnings otherwise.

It’s a fluke. Your template has always been built to do that. If this is new, look at the source sensors, not the template.

I guess without getting too off-topic, is there a way to tell HA to stop spamming my log for battery powered ESPHome device being unreachable in deep_sleep?

I assume if there might be a line about whatever intermittently is happening with the input iotawatt sensor, its probably stuck among the mountains of expected can’t-connect-something-sleeping from the ESPHome sensor I have on battery power

Except looking at the graph of this sensor there are no discontinuities to indicate that this has happened.

I suspect the culprit may be sensor.dominion_kwh_cost_flat_rate. @mmiller7 can we get a history graph of that sensor as well?

Either way it would be wise to include both sensors in the availability template. This should fix it:

      weekly_electric_cost:
        friendly_name: "Weekly Electric Cost"
        unit_of_measurement: "$"
        value_template: >
          {{ ( states('sensor.weekly_electric_meter') | float(0) / 1000.0 * states('sensor.dominion_kwh_cost_flat_rate') | float(0)) | round(2,default=-1)  }}
        availability_template: >
          {{ ( states('sensor.weekly_electric_meter') | is_number and states('sensor.dominion_kwh_cost_flat_rate') | is_number  }}

That’s actually a constant…so that I don’t have to re-enter the same hard coded value a bunch of places when the power rates change. But yeah here’s a graph for good measure.

      dominion_kwh_cost_flat_rate:
        friendly_name: "Dominion kWH Cost Flat Rate"
        unit_of_measurement: "$"
        value_template: 0.14
        # Jul 2022 increase 0.11 -> 0.14 basic rates

I have meters/graphs for the use over hour, day, week, month and wanted to simplify where to change it. All the graphs exhibit this same behavior fwiw…and one of my earlier posts had the “sourcecode” to them. They’re all identical except for the time-interval on the meters.

I think I may have found something! Happened to be looking at the IoTaWatt integration for a bit while watching TV and noticed everything go unavailable.

Then in the log I found Err: [Errno -2] Name does not resolve.

Now the question is…why? My local pfSense DNS server reports no errors, the hostname resolves just fine. And it apparently resolves “most of the time” on HassOS.