Utility meter not working

I use the utility_meter integration to get aggregate data for my power, gas and water consumption.
This was working fine for some time, but the power sensors are not available anymore since a few weeks.

I am using packages structure for my configuration and directory looks as follows:

config
  - packages
    - utility
      - gas.yaml
      - power.yaml
      - water.yaml

Power.yaml contents:

utility_meter:  
  power_hourly:
    source: sensor.youless_power_total
    cycle: hourly
  power_daily:
    source: sensor.youless_power_total
    cycle: daily
  power_weekly:
    source: sensor.youless_power_total
    cycle: weekly
  power_monthly:
    source: sensor.youless_power_total
    cycle: monthly
  power_yearly:
    source: sensor.youless_power_total
    cycle: yearly

This is exactly the same structure as gas.yaml and water.yaml which are working just fine.
Double checked indenting and syntax and the name and availability of sensor.youless_power_total entity.

I have enabled debug logging for the utility_meter and see the following in the logs:

2021-06-19 20:55:57 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.gas_hourly
2021-06-19 20:55:57 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.gas_daily
2021-06-19 20:55:57 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.gas_weekly
2021-06-19 20:55:57 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.gas_monthly
2021-06-19 20:55:57 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.gas_yearly
2021-06-19 20:55:57 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.water_usage_hourly
2021-06-19 20:55:57 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.water_usage_daily
2021-06-19 20:55:57 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.water_usage_monthly
2021-06-19 20:55:57 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.water_usage_yearly

I have no clue why power is missing here.

Hope anyone have an idea.

1 Like

You can only use energy sensors (kWh) with the utility meter. Not power sensors (W or kW).

2 Likes

To add to what Tom says, you can use the “integration” integration (yeah confusing) to transform Power (W) into Energy (Wh)

1 Like

Thanks to you both. Will have a look into this later today.

I have checked, but actually the sensor is a kWh sensor. I don’t understand why this is not working and have no clue how to debug this yet. Will have to debug the python code in a development instance I assume.

There is another sensor provided by the Youless LS120 called youless_usage and I use that one for actual realtime power display (in watts), but not using that one for the utility_meter.

hmmm, tried to move the power utility configuration into main configuration.yaml and now it’s working. So it seems to be some nasty bug in the include configuration code. Will investigate some further.

Ok I have found the culprit.
Apparantly you cannot have two yaml files with the same name (in different subdirectories) when using the !include_dir_named packages directive.

I have renamed the other power.yaml to power2.yaml, and now it is working. This also explains why it was working with this sensor for months and all of a sudden stopped working when I added the second power.yaml file.
This would be quite cumbersome when the system keeps growing and chances of duplications will get higher. Especially because there is also no error whatsoever in the logs and this makes debugging difficult. But I think I’ll have to live with that.

I have also SolarEdge, but frequently the data is not showing correctly Some days only a total at the and of the day.
I use also a YouLess Ls120 for getting real-time data of my solar system. But I get the following error:

Logger: homeassistant.components.integration.sensor
Source: components/integration/sensor.py:184 
Integration: integration (documentation, issues) 
First occurred: 9:28:02 (88 occurrences) 
Last logged: 9:59:12

Invalid state (5522,382 > 5522,383): [<class 'decimal.ConversionSyntax'>]
Invalid state (5522,383 > 5522,384): [<class 'decimal.ConversionSyntax'>]
Invalid state (5522,384 > 5522,385): [<class 'decimal.ConversionSyntax'>]
Invalid state (5522,385 > 5522,386): [<class 'decimal.ConversionSyntax'>]
Invalid state (5522,386 > 5522,387): [<class 'decimal.ConversionSyntax'>]

youless

I think the comma is the issue.
A made a template sensor but get no result: 0,0
Configuration.yaml:

      production_total_youless:
        value_template: "{{ (states('sensor.power_total') | float *1000) }}"
        unit_of_measurement: "Wh"
        friendly_name: Opbrengst Youless

Customize.yaml:

sensor.production_total_youless:
  state_class: total_increasing
  icon: mdi:solar-power
  last_reset: '1970-01-01T00:00:00+00:00'
  device_class: energy

So, my question is how to get the correct data of my Youless for energy dashboard

Try

        value_template: "{{ (states('sensor.power_total') | replace(',','.') | float}}"
bad indentation of a mapping entry at line 96, column 70:
     ... sensor.power_total') | replace("," , ".") | float ) }}"
                                         ^

power_total

Update: I changed de " to ’ and now its working! Thank you @koying !!

Hi i have a sort of same question.
I Have this in my config.

utility_meter: 
  daily_energy_offpeak_produce:
    source: sensor.energiemonitor_total_power_export_t1
    name: Dagelijks stroom (dal)
    cycle: daily
  daily_energy_peak_produce:
    source: sensor.energiemonitor_total_power_export_t2
    name: Dagelijks stroom (piek)
    cycle: daily

  daily_energy_offpeak_useage:
    source: sensor.energiemonitor_total_power_import_t1
    name: Dagelijks stroom (dal)
    cycle: daily
  daily_energy_peak_useage:
    source: sensor.energiemonitor_total_power_import_t2
    name: Dagelijks stroom (piek)
    cycle: daily

  daily_gas_useage:
    source: sensor.energiemonitor_total_gas
    name: Dagelijks gas
    cycle: daily

I see this in my log

2021-09-22 15:03:29 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.daily_energy_offpeak_produce
2021-09-22 15:03:29 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.daily_energy_peak_produce
2021-09-22 15:03:29 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.daily_energy_offpeak_useage
2021-09-22 15:03:29 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.daily_energy_peak_useage
2021-09-22 15:03:29 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.daily_gas_useage
2021-09-22 15:03:52 DEBUG (MainThread) [homeassistant.components.utility_meter.sensor] <Dagelijks stroom (dal)> collecting from sensor.energiemonitor_total_power_export_t1
2021-09-22 15:03:52 DEBUG (MainThread) [homeassistant.components.utility_meter.sensor] <Dagelijks stroom (piek)> collecting from sensor.energiemonitor_total_power_export_t2
2021-09-22 15:03:52 DEBUG (MainThread) [homeassistant.components.utility_meter.sensor] <Dagelijks stroom (dal)> collecting from sensor.energiemonitor_total_power_import_t1
2021-09-22 15:03:52 DEBUG (MainThread) [homeassistant.components.utility_meter.sensor] <Dagelijks stroom (piek)> collecting from sensor.energiemonitor_total_power_import_t2
2021-09-22 15:03:52 DEBUG (MainThread) [homeassistant.components.utility_meter.sensor] <Dagelijks gas> collecting from sensor.energiemonitor_total_gas

But i can’t find the sensors anywhere. utility_meter.*

Is there something missing ?

It would be named sensor.daily_energy_offpeak_produce
Utility_meter is just a kind of sensor.

Hi this sensor isn’t in the list. And all other also are not in the list of sensors.

Iirc, you have to wait a cycle to see something, though. Did you?

yes it’s more then a day now. the strange thing is that I see the old sensors before I made the new names stil in the list.

Hi i’ve found my problem. My mistake

As seen in the log the sensor name is not taken from from the setup name but from the friendly name of the definition. That’s why the sensors are named like the are

for example the sensor

  daily_gas_useage:
    source: sensor.energiemonitor_total_gas
    name: Dagelijks gas
    cycle: daily

is named sensor.dagelijks_gas and not sensor.daily_gas_usage

2021-09-22 15:03:29 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.daily_energy_offpeak_produce
2021-09-22 15:03:29 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.daily_energy_peak_produce
2021-09-22 15:03:29 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.daily_energy_offpeak_useage
2021-09-22 15:03:29 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.daily_energy_peak_useage
2021-09-22 15:03:29 DEBUG (MainThread) [homeassistant.components.utility_meter] Setup utility_meter.daily_gas_useage
2021-09-22 15:03:52 DEBUG (MainThread) [homeassistant.components.utility_meter.sensor] <Dagelijks stroom (dal)> collecting from sensor.energiemonitor_total_power_export_t1
2021-09-22 15:03:52 DEBUG (MainThread) [homeassistant.components.utility_meter.sensor] <Dagelijks stroom (piek)> collecting from sensor.energiemonitor_total_power_export_t2
2021-09-22 15:03:52 DEBUG (MainThread) [homeassistant.components.utility_meter.sensor] <Dagelijks stroom (dal)> collecting from sensor.energiemonitor_total_power_import_t1
2021-09-22 15:03:52 DEBUG (MainThread) [homeassistant.components.utility_meter.sensor] <Dagelijks stroom (piek)> collecting from sensor.energiemonitor_total_power_import_t2
2021-09-22 15:03:52 DEBUG (MainThread) [homeassistant.components.utility_meter.sensor] <Dagelijks gas> collecting from sensor.energiemonitor_total_gas
1 Like