homeassistant-midea-dehumidifier icon indicating copy to clipboard operation
homeassistant-midea-dehumidifier copied to clipboard

Usage of device_state_attributes is deprecated in Home Assistant 2021.12.0

Open mcv93us opened this issue 3 years ago • 4 comments

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.

mcv93us avatar Dec 12 '21 14:12 mcv93us

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

HVPereira avatar Dec 12 '21 15:12 HVPereira

I solved by reading this post: https://github.com/thomasloven/hass-browser_mod/pull/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!

mcv93us avatar Dec 14 '21 23:12 mcv93us

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

drthanwho avatar Dec 23 '21 13:12 drthanwho

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

sprocket7 avatar Jun 02 '22 17:06 sprocket7

merged

barban-dev avatar Jan 05 '24 18:01 barban-dev