iprak / yahoofinance

Home Assistant component which allows you to get stock updates from Yahoo finance.
MIT License
81 stars 11 forks source link

HA 2021.12.1 "device_state_attributes" warning #59

Closed AdmiralStipe closed 2 years ago

AdmiralStipe commented 2 years ago

At every restart, the following warning appears:

2021-12-13 10:41:26 WARNING (MainThread) [homeassistant.helpers.entity] Entity sensor.yahoofinance_gc_f (<class 'custom_components.yahoofinance.sensor.YahooFinanceSensor'>) implements device_state_attributes. Please report it to the custom component author.

Not sure, if it wil be deprecated in near future or something else, just notyfing the author as instructed :).

iprak commented 2 years ago

What is your version of HA ?

AdmiralStipe commented 2 years ago

Well, I did write it in the title already :) Now it's 2021.12.1, but the warning was the same with 2021.12.0.

As far as I understand, the device_state_attributes is/will be deprecated... I tried to fix it locally and just changed the line 147 in sensor.py from: def device_state_attributes(self) -> Union[Mapping[str, Any], None]: to: def extra_state_attributes(self) -> Union[Mapping[str, Any], None]:

Seems to be working OK for now.

iprak commented 2 years ago

Sorry I completely missed the version in the title. I was just reading the docs and yes that's what needs to be done. I will check other properties and do that later today.