core icon indicating copy to clipboard operation
core copied to clipboard

Repair: Entities no longer have a state class, DELETE in repair does nothing

Open autoSteve opened this issue 1 year ago • 5 comments

The problem

The suggested repair for an entity no longer having a state_class appears broken, despite being 'fixed' in a 2024.10 beta.

Pressing DELETE closes the dialogue, yet does not repair the issue.

Removing the old statistics from developer tools works fine, and as a flow-on removed the suggested repair as expected.

A quick reproduction does not appear possible, so this may be a longer game. Of the code proposed below I will run the state_class change until values flow to LTS, then I will revert and re-test the repair suggestion.

Will keep you posted.

Original code:

    "total_kwh_forecast_tomorrow": SensorEntityDescription(
        key="total_kwh_forecast_tomorrow",
        device_class=SensorDeviceClass.ENERGY,
        native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
        translation_key="total_kwh_forecast_tomorrow",
        name="Forecast Tomorrow",
        icon="mdi:solar-power",
        suggested_display_precision=2,
    ),

New code proposed (which caused me to encounter this because it had been reverted some time ago without me noticing the hang-over in developer tools - thanks for adding the in-your-face nag!).

    "total_kwh_forecast_tomorrow": SensorEntityDescription(
        key="total_kwh_forecast_tomorrow",
        device_class=SensorDeviceClass.ENERGY,
        native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
        translation_key="total_kwh_forecast_tomorrow",
        name="Forecast Tomorrow",
        icon="mdi:solar-power",
        suggested_display_precision=2,
        state_class=SensorStateClass.TOTAL,
    ),

cc: @joostlek

What version of Home Assistant Core has the issue?

2024.10.0

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

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Nothing relevant in the logs, so no exceptions thrown.

Additional information

No response

autoSteve avatar Oct 04 '24 10:10 autoSteve

Interestingly, while poking in developer tools I saw this entity with a similar recording state as the sensors that I broke by reverting code.

This issue does not have an in-your-face 'repair' suggested for it, simply linking an information dialogue in dev. tools.

image image

autoSteve avatar Oct 04 '24 10:10 autoSteve

Delete button is not working for me either. Once it starts working, it would be nice if there were a "delete all" button so I don't have to do it 70 times. HA is an awesome system though and it's worth it having to click 70 times.

BrianMcBrayer avatar Oct 04 '24 14:10 BrianMcBrayer

Test confirmed.

started on 2024.10.0.

Sequence:

  1. Added state_class to entities in code
  2. Restarted
  3. Waited ~12 hours
  4. Removed state_class from entities
  5. Restarted
  6. Repair suggestions eventually showed up
  7. Pressing DELETE does not execute the repair, just closes the dialogue
  8. Upgraded to 2024.10.1
  9. Repair suggestions eventually showed up
  10. Pressing DELETE does not execute the repair, just closes the dialogue

autoSteve avatar Oct 05 '24 03:10 autoSteve

For me the delete button on the entity itself is greyed out and unable to be pressed.

xanderio avatar Oct 08 '24 09:10 xanderio

Sounds like a completely different issue, @xanderio.

autoSteve avatar Oct 09 '24 11:10 autoSteve

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.