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
73.19k stars 30.57k forks source link

Homewizard: No support for Long Term Statistics on the Peak Demand entity #121420

Closed RaZz85 closed 3 months ago

RaZz85 commented 3 months ago

The problem

The peak demand sensor for HomeWizard seems to be missing the state_class attribute. Since this value is used by the energy supplier to calculate the yearly invoice, most users will want tot keep this data longer than the default recorder setting, and even longer than a year to be able to monitor the evolution. To do this, the entity will need the attribute added: state_class: measurement

What version of Home Assistant Core has the issue?

core-2024.7.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Homewizard

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 3 months ago

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

Code owner commands Code owners of `homewizard` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign homewizard` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


homewizard documentation homewizard source (message by IssueLinks)

mib1185 commented 3 months ago

which sensor exactly do you mean? please provide the state details of this entity from the developer tools states tab, thx :+1:

RaZz85 commented 3 months ago

Hi,

As found in the documentation for Homewizard (https://www.home-assistant.io/integrations/homewizard/), it's the sensors detailed in "Peak demand". On my instance the entity received the name "sensor.p1_meter_3c39e7253554_piekverbruik_huidige_maand": unit_of_measurement: W device_class: power friendly_name: P1 meter (3c39e7253554) Piekverbruik huidige maand

I've checked the code and this would be the sensor "monthly_power_peak_w", which I think would require a line " state_class=SensorStateClass.MEASUREMENT,". How ever, I'm not certain how to test this myself to submit a PR, and I don't want to merge untested code...

mib1185 commented 3 months ago

OK, this is by design - see available state classes on our developer docs

The state represents a measurement in present time, not a historical aggregation such as statistics or a prediction of the future.

reference: https://github.com/home-assistant/core/pull/85198#discussion_r1070642228 and https://github.com/home-assistant/core/pull/85198#discussion_r1070642239

RaZz85 commented 3 months ago

Ah. That's unfortunate. I'll have to figure out a different way of storing these for a year, since the invoice period is calculated over a full year, and the standard recorder period sadly makes this entity less useful than it could be. Thank you very much for checking, though!

RaZz85 commented 3 months ago

Close.issue