sla89 / hassio-kostal-piko

Home Assistant Kostal PIKO Inverter Integration
MIT License
13 stars 4 forks source link

Hello, is it possible to fix this for next year's version #15

Closed Thunderbird1982 closed 9 months ago

Thunderbird1982 commented 10 months ago

Logger: homeassistant.const Source: helpers/deprecation.py:204 First occurred: 13:18:59 (7 occurrences) Last logged: 13:18:59

POWER_KILO_WATT was used from kostal_piko, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfPower.KILO_WATT ELECTRIC_POTENTIAL_VOLT was used from kostal_piko, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfElectricPotential.VOLT TIME_HOURS was used from kostal_piko, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTime.HOURS

ELECTRIC_CURRENT_AMPERE was used from kostal_piko, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfElectricCurrent.AMPERE

FREQUENCY_HERTZ was used from kostal_piko, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfFrequency.HERTZ

thanks Adrian

sla89 commented 10 months ago

Hey, thanks for the report. For sure, I will fix that 👍

Would it be possivle that you test the chances when I make them?

patricknitsch commented 10 months ago

Hi,

I got the same log. So if you need somebody to test it, I can support :)

sla89 commented 9 months ago

Hi @patricknitsch and @Thunderbird1982

I have created the fix at branch fix_issue_15.

The easiest way to test it is to replace the content of the file const.py - you can find it here: https://github.com/sla89/hassio-kostal-piko/blob/fix_issue_15/custom_components/kostal_piko/const.py

Waiting for your feedback before creating a new release.

Thank you.

patricknitsch commented 9 months ago

I tested it. I didn't get a warning, but a fault. See my log below.


Logger: homeassistant.loader Source: loader.py:842 First occurred: 00:29:24 (1 occurrences) Last logged: 00:29:24

Unexpected exception importing platform custom_components.kostal_piko.sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 842, in get_platform cache[full_name] = self._import_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 859, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1204, in _gcd_import File "", line 1176, in _find_and_load File "", line 1147, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "/config/custom_components/kostal_piko/sensor.py", line 21, in from .const import ( File "/config/custom_components/kostal_piko/const.py", line 99, in native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, ^^^^^^^^^^^^^^^^^^^^^ NameError: name 'UnitOfElectricCurrent' is not defined


Is there anything missing?

sla89 commented 9 months ago

Ahh forgot to import UnitOfElectricCurrent.

I have updated the const.py file. Can you please give it another try?

Thank you for the fast feedback!

patricknitsch commented 9 months ago

I added it in my file. "UnitOfEnergy" was also missing. Now it works. I got no error.

sla89 commented 9 months ago

Sorry 🙈 I was too tired I guess 🙈 Thank you for testing. I will make the changes in the evening and create a new release

patricknitsch commented 9 months ago

No Problem. Thank you as well for your work. Glad I could help :)

sla89 commented 9 months ago

@patricknitsch can you maybe give the const.py of my branch another try, please? If it is now working I will create the release. Thank you.

patricknitsch commented 9 months ago

It works now! Good Job!

sla89 commented 9 months ago

Thank you. Release v1.20 is now available

Thunderbird1982 commented 9 months ago

thank you for the fix works perfect