dave-code-ruiz / elkbledom

Home Assistant custom component for LED STRIP NAME ELK BLEDOM
MIT License
77 stars 16 forks source link

Can't set up device within HA integration settings #43

Closed RoiArthurB closed 11 months ago

RoiArthurB commented 1 year ago

As explained in the title, I did install this project, made sure that my strip led is compatible with this plugin on my Raspberry Pi 4 (with manual HA install). However, when I try to add the strip led in HA, I end up with the error message Config flow could not be loaded: {"message":"Invalid handler specified"}...

Steps to reproduce :

While watching the HA's log, I see this error line :

$  tail -f ./home-assistant.log

2023-09-01 14:45:22.717 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration elkbledom which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-09-01 14:45:46.340 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration elkbledom: No module named 'bluetooth_sensor_state_data'

But I do already have this lib installed :

$ python3 -m pip install bluetooth-sensor-state-data
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: bluetooth-sensor-state-data in /usr/local/lib/python3.11/dist-packages (1.6.2)
Requirement already satisfied: home-assistant-bluetooth>=1.3.0 in /usr/local/lib/python3.11/dist-packages (from bluetooth-sensor-state-data) (1.10.3)
Requirement already satisfied: sensor-state-data>=2.0 in /usr/local/lib/python3.11/dist-packages (from bluetooth-sensor-state-data) (2.17.1)
dave-code-ruiz commented 1 year ago

I think you need to add bluetooth integration:

https://www.home-assistant.io/integrations/bluetooth/

RoiArthurB commented 1 year ago

Was already there and it doesn't help :/

image image

And doesn't change the logs... 2023-09-01 15:20:28.974 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration elkbledom: No module named 'bluetooth_sensor_state_data'


However, while digging over the log file, I found this. Not sure how to understand it nor if it's related ? Copying it in case it's useful :shrug:

2023-09-01 15:17:39.619 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration elkbledom: No module named 'bluetooth_sensor_state_data'
2023-09-01 15:17:41.605 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration elkbledom: No module named 'bluetooth_sensor_state_data'
2023-09-01 15:17:41.608 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/config_entries.py", line 2045, in _load_integration
    integration.get_platform("config_flow")
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/loader.py", line 833, in get_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/loader.py", line 850, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/mnt/dietpi_userdata/homeassistant/custom_components/elkbledom/__init__.py", line 9, in <module>
    from .elkbledom import BLEDOMInstance
  File "/mnt/dietpi_userdata/homeassistant/custom_components/elkbledom/elkbledom.py", line 17, in <module>
    from bluetooth_sensor_state_data import BluetoothData
ModuleNotFoundError: No module named 'bluetooth_sensor_state_data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/config_entries.py", line 856, in async_init
    flow, result = await task
                   ^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/config_entries.py", line 874, in _async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/config_entries.py", line 974, in async_create_flow
    await _load_integration(self.hass, handler_key, self._hass_config)
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/config_entries.py", line 2052, in _load_integration
    raise data_entry_flow.UnknownHandler
homeassistant.data_entry_flow.UnknownHandler
dave-code-ruiz commented 12 months ago

hi, i upload changes in page elkbledom.py, in your path is "/mnt/dietpi_userdata/homeassistant/custom_components/elkbledom/elkbledom.py"

Can you replace this file with new file uploaded and restart HA ?

Send me new log file

RoiArthurB commented 12 months ago

Hi @dave-code-ruiz

I did replace only the elkbledom.py file from the master, and I have different error while trying to connect the led :

image


2023-09-12 19:19:32.903 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/components/config/config_entries.py", line 181, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/data_entry_flow.py", line 297, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.pyenv/versions/3.11.4/lib/python3.11/site-packages/homeassistant/data_entry_flow.py", line 393, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/dietpi_userdata/homeassistant/custom_components/elkbledom/config_flow.py", line 134, in async_step_manual
    return await self.async_step_validate()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/dietpi_userdata/homeassistant/custom_components/elkbledom/config_flow.py", line 112, in async_step_validate
    error = await self.toggle_light()
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/dietpi_userdata/homeassistant/custom_components/elkbledom/config_flow.py", line 164, in toggle_light
    await self._instance.stop()
          ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'stop'
dave-code-ruiz commented 12 months ago

hi, i upload changes in page config_flow.py, in your path is "/mnt/dietpi_userdata/homeassistant/custom_components/elkbledom/config_flow.py"

You can replace this file with new file uploaded and restart HA, but I advance you that will show connection error.

You must have another different strip because if you had the same one it would detect it automatically and not is needed type mac address

dave-code-ruiz commented 11 months ago

you can follow instructions in https://github.com/dave-code-ruiz/elkbledom/#supported-strips and send me results, i need strip bluetooth name and uuids