question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KeyError: 'site_name' - Can't configure component when site has no name specified

See original GitHub issue

Version of the custom_component

1.1.0

Configuration

Describe the bug

When attempting to configure the integration it fails with this (and yes I put the correct token in the window):

image

I only have a solar system (no car), I think it’s related to this: https://github.com/alandtse/tesla/pull/58. Maybe @giachello knows what’s going on?

Debug log

2021-10-12 11:34:20 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 220, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 157, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 111, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 198, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 256, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/tesla_custom/config_flow.py", line 56, in async_step_user
    info = await validate_input(self.hass, user_input)
  File "/config/custom_components/tesla_custom/config_flow.py", line 160, in validate_input
    result = await controller.connect(test_login=True)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 349, in connect
    self.__energysite_name[energysite_id] = energysite["site_name"]
KeyError: 'site_name'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mcolyercommented, Oct 18, 2021

It works perfectly, thanks!

0reactions
pickerincommented, Oct 18, 2021

Just wanted to add a comment:

  1. This bug is encountered even if you have vehicles, if you have a Solar system
  2. Definitely because the default name of your home is “My Home”, and it must be returning NULL instead of “My Home”
  3. Tapping on the name “My Home” in the Tesla app will allow you to change the name (while viewing your Solar)

Once the name is changed, this error disappears in the integration.

Read more comments on GitHub >

github_iconTop Results From Across the Web

KeyError: 'Name' , What's the issue? - python - Stack Overflow
This code works fine for me except that you don't have item defined? Assuming that item is some sort of container like (Name,...
Read more >
Troubleshooting — JupyterHub 3.1.0 documentation
The JupyterHub logs have jupyterhub KeyError: "getpwnam(): name not found: <my_user_name> . This issue occurs when the authenticator requires a local system ...
Read more >
Configuring Django Settings: Best Practices
This article is intended for engineers who use the Django framework. It gives a deep insight into configuring Django project settings, ...
Read more >
Request and response objects - Django documentation
When a page is requested, Django creates an HttpRequest object that contains metadata about the request. Then Django loads the appropriate view, ...
Read more >
Changelog — Python 3.11.1 documentation
gh-94526: Fix the Python path configuration used to initialized sys.path at Python startup. Paths are no longer encoded to UTF-8/strict to avoid ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found