home-assistant-ecosystem / home-assistant-cli

:computer: Command-line tool for Home Assistant
Other
446 stars 69 forks source link

error: TypeError: 'NoneType' object is not subscriptable #409

Open johntdyer opened 1 year ago

johntdyer commented 1 year ago

I keep getting this error, but seemingly all other functions work fine..

░▒▓    ~ ▓▒░ hass-cli --loglevel debug entity list                ░▒▓ INT ✘  at 18:00:04  ▓▒░
debug: Using settings: <Configuration({'server': 'https://ha.xxxx.xxxxxx 'access-token': 'yes', 'api-password': 'no', 'insecure': False, 'output': 'auto', 'verbose': False})
debug: Setting auto-output to: table
debug: Using selector: KqueueSelector
error: TypeError: 'NoneType' object is not subscriptable
Run with -x to see full exception information
░▒▓    ~ ▓▒░
░▒▓    ~ ▓▒░ hass-cli -x entity list                                ░▒▓ 1 ✘  at 18:00:15  ▓▒░
'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/homeassistant_cli/cli.py", line 40, in run
    result = cli.main(standalone_mode=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/homeassistant_cli/plugins/entity.py", line 34, in listcmd
    entities = api.get_entities(ctx)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/homeassistant_cli/remote.py", line 291, in get_entities
    devices = cast(Dict[str, List[Dict[str, Any]]], wsapi(ctx, frame))[
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
░▒▓    ~ ▓▒░
johntdyer commented 1 year ago

Anyone have any thoughts here? This still impacts me and I am unsure how to proceed

johntdyer commented 1 year ago

Added some more logging and figured out that the error appears to be too many entities ???!!!


WSMessage(type=<WSMsgType.ERROR: 258>, data=WebSocketError(<WSCloseCode.MESSAGE_TOO_BIG: 1009>, 'Message size 4539129 exceeds limit 4194304'), extra=None)
'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/homeassistant_cli/cli.py", line 40, in run
    result = cli.main(standalone_mode=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/homeassistant_cli/plugins/entity.py", line 34, in listcmd
    entities = api.get_entities(ctx)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/homeassistant-cli/0.9.6_3/libexec/lib/python3.11/site-packages/homeassistant_cli/remote.py", line 293, in get_entities
    devices = cast(Dict[str, List[Dict[str, Any]]], wsapi(ctx, frame))[
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable```
johntdyer commented 9 months ago

Seems fixed by https://github.com/home-assistant-ecosystem/home-assistant-cli/pull/411