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
74.03k stars 31.06k forks source link

History Stats Sensor creates wrong data #128458

Open Loader23 opened 1 month ago

Loader23 commented 1 month ago

The problem

Hi, my history stats sensor is not working correctly. Iam having this Issue since 2 Years and could work around it with an old custom integration of history stats. Now the HA Log says: _TIME_HOURS was used from historystats, this is a deprecated constant which will be removed in HA Core 2025.1 So I thought it would have been fixed by now, but thats not the case:

History

As soon as I activate the Switch it goes from 0 to over 400.000.

What version of Home Assistant Core has the issue?

2024.10.2

What was the last working version of Home Assistant Core?

June, 2022

What type of installation are you running?

Home Assistant Container

Integration causing the issue

History Stats

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

sensor:
  - platform: history_stats
    name: Test History
    entity_id: switch.stecker_1
    state: 'on'
    type: time
    start: '{{ 0 }}'
    end: '{{ now() }}'

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 month ago

history_stats documentation history_stats source

turbobas commented 1 month ago

I have the same problem after upgrading to 2024.10.2

DoGithDo commented 2 weeks ago

After some experimenting with my own configuration, this seems to happen:

DoGithDo commented 2 weeks ago

@cdce8p history_stats has no Integration Owner. I am missing knowledge to do it myself. Something for you?

karwosts commented 6 days ago

I believe this will be fixed by https://github.com/home-assistant/core/pull/126271