Core: Utility meter irraneous counters after consumption spikes

Created on 18 Feb 2019  路  6Comments  路  Source: home-assistant/core

Home Assistant release with the issue: 0.87.1

Last working Home Assistant release (if known): N/A

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io

Component/platform: Utility meter

Description of problem: I have a miner connected to a Xiaomi smart plug that measures the consumption of it. It usually consumes about 540 Watts, however when it hangs the consumption goes down to ~100-120 Watts, when that happens I power cycle the Xiaomi smart plug, but after that the Utility meter shows irraneous measurements:
maxthonsnap20190218113808

The first value is the current consumtion, the second is the Peak monthly counter and the last one is the off-peak monthly counter. Usually the peak counter is twice the count of the off-peak, but this morning the counter went crazy.
maxthonsnap20190218114432

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

#Utility meter
utility_meter:
  energy:
    source: sensor.miner_consumption_current
    cycle: monthly
    tariffs:
      - day
      - night         

Automation:
- id: '1550064608948'
  alias: '[Utility] Tariff switch'
  trigger:
  - at: '23:00:00'
    platform: time
  - at: 07:00:00
    platform: time
  condition: []
  action:
  - data:
      entity_id: utility_meter.energy
    service: utility_meter.next_tariff

Traceback (if applicable):


Additional information:

utility_meter

Most helpful comment

Ok, so here is the deal:

  • The utility_meter will not convert W to kWh

To do that you can use the integration sensor:
https://www.home-assistant.io/components/sensor.integration/#energy

You then use this new sensor as the source for the utility_meter

All 6 comments

sensor.miner_consumption_current provides information in kWh or W ?

It provides the information in W, but the Utility meter counts the kWh. I don't do any conversions it is by default (I just customized the unit of measurement):
maxthonsnap20190219104522

I noticed the same behavior today as well. It all works well until there is a spike in the consumption (e.g. the miner restarts and the consumtion drops):

maxthonsnap20190219103800

maxthonsnap20190219103700

maxthonsnap20190219103731

Ok, so here is the deal:

  • The utility_meter will not convert W to kWh

To do that you can use the integration sensor:
https://www.home-assistant.io/components/sensor.integration/#energy

You then use this new sensor as the source for the utility_meter

I see, thanks. However, why is the off-peak counter working without any conversion - the sensor for the miner provides W (500 Watts moment consumption) and the utility meter counts kWh (e.g. for one hour it counts 0.5 kWh) and it also works the same for peak hours, unless there is a spike in the consumption.

That was just me thinking out loud, maybe there is something in the backend that I don't see and wanted to understand it.

Thanks though, I will update my config.

The utility meter is a sum of the differences of the source.

Basically gets the current measure of the source, subtracts the previous measure, and adds up to counter (which is what is displayed). I think your "right" values are sheer luck ;)

@dgomes LOL, makes sense now :)

Was this page helpful?
0 / 5 - 0 ratings