Breina / PowerTagGateway

HomeAssistant integration for EcoStruxure gateways; SmartLink, PowerTag Link and Panel Servers.
MIT License
14 stars 7 forks source link

error upon integration setup #9

Closed pissten closed 1 year ago

pissten commented 1 year ago

ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration powertag_gateway: cannot import name 'make_byte_string' from 'pymodbus.utilities' (/usr/local/lib/python3.11/site-packages/pymodbus/utilities.py)

Home Assistant 2023.10.1 OS: Ubuntu 22.04 Docker

This happens when using latest stable version from HACS, and also the beta 1.0.5

image

Breina commented 1 year ago

beta 1.0.5

You mean 0.1.5, right?

Can you please check your logs, search for powertag_gateway and copy me the error that you will be seeing there? It will contain more info that will help me find the cause.

Other integrations have reported this problem as well:

https://github.com/binsentsu/home-assistant-solaredge-modbus/discussions/175

https://github.com/wills106/homeassistant-solax-modbus/issues/464

I think that your Ubuntu has a bad version of pymodbus installed. This is just guesswork, but please try this:

pip install --upgrade --force-reinstall pymodbus

pissten commented 1 year ago

Yeah, sorry I meant 0.1.5 ;) I tried to force upgrade the pymodbus package, but that didn't affect the outcome. I have also included:

logger: logs: custom_components.powertag_gateway: debug

But i don't get anymore debug information than I already provided above :/

Breina commented 1 year ago

Yeah sorry, the error comes from homeassistant.config_entries, not powertag_gateway, nothing would show up there.

Home Assistant 2023.10.1 OS: Ubuntu 22.04 Docker

I first thought you ran on Ubuntu, but HA runs in docker. The docker container has its own Python installed, so upgrading Ubuntu's won't affect this.

Please run a shell in docker and run the above pip command inside there. Restart HA after.

pissten commented 1 year ago

Thanks! Updating pymodbus inside the docker container made some progress. But I'm still not able to complete the setup.

image

log:

INFO (SyncWorker_24) [custom_components.powertag_gateway.config_flow] Attempting to discover EnergyTag Gateway INFO (MainThread) [custom_components.powertag_gateway.config_flow] Found 1 candidates... INFO (MainThread) [custom_components.powertag_gateway.schneider_modbus] Connecting Modbus TCP to 10.0.0.22:502 File "/config/custom_components/powertag_gateway/config_flow.py", line 113, in async_step_user File "/config/custom_components/powertag_gateway/config_flow.py", line 142, in async_step_device File "/config/custom_components/powertag_gateway/config_flow.py", line 82, in async_discovery File "/config/custom_components/powertag_gateway/config_flow.py", line 47, in __init__ File "/config/custom_components/powertag_gateway/schneider_modbus.py", line 156, in __init__ File "/config/custom_components/powertag_gateway/schneider_modbus.py", line 161, in find_synthentic_table_slave_id File "/config/custom_components/powertag_gateway/schneider_modbus.py", line 654, in __read_int_16 File "/config/custom_components/powertag_gateway/schneider_modbus.py", line 629, in decoder

pissten commented 1 year ago

and trying with manual connect:

image

log: INFO (MainThread) [custom_components.powertag_gateway.schneider_modbus] Connecting Modbus TCP to 10.0.0.22:502

pissten commented 1 year ago

I already have the powertags integrated in HA using pure modbus config. Could that be conflicting?

Breina commented 1 year ago

Hmm it just fails to connect, there's little we can do about that.

If it already works with modbus directly, that means the IP and port are configured correctly. You do everything correctly.

The existing config shouldn't conflict, but it's worth a shot to comment out that config. There's nothing else you can try I'm afraid.

pissten commented 1 year ago

okay, but thank you very much for your time and help! I hope i can make this work some day. Would really like to use this integration instead of the yaml based modbus one..

Another thing: when i reboot my docker container, it seems like the pymodbus package isn't persistent. Which mean i would need to update the pymodbus library on every restart of the container. any way to make this persistent? Or would i have to compile my own image which includes the newer pymodbus package then?

Breina commented 1 year ago

Try upgrading the docker image that you use, I'm assuming it's an older version in that case.

pissten commented 1 year ago

I'm running Home Assistant 2023.10.1

Breina commented 1 year ago

Can you please show me your Dockerfile?

pissten commented 1 year ago

well, it actually some time since i've used dockerfile. I administrate the container from portainer webui. So I actually just recreate the existing container to pull the latest image. Could I just share some screendumps from the portainer webui for you, If you specify what options you are curious about?

pissten commented 1 year ago

posting some info about the GW, in case my specific device isn't supported:

image

Breina commented 1 year ago

Ah I think I got it. Hold on.

Breina commented 1 year ago

Ok try with v0.1.8. That should revolve the first error permanently.

No clue on your connection problem though.

pissten commented 1 year ago

I've updated to v0.1.8 and restarted HA (not container). these are the logs:

2023-10-13 11:33:04.394 INFO (SyncWorker_45) [custom_components.powertag_gateway.config_flow] Attempting to discover EnergyTag Gateway 2023-10-13 11:33:07.498 INFO (MainThread) [custom_components.powertag_gateway.config_flow] Found 2 candidates... 2023-10-13 11:33:07.512 INFO (MainThread) [custom_components.powertag_gateway.schneider_modbus] Connecting Modbus TCP to 10.0.0.22:502 File "/config/custom_components/powertag_gateway/config_flow.py", line 113, in async_step_user File "/config/custom_components/powertag_gateway/config_flow.py", line 142, in async_step_device File "/config/custom_components/powertag_gateway/config_flow.py", line 82, in async_discovery File "/config/custom_components/powertag_gateway/config_flow.py", line 47, in init File "/config/custom_components/powertag_gateway/schneider_modbus.py", line 156, in init File "/config/custom_components/powertag_gateway/schneider_modbus.py", line 161, in find_synthentic_table_slave_id File "/config/custom_components/powertag_gateway/schneider_modbus.py", line 654, in __read_int_16 File "/config/custom_components/powertag_gateway/schneider_modbus.py", line 629, in decoder

pissten commented 1 year ago

Actually, its acting the same as earlier. Auto-discovery finds GW, but throwing "unknown error occurd" on connecting. Manual connection states "cannot connect", and the log just shows:

2023-10-13 11:37:13.965 INFO (MainThread) [custom_components.powertag_gateway.schneider_modbus] Connecting Modbus TCP to 10.0.0.22:502

pissten commented 1 year ago

is it possible to add some more debugging to the code, so we can see whats going on in the connection phase?

Breina commented 1 year ago

I've updated to v0.1.8 and restarted HA (not container). these are the logs:

2023-10-13 11:33:04.394 INFO (SyncWorker_45) [custom_components.powertag_gateway.config_flow] Attempting to discover EnergyTag Gateway 2023-10-13 11:33:07.498 INFO (MainThread) [custom_components.powertag_gateway.config_flow] Found 2 candidates... 2023-10-13 11:33:07.512 INFO (MainThread) [custom_components.powertag_gateway.schneider_modbus] Connecting Modbus TCP to 10.0.0.22:502 File "/config/custom_components/powertag_gateway/config_flow.py", line 113, in async_step_user File "/config/custom_components/powertag_gateway/config_flow.py", line 142, in async_step_device File "/config/custom_components/powertag_gateway/config_flow.py", line 82, in async_discovery File "/config/custom_components/powertag_gateway/config_flow.py", line 47, in init File "/config/custom_components/powertag_gateway/schneider_modbus.py", line 156, in init File "/config/custom_components/powertag_gateway/schneider_modbus.py", line 161, in find_synthentic_table_slave_id File "/config/custom_components/powertag_gateway/schneider_modbus.py", line 654, in __read_int_16 File "/config/custom_components/powertag_gateway/schneider_modbus.py", line 629, in decoder

Resolved in v0.1.9, sorry about that.

Breina commented 1 year ago

is it possible to add some more debugging to the code, so we can see whats going on in the connection phase?

cannot_connect means it's network related. There's little I can do from my end.

You can try going inside your docker container again and ping 10.0.0.22, or telnet 10.0.0.22 502 to see if the port is open.

pissten commented 1 year ago

Problem solved! Something you did in the latest release fixed it! :D Thank you soo much!! :)