core
core copied to clipboard
Repair: Entities no longer have a state class, DELETE in repair does nothing
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
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.
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.
Test confirmed.
started on 2024.10.0.
Sequence:
- Added
state_classto entities in code - Restarted
- Waited ~12 hours
- Removed
state_classfrom entities - Restarted
- Repair suggestions eventually showed up
- Pressing
DELETEdoes not execute the repair, just closes the dialogue - Upgraded to 2024.10.1
- Repair suggestions eventually showed up
- Pressing
DELETEdoes not execute the repair, just closes the dialogue
For me the delete button on the entity itself is greyed out and unable to be pressed.
Sounds like a completely different issue, @xanderio.
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.