Skip to content

Energy Dashboard - Gas Sensor in kWh not accepted #14397

Description

@Dan-northwind

Checklist

  • I have updated to the latest available Home Assistant version.
  • I have cleared the cache of my browser.
  • I have tried a different browser to see if it is related to my browser.

Describe the issue you are experiencing

I have a gas usage sensor that is providing data from my smart meter. This provides a value in kWh,

When I try and add this sensor to the energy dashboard config I receive the following error:

http://homeassistant:8123/config/energy

Unexpected unit of measurement
The following entities do not have the expected units of measurement 'Wh', 'kWh', 'MWh' or 'GJ' for an energy sensor or 'm³' or 'ft³' for a gas sensor:

Describe the behavior you expected

I would have expected I could add a Gas Source in kWh

Steps to reproduce the issue

Open energy dashboard config, and click on add a gas source.

Select the sensor from the list (with a unit_of_measurement: "GBP/kWh" and a device_class: gas)

Then the error appears

What version of Home Assistant Core has the issue?

2022.11.2

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Google Chrome version 107.0.5304.107 (Official Build) (64-bit)

Which operating system are you using to run this browser?

Windows 10 Version 21H2

State of relevant entities

No response

Problem-relevant frontend configuration

template:
  - sensor:
      - name: gasconsumptiontotal
        unique_id: gastotal
        unit_of_measurement: "kWh"
        device_class: gas
        state_class: total_increasing
        state: "{{ states('sensor.gas') }}"

      - name: gascostperkWh
        unique_id: gascostperkWh
        unit_of_measurement: "GBP/kWh"
        device_class: gas
        state_class: total
        state: "{{ states('sensor.gas_price') }}"

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions