Custom component requirement not installed

Hi,

I try to fix the custom component for Fujitsu ACs:

As a requirement, I published the module pyfujitseu on PyPi. During startup of Home Assistant Core on docker, I get the following error message:

2020-05-25 14:07:12 ERROR (MainThread) [homeassistant.config] Platform error: climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 777, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 273, in get_platform
    f"{self.pkg_path}.{platform_name}"
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/fujitsu_general_heatpump/climate.py", line 7, in <module>
    import pyfujitseu
ModuleNotFoundError: No module named 'pyfujitseu'

If I bash into the container and do

pip install pyfujitseu

The component is working properly.

How can I solve this?

You’ll need to add the required lib in the manifest of the integration

Hi @Pippyn, Thanks for your answer.

I have a manifest file. See:

Your requirements look correct, but your domain is not. The domain should be a string containing underscores like your name. Integration Manifest | Home Assistant Developer Docs

I’m not sure if that is related to your requirement not getting installed or not.

Hey @fahr, thanks for your answer. Unfortunately, my requirement is still not resolved.

I’m stumped, your manifest.json looks correct to me.

I’m also interested in this issue.
I installed package inside HA ssh using:

python3 -m pip install pyfujitseu

and get the same error:

Platform error climate.fujitsu_general_heatpump - No module named 'pyfujitseu'

I’ve just seen that HA is running python3.7 and “pip install” do the installation on python3.8 libs so I guess I should install on another container.
Do you know where to install pyfujitseu?

I solved it installing inside homeassistant container that is not the same as doing ssh inside HA:

docker exec -it homeassistant /bin/bash

@philwilldo I think you are not importing the correct way: I see 3 import-statements in your climate.py.

Try this instead, write instead of import pyfujitseu:

from pyfujitseu.api import Api as fgapi
from pyfujitseu.splitAC import splitAC

Remove the other 2 import-statement lower in the code.
And then write fgapi instead of fgapi.Api, and splitAC instead of splitAC.splitAC in climate.py.

I’ve added a PR that makes this change (as well as fixing the created directory name).

2 Likes

thanks, @esteele