Comments (19)
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.
I have added model mapping possibility. It's merged on the master branch. Could you check if this works for you?
from homeassistant-powercalc.
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.
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.
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.
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.
Strange, not at home atm, will have a look soon.
Is this after restarting?
from homeassistant-powercalc.
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.
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.
Already issue created by other user: #39
Could you post your configuration there @nepozs?
from homeassistant-powercalc.
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.
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.
Could you update the PR accordingly?
from homeassistant-powercalc.
Yes, I will do it.
from homeassistant-powercalc.
thanks
from homeassistant-powercalc.
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.
Good catch. I have changed it.
from homeassistant-powercalc.
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.
Thanks, it will be really easier to maintan documentation.
from homeassistant-powercalc.
Related Issues (20)
- "All standby power" / energy entities do not link back to Powercalc integration HOT 3
- Philips Hue Bloom LC001 HOT 6
- JSONDecodeError and not a valid ColorMode Error during startup since v1.12.12 HOT 15
- Error while dispatching HOT 9
- ability to enter power-on consumption for 'Sonof ZBmini01' via the configure GUI HOT 3
- Why is powercalc trying to reach the internet after installation and setup? HOT 9
- Thanks for the contribution, makes sense to add the alias as you also verified the power draw is similar. HOT 2
- cant delete entries on the integration HOT 9
- Energy sensor have mixed kWh or Wh as unit HOT 10
- light_setting.hue = int(hs[0] / 360 * 65535) ~~^^^ TypeError: 'NoneType' object is not subscriptable HOT 4
- Innr outdoor lights
- Adopt powercalc to change in device info HOT 1
- Add IKEA LED2104R3 GU10 bulb
- Support for multiple-outlet smart outlets and smart strips HOT 20
- Energy sum to retrieve untracked energy HOT 2
- Option flow cleanup HOT 1
- More than 130 powercalc light entities per room. Why? HOT 11
- Adding my autodectected TP-Link HS300 results in exception HOT 4
- A sensor grouping power sensors went crazy HOT 5
- Allow edit of disabled PowerCalc entry HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homeassistant-powercalc.