Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HA not able to restart when Power calc version 0.2xx #39

Closed
eddysteurs opened this issue Jun 28, 2021 · 9 comments
Closed

HA not able to restart when Power calc version 0.2xx #39

eddysteurs opened this issue Jun 28, 2021 · 9 comments

Comments

@eddysteurs
Copy link

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/powercalc/strategy_linear.py:55
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 13:29:09 (1 occurrences)
Last logged: 13:29:09

[139648910454256] 'type' object is not subscriptable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/components/hassio/init.py", line 505, in async_handle_core_service
errors = await conf_util.async_check_ha_config_file(hass)
File "/usr/src/homeassistant/homeassistant/config.py", line 904, in async_check_ha_config_file
res = await check_config.async_check_ha_config_file(hass)
File "/usr/src/homeassistant/homeassistant/helpers/check_config.py", line 212, in async_check_ha_config_file
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 "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "/config/custom_components/powercalc/init.py", line 28, in
from .strategy_linear import LinearStrategy
File "/config/custom_components/powercalc/strategy_linear.py", line 18, in
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

@bramstroker
Copy link
Owner

Thanks for reporting. @nepozs had exactly the same error. Could you please provide your configuration for the component? Will have a look into this soon. For now you could revert to version 0.1.6. This bug is introduced since 0.2.0

@eddysteurs
Copy link
Author

eddysteurs commented Jun 28, 2021 via email

@bramstroker
Copy link
Owner

I think I found the issue. @eddysteurs @nepozs Could you try the master branch in your installation?
When it is also resolved for you I will publish new version.

@nepozs
Copy link
Contributor

nepozs commented Jun 28, 2021

Just this leads to an error above (v0.2.1)

  - platform: powercalc
    entity_id: light.kuchnia1

and it is sensor working in v0.1.6

Full section - nearly all is now commented out:

sensor:
##  probably subject of next improvement and issue - Jiawen introducing itself as Feibit, and lots of spaces in manufacturer name
#  - platform: powercalc
#    entity_id: light.sufit_jiawen
## LED1649C5
#  - platform: powercalc
#    entity_id: light.swiecowa_e14_sypialnia

#  - platform: powercalc
#    entity_id: light.ikea_led1650r5
#  - platform: powercalc
#    entity_id: light.innr_test_rb175w
#  - platform: powercalc
#    entity_id: light.innr_test_rs125
  - platform: powercalc
    entity_id: light.kuchnia1
#  - platform: powercalc
#    entity_id: light.kuchnia3
#  - platform: powercalc
#    entity_id: light.lampka_biurkowa_biala
#  - platform: powercalc
#    entity_id: light.zyrandol_tv_k
    
#  - platform: powercalc
#    entity_id: light.wentylator
#    fixed:
#      power: 20.98
#    standby_usage: 0.44

@nepozs
Copy link
Contributor

nepozs commented Jun 28, 2021

Master looks working so I'm uncommenting configuratiion and returning to
#36

@bramstroker
Copy link
Owner

@eddysteurs Are you also able to test master and confirm that it's also working for you? Than I will create the new release.

@bramstroker
Copy link
Owner

Btw in the 0.2.X version the configuration for linear has changed.
Old configuration is still working but will be removed in some upcoming version.

You can update this:

- platform: powercalc
  entity_id: light.lamp_voordeur
  mode: linear
  min_watt: 0.5
  max_watt: 8

to

- platform: powercalc
  entity_id: light.lamp_voordeur
  linear:
    min_power: 0.5
    max_power: 8

@nepozs
Copy link
Contributor

nepozs commented Jun 28, 2021

I think that changes in configuration shoud be mentioned with release v0.2.2 and upcoming.
And please wait for me a moment - I will add 2 Ikea models if all tests pass.

@bramstroker
Copy link
Owner

I have published version 0.2.2 which should resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants