Giter Site home page Giter Site logo

Comments (19)

bramstroker avatar bramstroker commented on August 12, 2024

I think the folder name gives issues because of the slash in the name.

Will give this some thought how to do this cleanly. Maybe we can introduce a model mapping, same as for the manufacturers, as you also suggested.

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 12, 2024

I have added model mapping possibility. It's merged on the master branch. Could you check if this works for you?

from homeassistant-powercalc.

nepozs avatar nepozs commented on August 12, 2024

I would try it but after update to v0.2.0 (and this also applies to the master) it is impossible to restart HA with error(s):
The system cannot restart because the configuration is not valid: Platform error sensor.powercalc - No module named 'config.custom_components'

only way is to comment out all powercalc occurences in configuratin.yaml, but then component does not work, so I have to revert back to v0.1.6.

BTW I've prepared next 2 LUT files - for LED1649C5 and TRADFRI bulb GU10 W 400lm (LED1650R5), so I will prepare next PR if I could test model directory mapping (and maybe it's time to decide if all long named models should use it).

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 12, 2024

I have this same error with the latest version on my "production" home assistant instance. In my development environment everything was working fine.
Made a potential fix, it is released as 0.2.1. Had to do a release because version 0.2.0 was broken. This also contains the model mapping feature. Could you please check if this works for you?

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 12, 2024

Also you will get deprecation warnings in your logs with the new version.
When you also use linear or fixed mode configuration you need to make a small modification in your configuration. But you are only using lut mode, right?

from homeassistant-powercalc.

nepozs avatar nepozs commented on August 12, 2024

v0.2.1 Still lots of errors, so impossible to restart HA (I've truncated log, but rest looks similiar)

main reason blocking restart is TypeError: 'type' object is not subscriptable

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 98, in async_setup_component
    return await task  # type: ignore
  File "/usr/src/homeassistant/homeassistant/setup.py", line 208, in _async_setup_component
    processed_config = await conf_util.async_process_component_config(
  File "/usr/src/homeassistant/homeassistant/config.py", line 853, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 498, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 503, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/powercalc/__init__.py", line 28, in <module>
    from .strategy_linear import LinearStrategy
  File "/config/custom_components/powercalc/strategy_linear.py", line 18, in <module>
    class LinearStrategy(PowerCalculationStrategyInterface):
  File "/config/custom_components/powercalc/strategy_linear.py", line 55, in LinearStrategy
    def get_min_calibrate(self, value: int) -> tuple[int, float]:
TypeError: 'type' object is not subscriptable
2021-06-28 12:08:47 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 98, in async_setup_component
    return await task  # type: ignore
  File "/usr/src/homeassistant/homeassistant/setup.py", line 208, in _async_setup_component
    processed_config = await conf_util.async_process_component_config(
  File "/usr/src/homeassistant/homeassistant/config.py", line 853, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 498, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 503, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/powercalc/__init__.py", line 28, in <module>
    from .strategy_linear import LinearStrategy
  File "/config/custom_components/powercalc/strategy_linear.py", line 18, in <module>
    class LinearStrategy(PowerCalculationStrategyInterface):
  File "/config/custom_components/powercalc/strategy_linear.py", line 55, in LinearStrategy
    def get_min_calibrate(self, value: int) -> tuple[int, float]:
TypeError: 'type' object is not subscriptable
2021-06-28 12:08:47 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/setup.py", line 91, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1056, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 98, in async_setup_component
    return await task  # type: ignore
  File "/usr/src/homeassistant/homeassistant/setup.py", line 208, in _async_setup_component
    processed_config = await conf_util.async_process_component_config(
  File "/usr/src/homeassistant/homeassistant/config.py", line 853, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 498, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 503, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/powercalc/__init__.py", line 28, in <module>
    from .strategy_linear import LinearStrategy
  File "/config/custom_components/powercalc/strategy_linear.py", line 18, in <module>
    class LinearStrategy(PowerCalculationStrategyInterface):
  File "/config/custom_components/powercalc/strategy_linear.py", line 55, in LinearStrategy
    def get_min_calibrate(self, value: int) -> tuple[int, float]:
TypeError: 'type' object is not subscriptable

When you also use linear or fixed mode configuration you need to make a small modification in your configuration. But you are only using lut mode, right?

I've read updated documentation so in case of fixed mode I've changed

  - platform: powercalc
    entity_id: light.wentylator
    mode: fixed
    watt: 20.98
    standby_usage: 0.44

to

  - platform: powercalc
    entity_id: light.wentylator
    fixed:
      power: 20.98
    standby_usage: 0.44

All other cases are LUT (and autodetect by Hue).

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 12, 2024

Strange, not at home atm, will have a look soon.
Is this after restarting?

from homeassistant-powercalc.

nepozs avatar nepozs commented on August 12, 2024

I can only test reboot machine, because uncommenting any part of integration section (in sensors, configuration.yaml) blocks HA restart, but as I know after reboot non-working integration will be disabled by HA (or HA will not start at all).

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 12, 2024

Could you please make a new issue for this error, and include your full configuration please of the powercalc sensors? I can have a look within a few hours.

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 12, 2024

Already issue created by other user: #39
Could you post your configuration there @nepozs?

from homeassistant-powercalc.

nepozs avatar nepozs commented on August 12, 2024

All my test in real environement pass, so maybe it's time to decide if all long named models should use model mapping or will it better be to use mapping only in exceptional circumstances?

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 12, 2024

I would suggest to add a mapping for models which have a clear model ID provided by the manufacturer, but a very long zigbee ID. This is the case for the IKEA lights. So in order to have a consistent naming my preference would be to create a mapping record for all ikea lights.

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 12, 2024

Could you update the PR accordingly?

from homeassistant-powercalc.

nepozs avatar nepozs commented on August 12, 2024

Yes, I will do it.

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 12, 2024

thanks

from homeassistant-powercalc.

nepozs avatar nepozs commented on August 12, 2024

I have found small error in documentation:
"The file MUST not contain a header row."
shoud be
"The file MUST contain a header row."

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 12, 2024

Good catch. I have changed it.

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on August 12, 2024

Fyi, I have create a script which automatically generates a list of supported light models. No need to add them anymore in readme.md when you add a new one.

https://github.com/bramstroker/homeassistant-powercalc/blob/master/docs/supported_models.md

from homeassistant-powercalc.

nepozs avatar nepozs commented on August 12, 2024

Thanks, it will be really easier to maintan documentation.

from homeassistant-powercalc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.