grimmpp / home-assistant-eltako

Integration for Eltako 14 series in Home Assistant
MIT License
33 stars 7 forks source link

Problem with Enocean USB300 as Gateway device #126

Closed lerteng closed 2 days ago

lerteng commented 1 month ago

Hello,

I followed the documentation and installed home-assistant-eltako via HACS and added the following lines to the configuration.yaml.

eltako:
  gateway:
  - id: 1
    base_id: FF-A6-DA-00        # baseId of USB300 gateway
    device_type: enocean-usb300

Unfortunatley the Eltako Integration cannot be startet, see following messages from the log:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eltako/eltako_integration_init.py", line 140, in async_setup_entry
    usb_gateway = EnOceanGateway(general_settings, hass, gateway_id, gateway_device_type, gateway_serial_path, baud_rate, port, gateway_base_id, gateway_name, auto_reconnect, config_entry)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eltako/gateway.py", line 81, in __init__
    self._init_bus()
  File "/config/custom_components/eltako/gateway.py", line 145, in _init_bus
    from esp2_gateway_adapter.esp3_serial_com import ESP3SerialCommunicator
  File "/usr/local/lib/python3.12/site-packages/esp2_gateway_adapter/esp3_serial_com.py", line 13, in <module>
    from enocean.protocol.packet import Packet, RadioPacket, RORG, PACKET, UTETeachInPacket
ImportError: cannot import name 'UTETeachInPacket' from 'enocean.protocol.packet' (/usr/local/lib/python3.12/site-packages/enocean/protocol/packet.py)

A manual installation via the custom_components folder led to the same behavior. The import of UTETeachInPacket in the python packages esp2_gateway_adapter seems not to work.

Does anyone have any idea what the problem could be and how to fix it?

grafik

grimmpp commented 1 month ago

Hello @lerteng,

thanks for reporting. We had this issue already here but the context was a bit different. The people used a different gateway and the workaround was to implement lazy loading of the lib so that they actually do not need it. In your case it is needed. At that time I was not able to reproduce the issue and only 3 people including you reported so far the issue. My guess is that it might be related with some configurations in HA which prevent downloading packages. Maybe you can find some logs while installing the integration. If you have access to HA you could try to install the package manually and check if it is working. This is the package and that the repo.

lerteng commented 1 month ago

Hello @grimmpp, thank you very much for your quick response. Thank you for linking the similar issue. I read it, however, as you mentioned in my case the lib is needed.

Unfortunately I'm not quite sure how i should install the package manually. I thought every component has it's own container. So for example with the Terminal&ssh addon I don't see a python folder in user/local/lib at all. Using VisualStudio Server add on I see user/local/lib/python3.11. So could you tell me you I can install the package?

Sadly, the log file was also unremarkable.

If that does work I gues the only option is to reinstall HomeAssistant and start on a clean setup.

grimmpp commented 1 month ago

Yes, you are right. You would need to jump into the container and run pip install enocean==0.60.1. Would be actually less than a workaround. I'm actually using HA OS which does not allow you anything in that direction. At least AFAIK.

Can you check if there are some information in the logs when installation the integration. Maybe it fails to download the dependencies. The dependencies are listed in the manifest.json. Usually HA installs them automatically.

lerteng commented 5 days ago

@grimmpp Thank you very much for your support. You are absolutely right with your assumption regarding the dependency problem. In the current HA OS, some new messages have appeared in the log that point to a dependency problem of the esp2-gateway-adapter package.

In a next step, I added all requirements of the esp2-gateway-adapter package to the manifest file of the eltako components. So I found out that the packages “zeroconf==0.132.2”, “PyYAML==6.0.1” caused the problem.

depErrorEltako

As I changed the manifest.json to "zeroconf>=0.132.2","PyYAML>=6.0.1" none of them caused a depenency error.

Is there any way to check which packages need a newer version or is it possible to use the newer packages in the esp2-gateway-adapter-package?

Best regards

grimmpp commented 4 days ago

Great, of course I can change it. How did you get this error message?

FMDHET commented 4 days ago

I tried to fix it as described (on HA OS):

manifest json

but fore me the failure still appears

log

@lerteng: can you please share your config?

lerteng commented 4 days ago

@FMDHET unfortunately my message was not the solution. I only described the problem.

esp2-gateway-adapter package cannot be installed, as it depends on the packages “zeroconf==0.132.2”, “PyYAML==6.0.1”. I discoeverd that as I added the two packages to the manifest.json (before the esp2-gateway-adapter). Then I got the error showed in my message above. When I changed der manifest.json to "zeroconf>=0.132.2","PyYAML>=6.0.1" I still got the error message for the esp2-gateway-adapter (as it depends on “zeroconf==0.132.2”, “PyYAML==6.0.1”) but not the error messages for zeroconf and pyyaml.

@grimmpp this message appeared since the latest HA-OS core update.

I have found another way to check the depencies.

With the addon "Advanced SSH & Web Terminal" you can get into the homeassisstant container via docker exec -it homeassistant /bin/bash . To this end you must disable the save mode of the add on at first. In the container you can use pip to analyze the installed packages and to install new ones.

In this way, I also saw that enocean==0.50.0 was installed on my machine. This led to the first error I described in this thread. For some reason the depency was not installed correctly on my machine. (Without further noticein the logs) And this reason seems to be that I tried the official enocean integration at first. During that test I added an entry like

  • name: TestSensor platform: enocean id: [0x00,0x00,0x00,0x00] device_class: humidity

to my configuration.yaml. As I removed that entry I could update to the newer version enocean 0.60.1.

grimmpp commented 4 days ago

I've released esp2-gateway-adapter 0.2.11 and adjusted feature-branch which worked for me. Can you Test it?

grimmpp commented 3 days ago

It's working for at least a few people so I created a new release containing all other changes made in between as well. Can you please test version 1.5.8

lerteng commented 3 days ago

@grimmpp thank you very much for your support again. For me everything is working now.