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

Usage of device_state_attributes is deprecated in Home Assistant 2021.12.0 #45

Closed
mcv93us opened this issue Dec 12, 2021 · 5 comments
Closed

Comments

@mcv93us
Copy link

mcv93us commented Dec 12, 2021

According to Home Assistant 2021.12.0, the use of device_state_attributes has been deprecated. I think extra_state_attributes should be used from now on (see Home Assistant's Github Beta channel for more info).

Environment
Supervised home assistant 2021.12.0

Steps to reproduce
Upgrade from Home Assistant 2021.11.5 to 2021.12.0
In the log log is the following error:

Logger: homeassistant.helpers.entity
Source: helpers / entity.py: 549
First occurred: 14:33:13 (5 occurrences)
Last logged: 14:35:13

Entity humidifier.midea_dehumidifier_xxxxxxxxxxxxxx (<class 'custom_components.midea_dehumidifier.humidifier.MideaDehumidifierDevice'>) implements device_state_attributes. Please report it to the custom component author.

@HVPereira
Copy link

Do you know if we can just replace the code on entity.py and fix it?

@mcv93us
Copy link
Author

mcv93us commented Dec 14, 2021

I solved by reading this post:
thomasloven/hass-browser_mod#276
and changing line 272 of the humidifier.py file from
def device_state_attributes(self):
to
def extra_state_attributes(self):
after a restart of HA the error is gone!

@drthanwho
Copy link
Contributor

I made a PR #42 for it already a month ago when this change was still in the dev branch but unfortunately @barban-dev hasn't updated the code yet

@sprocket7
Copy link

You saved my life ;-) Or rather, my basement is saved! Many Thanks

@barban-dev
Copy link
Owner

merged

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

No branches or pull requests

5 participants