Skip to content

an alternate approach to the official hass.io utility_meter

Notifications You must be signed in to change notification settings

tiaanv/hass-utility_meter_alternative

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

hass-utility_meter_alternative

an alternate approach to the official hass.io utility_meter

This code originally comes from https://github.com/home-assistant/home-assistant

full credit to @dgomes and @fabaf for original code. I only added my bits.

The standard component is great, howver it did not suit my needs, and the devs did not think there was a need for change/enhancement.

I have put this up for those who would also need this approach.

So how is it different?

The standard component evaluates the "old_state" vs "state" of the source sensor. Calculates the DIFF, and adds it to the current accumulated total (state). This is perfect, except if you have any "glitch" in data from the source sensor. I got erratic accumulation in my environment, especially when restarting HASS.

This alternative component still has the original component's mode, but can be configured to use an alternative calculation mode, by setting "mode: alt":

  pv_prod_meter_alt:
    source: sensor.pv_prod
    cycle: daily
    mode: alt
    tariffs:
      - normal   

The instead of attempting to calculate a delta on every change, this mode rather takes a "snapshot" of the sensor value on reset/initialization, and then simply subtracts it from the reported value from the source sensor. IT makes it impervious to "glitches" in data.

It's not perfect though. The downside is that if you have a sensor that resets to ZERO (0) randomly, this is not going to work for you.

When you install this component, it will "replace" the built in utility_meter component. You can of course revert back by simply removing the custom one. That being said. This version will work exactly as the built in one, unless you change the mode as explained above.

Installation is simple. Follow these basic instructions:

https://developers.home-assistant.io/docs/en/creating_component_loading.html

Well There you go. Enjoy.

About

an alternate approach to the official hass.io utility_meter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages