Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: sensor: state_class_removed for all humidity sensors #306

Closed
coreGreenberet opened this issue Oct 3, 2024 · 10 comments · Fixed by #308
Closed

[Bug]: sensor: state_class_removed for all humidity sensors #306

coreGreenberet opened this issue Oct 3, 2024 · 10 comments · Fixed by #308

Comments

@coreGreenberet
Copy link

Describe the bug

After upgrading to HomeAssistant 2024.10.0 I'm receiving this warning for all humidity sensors:

sensor.luftfeuchte Verfügt nicht mehr über eine Zustandsklasse
sensor: state_class_removed

grafik

Firmware of your Miniserver

15.1.8.20

HomeAssistant install method

HASSIO

Version of HomeAssistant

2024.10.0

Version of Pyloxone

0.6.15

Update pyloxone

is already latest

Log

Settings for the log can be found on the main page under the section Log Configuration

@JoDehli
Copy link
Owner

JoDehli commented Oct 3, 2024

@coreGreenberet is it a normal sensor or a custom sensor.

@coreGreenberet
Copy link
Author

It's the normal touch tree

@coreGreenberet
Copy link
Author

Now there is more info in the "repair" part of HA:

We have generated statistics for 'Luftfeuchte' (sensor.luftfeuchte) in the past, but it no longer has a state class, therefore, we cannot track long term statistics for it anymore.

Statistics cannot be generated until this entity has a supported state class.

    If the state class was previously provided by an integration, this might be a bug. Please report an issue.
    If you previously set the state class yourself, please correct it.[ The different state classes and when to use which can be found in the developer documentation.](https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics)
    If the state class has permanently been removed, you may want to delete the long term statistics of it from your database.

Do you want to permanently delete the long term statistics of sensor.luftfeuchte from your database?

looks like it is missing state_class: measurement

@JoDehli
Copy link
Owner

JoDehli commented Oct 3, 2024

@coreGreenberet humidity sensors does not get a state class by default. You have to set it if you want to use the statistics. It is not a bug. I have at the moment no possibility to set the state class correctly for humidity sensors.

@hatl
Copy link

hatl commented Oct 3, 2024

I can confirm this behavior for:
humidity sensors and the battery capacity of door/window contacts
@JoDehli PyLoxone could the state_class for both to "measurement" to fix the issue, correct?

@JoDehli JoDehli removed the bug label Oct 4, 2024
@JoDehli
Copy link
Owner

JoDehli commented Oct 4, 2024

@hatl
@coreGreenberet

Of course this would fix the problem.

Why is it not so easy to automatically assign all the needed parameters:

When a sensor is created I need the information what sensor type it is. For example a Temperature
sensor. I the unit is formatted right on the loxone side i can try to parse the unit and guess that it is
a temperature sensor. But with the humidity and the capacity of a battery there is only the % as unit.
In the past I guessed the % unit as a humidity sensor and some people had the problem with there battery
sensor showed up as humidity sensor.

So I do not really see a perfect way to solve this problem for all users. The only way to solve it at the moment is
to it manually for each humidity or battery sensor.

@JoDehli
Copy link
Owner

JoDehli commented Oct 4, 2024

@hatl @coreGreenberet

can you try the version from the 306-bug-sensor-state_class_removed-for-all-humidity-sensors

I tried to set at least the state_class to measurement for both types of sensors.

@coreGreenberet
Copy link
Author

Warnings in HA are gone and so far everything is working =)

thanks

@hatl
Copy link

hatl commented Oct 4, 2024

I can also confirm: warnings are gone - thanks!

@JoDehli
Copy link
Owner

JoDehli commented Oct 5, 2024

@hatl @coreGreenberet

I integrate it in the next release.

Thanks for your help.

@JoDehli JoDehli linked a pull request Oct 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants