home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.89k stars 30.12k forks source link

Recorder error saying unknown unit #57685

Closed poldim closed 2 years ago

poldim commented 2 years ago

The problem

I received the error below. The solark sensor is referencing the HA units for solark_battery_state_of_charge, and similarly, the active_energy_integration_hourly & active_energy_integration_daily are defined by the time period of the integration component.

So I'm not sure why I'm getting this warning. It appears to be working correctly.

image

What is version of Home Assistant Core has the issue?

core-2021.10.4

What was the last working version of Home Assistant Core?

unknown

What type of installation are you running?

Home Assistant Container

Integration causing the issue

recorder

Link to integration documentation on our website

https://www.home-assistant.io/integrations/recorder/

Example YAML snippet

sensor:

- platform: integration
  source: sensor.pm8_active_power_total
  name: active_energy_integration_hourly
  unit_prefix: k
  unit_time: h
  round: 2

- platform: integration
  source: sensor.pm8_active_power_total
  name: active_energy_integration_daily
  unit_prefix: k
  unit_time: d
  round: 2

Anything in the logs that might be useful for us?

image

Logger: homeassistant.components.sensor.recorder
Source: components/sensor/recorder.py:264
Integration: Sensor (documentation, issues)
First occurred: 7:20:10 AM (3 occurrences)
Last logged: 7:20:10 AM

sensor.solark_battery_state_of_charge has unknown unit %
sensor.active_energy_integration_hourly has unknown unit kwh
sensor.active_energy_integration_daily has unknown unit kwd


### Additional information

_No response_
probot-home-assistant[bot] commented 2 years ago

integration documentation integration source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

recorder documentation recorder source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @dgomes, mind taking a look at this issue as it has been labeled with an integration (integration) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

probot-home-assistant[bot] commented 2 years ago

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (recorder) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

balloob commented 2 years ago

One issue I notice is that it's kWh, not kwh.

thecode commented 2 years ago

There is also no kWd (daily) unit

emontnemery commented 2 years ago

Closing since this is working as expected: kwh is misspelt kwd is not supported

issues with entities from a custom component should be raised with the custom component auther

poldim commented 2 years ago

One issue I notice is that it's kWh, not kwh.

@balloob I agree that the capitalization doesn't match, but I'm not setting that, it's set automagically by the sensor integration platform

poldim commented 2 years ago

Closing since this is working as expected: kwh is misspelt kwd is not supported

issues with entities from a custom component should be raised with the custom component auther

@emontnemery Am I misunderstanding that this should work from the integration sensor? image

dgomes commented 2 years ago

The integration sensor is picking up w and not W from the custom component. It must be fixed in the custom component.

poldim commented 2 years ago

The integration sensor is picking up w and not W from the custom component. It must be fixed in the custom component.

What custom component are you referring to?

The raw metering data is coming from my power meter via a modbus sensor with a correctly set capital W for the units. Then I'm piping that into the integration sensor to get watt hours or watt days. They are adjusted to k with the unit prefix configuration to get total kw per day and per hour.

modbus:
  - name: "pm8210"
    type: tcp
    host: 10.30.30.30
    port: 502
    sensors:
      - name: PM8 Active Power Total
        unit_of_measurement: W
        device_class: power
        slave: 1
        address: 3059
        count: 2
        precision: 2
        input_type: holding
        data_type: float
        scan_interval: 10
dgomes commented 2 years ago

In your initial comment you mention "The solark sensor" and have linked a custom_component repository...

Can you share the graph and properties of that modbus sensor ?

poldim commented 2 years ago

In your initial comment you mention "The solark sensor" and have linked a custom_component repository... Oh, gotcha. I thought it would be clear from the sensor name but I guess I should have pointed out that only one of the three is from the custom component and the other two are modbus sensors. For the custom component, I've created an issue in that project here. I tried to see if I could spot the issue in that code but he's correctly pulling % matching the HA format per the docs.

Can you share the graph and properties of that modbus sensor ?

image

image I'm not sure if this is what you meant by properties, let me know if you need something else

thecode commented 2 years ago

I must say I try to follow up and it looks like there is some miss communication here. @poldim I suggest you open a new issue, try to describe your problem as accurate as possible, without referring to custom components or using unsupported units (which is all what I see was the issue in the first place).