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
72.15k stars 30.19k forks source link

history_stats does not warn you if entity_id does not exist #121044

Open rahatarmanahmed opened 3 months ago

rahatarmanahmed commented 3 months ago

The problem

I accidentally misspelled the entity_id in my history_stats configuration.

sensor:
  - platform: history_stats
    name: HVAC Heating Last 24 Hrs
    entity_id: sensor.any_thermostat_is_heating
    state: "on"
    type: time
    end: "{{ now() }}"
    duration:
      hours: 24

Turns out I meant to use entity_id: binary_sensor.any_thermostat_is_heating. Unfortunately nothing in the logs helped me realize my mistake, I just had to notice it on my own. Ideally something would validate the entity_id listened to.

What version of Home Assistant Core has the issue?

2024.4.4

What was the last working version of Home Assistant Core?

No response

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: HVAC Heating Last 24 Hrs
    entity_id: sensor.any_thermostat_is_heating
    state: "on"
    type: time
    end: "{{ now() }}"
    duration:
      hours: 24

Anything in the logs that might be useful for us?

Nothing, that's the problem :(

Additional information

No response

home-assistant[bot] commented 3 months ago

history_stats documentation history_stats source

issue-triage-workflows[bot] commented 4 days ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.