lolouk44 / CurrentCost_HA_CC

CurrentCost Meter Reading Custom Component for Home Assistant
16 stars 7 forks source link

POWER_WATT was used from currentcost, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfPower.WATT instead #25

Open vw-kombi opened 7 months ago

vw-kombi commented 7 months ago

name: Bug report about: Create a report to help us improve title: '' labels: bug assignees: ''


Describe the bug 2024-01-21 13:12:17.417 WARNING (MainThread) [homeassistant.const] POWER_WATT was used from currentcost, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfPower.WATT instead, please create a bug report at https://github.com/lolouk44/CurrentCost_HA_CC/issues

To Reproduce restart HA - warning from the core relating to this.

Expected behaviour no warning on startup

Screenshots If applicable, add screenshots to help explain your problem.

Desktop/Server/Device (please complete the following information):

Additional context Add any other context about the problem here.

Logs Please set the Current Cost Custom Component's logging level to debug and provide relevant logs section from Home-Assistant. To Enable debug logging level, add this to your configuration.yaml and restart:

logger:
  default: error
  logs:
    custom_components.currentcost: debug
Majestic7979 commented 6 months ago

Hi @lolouk44 I hope you're doing well. I am not tagging you to rush you. Just wanted to say I was about to post the same issue, saw this. I have it too. The sensor is no longer reporting the watts, I've lost monitoring. The serial device is still showing in /dev/serial/by-id folder and it's mounted to the HA container just as before.

snarby2013 commented 3 months ago

Hi, I edited sensor.py in custom_components/currentcost changing POWER_WATT at the end of line 11 to UnitOfPower, like this

from homeassistant.const import CONF_NAME, CONF_UNIQUE_ID, CONF_DEVICES, EVENT_HOMEASSISTANT_STOP, UnitOfPower

and also changed line 62 POWER_WATT to UnitOfPower.WATT and it has fixed the error

self._unit = UnitOfPower.WATT
vw-kombi commented 3 months ago

UnitOfPower

That seems to have fixed this for me - Thanks.

tranbert commented 7 hours ago

Good shot, thank you !