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

[Bug]: Attribute error in code handling optimizers, #98

Closed
rtasarz opened this issue Jul 28, 2022 · 0 comments
Closed

[Bug]: Attribute error in code handling optimizers, #98

rtasarz opened this issue Jul 28, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@rtasarz
Copy link

rtasarz commented Jul 28, 2022

System Health details

System Health

version core-2022.7.7
installation_type Home Assistant Core
dev false
hassio false
docker false
virtualenv true
python_version 3.10.5
os_name Linux
arch x86_64

Huawei Solar Setup

Inverter with optimizers

Describe the issue

Looks like untested code has sneaked in. Changing optimizer.id to optimizer_id in line 774 of sensor.py fixes the issue.

Reproduction steps

  1. Configured integration with active optimizers

Relevant debug logs

Jul 28 16:14:50 ha hass[2668]: Traceback (most recent call last):
Jul 28 16:14:50 ha hass[2668]:   File "./lib/python3.10/site-packages/homeassistant/helpers/entity_platform.py", line 258, in _async_setup_platform
Jul 28 16:14:50 ha hass[2668]:     await asyncio.gather(*pending)
Jul 28 16:14:50 ha hass[2668]:   File "./lib/python3.10/site-packages/homeassistant/helpers/entity_platform.py", line 397, in async_add_entities
Jul 28 16:14:50 ha hass[2668]:     await asyncio.gather(*tasks)
Jul 28 16:14:50 ha hass[2668]:   File "./lib/python3.10/site-packages/homeassistant/helpers/entity_platform.py", line 641, in _async_add_entity
Jul 28 16:14:50 ha hass[2668]:     await entity.add_to_platform_finish()
Jul 28 16:14:50 ha hass[2668]:   File "./lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 776, in add_to_platform_finish
Jul 28 16:14:50 ha hass[2668]:     self.async_write_ha_state()
Jul 28 16:14:50 ha hass[2668]:   File "./lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
Jul 28 16:14:50 ha hass[2668]:     self._async_write_ha_state()
Jul 28 16:14:50 ha hass[2668]:   File "./lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 569, in _async_write_ha_state
Jul 28 16:14:50 ha hass[2668]:     available = self.available  # only call self.available once per update cycle
Jul 28 16:14:50 ha hass[2668]:   File "~/.homeassistant/custom_components/huawei_solar/sensor.py", line 774, in available
Jul 28 16:14:50 ha hass[2668]:     or self.coordinator.data[self.optimizer.id].running_status
Jul 28 16:14:50 ha hass[2668]: AttributeError: 'HuaweiSolarOptimizerSensorEntity' object has no attribute 'optimizer'
@rtasarz rtasarz added the bug Something isn't working label Jul 28, 2022
@wlcrs wlcrs closed this as completed in a16b873 Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant