bdunn44 / hass-jellyfish-lighting

A Jellyfish Lighting integration for Home Assistant
MIT License
8 stars 0 forks source link

Integration will not initiate #18

Closed kz6fittycent closed 10 months ago

kz6fittycent commented 12 months ago

Version of the custom_component

1.2.0

Configuration

Home Assistant Version: 2023.9.3 HACS: 1.33.0 Jellyfish Integration Version 1.2.0


Add your logs here.

Config flow could not be loaded: {"message":"Invalid handler specified"}
---
2023-10-26 17:00:23.287 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration jellyfish_lighting: No module named 'jellyfishlightspy'

Describe the bug

A clear and concise description of what the bug is. I installed the integration via HACS Restarted HA Attempted to enable the integration and got the following error: Config flow could not be loaded: {"message":"Invalid handler specified"}

The integration will not initiate after installation and attempting to activate it via HA GUI.

Debug log

"jellyfish_lighting":{"config_flow":true,"integration_type":"hub","iot_class":"local_polling","name":"JellyFish Lighting"},"pirateweather":{"config_flow":true,"integration_type":"hub","iot_class":"cloud_polling","name":"Pirate Weather"},"hacs":{"config_flow":true,"integration_type":"hub","iot_class":"cloud_polling","name":"HACS"},"webrtc":{"config_flow":true,"integration_type":"hub","iot_class":"calculated","name":"WebRTC Camera"}},"helper":{}}}}
2023-10-26 17:04:09.345 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [140298095516864] USER_NAME from FAKE_IP_ADDRESS (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36): Received {'type': 'manifest/get', 'integration': 'jellyfish_lighting', 'id': 65}
2023-10-26 17:04:09.345 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [140298095516864] USER_NAME from FAKE_IP_ADDRESS (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36): Sending {"id":65,"type":"result","success":true,"result":{"domain":"jellyfish_lighting","name":"JellyFish Lighting","codeowners":["@bdunn44"],"config_flow":true,"documentation":"https://github.com/bdunn44/hass-jellyfish-lighting","integration_type":"hub","iot_class":"local_polling","issue_tracker":"https://github.com/bdunn44/hass-jellyfish-lighting/issues","requirements":["jellyfishlights-py==0.7.0"],"version":"1.2.0","is_built_in":false}}
2023-10-26 17:04:09.368 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration jellyfish_lighting: No module named 'jellyfishlightspy'
2023-10-26 17:04:29.130 DEBUG (MainThread) [custom_components.hacs] <Integration bdunn44/hass-jellyfish-lighting> Getting repository information
2023-10-26 17:04:29.592 DEBUG (MainThread) [custom_components.hacs] <Integration bdunn44/hass-jellyfish-lighting> Running checks against v1.2.0
bdunn44 commented 12 months ago

Hi there - happy to help but this is very difficult to debug with the information provided. Can you tell me more about your environment and the steps you took to install? Things like:

Let me know

bdunn44 commented 12 months ago

Some general troubleshooting advice would be:

  1. Uninstall the integration (if done via HACS, first uninstall there. Then, ensure there is no jellyfish_lighting folder under custom_components)
  2. Restart home assistant
  3. Re-install the component
  4. Try to configure the integration again
kz6fittycent commented 12 months ago

Sorry - I'm pretty new to HA, so I had to look a little further for how to obtain the logs. I think I've got the most relevant items above (updated initial comment).

kz6fittycent commented 12 months ago

Some general troubleshooting advice would be:

  1. Uninstall the integration (if done via HACS, first uninstall there. Then, ensure there is no jellyfish_lighting folder under custom_components)
  2. Restart home assistant
  3. Re-install the component
  4. Try to configure the integration again

Yes I've performed this several time and it just will not work.

I need to state that I'm using the snap, although that should not induce any errors as other integrations work as expected.

bdunn44 commented 12 months ago

Thanks for the info. It seems that the Python library this integration depends on (jellyfishlightspy) is not being installed as expected. Not sure why that would be.... would you please search your logs for other lines containing "jellyfishlightspy" or "jellyfishlights-py" and send what you find?

I just tried installing the specific dependency locally and bet this is the error that's happening in your environment as well:

pip3 install jellyfishlights-py==0.7.0
ERROR: Could not find a version that satisfies the requirement 0.7.0 (from versions: none)

This is new... and very strange because 0.7.0 is definitely available and was previously working. I'll need to submit an issue for the maintainer of that repo to look at.

The good news is 0.7.0 is the latest version, so you should be able to just run this command as a workaround:

pip3 install jellyfishlights-py

I'm not familiar with how Snap works, but if it runs HA in a VM be sure to run that command within the HA container. Hope this works for you... I'll report back once the issue with the dependent library has been fixed

kz6fittycent commented 12 months ago

Well, unfortunately snaps are built as read-only and run as a secured container, with minimal access to perform edits and additions to it (the container). I wouldn't be able to run a pip3 installation at all. Additionally, the snap cannot access the host os's directories, save those which are allowed by the snap developer.

bdunn44 commented 12 months ago

Created related issue: https://github.com/vinenoobjelly/jellyfishlights-py/issues/8

bdunn44 commented 12 months ago

Well, unfortunately snaps are built as read-only and run as a secured container, with minimal access to perform edits and additions to it (the container). I wouldn't be able to run a pip3 installation at all. Additionally, the snap cannot access the host os's directories, save those which are allowed by the snap developer.

That's unfortunate. You are able to access HA's configuration.yaml file, correct? If so you could try creating a shell command service by adding these lines to the file:

shell_command:
  install_jellyfishlightspy: pip3 install jellyfishlights-py

Then:

  1. Go to the "Developer Tools" link in HA (near the bottom on the left)
  2. Under the "YAML" tab click "Check configuration" to validate your changes
  3. If they're good, click "Restart", then "Quick Reload" to apply the changes
  4. Click the "Services" tab (also under "Developer Tools"
  5. Search for the name of the service you just created ("install_jellyfishlightspy"), select it, then click "Call Service"

That's a roundabout way of running a command within the container that should work. Alternatively you could try installing the package on the host machine and see if that works. Again, I'm not familiar with Snap so that might not work.

bdunn44 commented 12 months ago

Though I just tried the pip command on another machine and it's working fine, so this may not be the problem in your environment. Would you please search your logs for lines containing "jellyfishlightspy" or "jellyfishlights-py" and post what you find?

kz6fittycent commented 12 months ago

nada. I didn't think the approach would work. Thanks for the help - maybe something will come of it in the future. I'm gonna go ahead and close this issue.

jmgiaever commented 10 months ago

Hi,

I respond here. It's partly true that the environment is RO. There's also a "userland" where HACS will install dependencies in.

You can login to the shell:

sudo snap run --shell home-assistant-snap

Then go into the SNAP directory and enter the env:

cd $SNAP
source bin/activate

And now try to install the package, but I guess you have to do it with

python3 -m pip <package>
kz6fittycent commented 10 months ago

Thanks for responding @jmgiaever - This is the output from the commands you've provided here and in the other issue I opened on your repo:

python3 -m pip install jellyfishlights-py
Requirement already satisfied: jellyfishlights-py in /root/snap/home-assistant-snap/583/.local/lib/python3.11/site-packages (0.7.0)
Requirement already satisfied: websocket-client in ./lib/python3.11/site-packages (from jellyfishlights-py) (1.7.0)
jmgiaever commented 10 months ago

Then I'm not sure what the problem can be. Do you have other things installed through HACS that work properly?

kz6fittycent commented 10 months ago

Oh yeah! Never had any failures before, so I wasn't sure what to do. So, I opened this ticket and the one with @jmgiaever since he maintains the home-assistant-snap.

jmgiaever commented 10 months ago

Everything seems to be in order with the snap package then.

Can log back into the shell again and activate the environment, then go into the Python interpreter (python3) and run help("modules jellyfishlightspy")

jmgiaever commented 10 months ago

Or just python3 -c 'help("modules jellyfishlightspy")

kz6fittycent commented 10 months ago
(install) root@$HOSTNAME:/snap/home-assistant-snap/583# python3
Python 3.11.7 (main, Dec  8 2023, 18:56:57) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help("modules jellyfishlightspy")

Here is a list of modules whose name or summary contains 'jellyfishlightspy'.
If there are any, enter a module name to get more help.

0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.

WARNING:slixmpp.stringprep:Using slower stringprep, consider compiling the faster cython/libidn one.

Here's the output with the debugger switch mentioned:

>>> help("modules -Xfrozen_modules=off jellyfishlightspy")

Here is a list of modules whose name or summary contains '-Xfrozen_modules=off'.
If there are any, enter a module name to get more help.
kz6fittycent commented 10 months ago

Any ideas? This all rather ambiguous to me.

jmgiaever commented 10 months ago

Hi,

I've verified that it is indeed available to the system. You can do that as well.

sudo snap run --shell home-assistant-snap
cd $SNAP
source bin/activate
python3

Then import the (deprecated) package

>>> import pkg_resources

and copy/paste the following

for package in sorted(["%s==%s" % (i.key, i.version) for i in pkg_resources.working_set]):
    if 'jellyfishlights' in package:
        print(package)

Hit enter and it should output: jellyfishlights-py==0.7.0.

But I can seem to find anything that is exposed by that package.

kz6fittycent commented 10 months ago

I tried your propose commands @jmgiaever thanks. I'm still getting the same error as above:

Config flow could not be loaded: {"message":"Invalid handler specified"}
jmgiaever commented 10 months ago

But I can seem to find anything that is exposed by that package.

.... which probably means there is an issue with that package.

kz6fittycent commented 10 months ago

@bdunn44 do you have any ideas? I know you opened an issue here. I'm honestly at a loss. I would love to get this integration working, and it seems we've got it narrowed down a little more. Has anything @jmgiaever has posted sparked any ideas for you?

jmgiaever commented 10 months ago

Maybe you can create your own issue with them? He doesn't seem to have a problem, so it's best to get it from the source (you).

You can report it unrelated to this package. Report the bug as its documented in this thread.

kz6fittycent commented 10 months ago

I'll close this issue and see what happens upstream. Thanks both of you for the assistance.

bdunn44 commented 9 months ago

Hey @kz6fittycent, just getting back online after vacation. Sorry I missed the action. Nothing here is really sparking any ideas.... the integration works fine in other environments and you're the first person to report an issue like this, so my best guess is it has something to do with the nuances of how Snap works, but tough to deduce anything beyond that. If you're able, it would be great to get full logs with debug enabled that cover the installation and configuration of the integration. Basically:

  1. Uninstall the integration
  2. Enable debug logging and restart Home Assistant
  3. Install the integration and attempt to configure it
  4. Download the logs and post them here
kz6fittycent commented 1 month ago

Wanted to let you know that we're in business with the latest release (v1.3.1)! I have a working Jellyfish integration!

bdunn44 commented 1 month ago

That's great news! Glad to hear it