sockless-coding / panasonic_cc

Panasonic Comfort Cloud - Home Assistant Component
MIT License
140 stars 35 forks source link

Error in rounding current power #21

Closed michelcve closed 3 years ago

michelcve commented 3 years ago

As of v1.0.21 there seems to be an error in rounding the current power.

Stacktrace:

2020-12-22 14:06:20 ERROR (MainThread) [homeassistant.config_entries] Error sett                                                                                                             ing up entry  for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in as                                                                                                             ync_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", lin                                                                                                             e 67, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line                                                                                                              140, in async_setup_entry
    platform = await async_prepare_setup_platform(
  File "/usr/src/homeassistant/homeassistant/setup.py", line 298, in async_prepa                                                                                                             re_setup_platform
    platform = integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 424, in get_platfo                                                                                                             rm
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 429, in _import_pl                                                                                                             atform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_mod                                                                                                             ule
    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 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 779, in exec_module
  File "<frozen importlib._bootstrap_external>", line 916, in get_code
  File "<frozen importlib._bootstrap_external>", line 846, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/panasonic_cc/sensor.py", line 130
    return round(self._api.current_power,2)M,|m,

Replacing line 130 in sensors.py from:

return round(self._api.current_power,2)M,|m,

to

return round(self._api.current_power,2)

made everything work again (or so it seams).

sockless-coding commented 3 years ago

@michelcve I've removed the random characters that seemed to have ended up there and released a new version.

michelcve commented 3 years ago

@sockless-coding Yep, that seems to fix it. Thanks!