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

Entity creation aborted when battery level is 0 #11

Open
bartbakels opened this issue Jan 23, 2023 · 2 comments
Open

Entity creation aborted when battery level is 0 #11

bartbakels opened this issue Jan 23, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@bartbakels
Copy link

Hi;

i see an issue when adding my first bold lock. I suspect due to the fact the battery value is not yet populated. I see in the app its still calibrating the battery value.

refer to this error

Logger: homeassistant
Source: custom_components/bold/lock.py:66
Integration: Bold
First occurred: 17:43:27 (2 occurrences)
Last logged: 17:48:36

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 424, in async_add_entities
tasks = [
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 424, in
tasks = [
File "/config/custom_components/bold/lock.py", line 50, in
BoldLockEntity(coordinator=coordinator, data=lock) for lock in locks
File "/config/custom_components/bold/lock.py", line 66, in init
"battery_level": data[CONF_BATTERY_LEVEL],
KeyError: 'batteryLevel'

@bartbakels
Copy link
Author

Indeed i suspect the battery level is not available (yet) for my lock which caused the integration to abort the entity/device creation.

i replaced "battery_level": data[CONF_BATTERY_LEVEL] by

"battery_level": 0

in the lock.py and the lock is added successfully and is controllable

bart

@lwestenberg lwestenberg added the bug Something isn't working label Jan 24, 2023
@lwestenberg lwestenberg changed the title Issue adding integration/lock Entity creation aborted when battery level is 0 Jan 24, 2023
@bartbakels
Copy link
Author

Changed back after calibration and it works indeed :)

happy to test or help with new features, added some additional attributes in my own integration. But im not a coder ;)

lwestenberg added a commit that referenced this issue Jan 31, 2023
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

2 participants