Bepacom-Raalte / bepacom-HA-Addons

Repository for Bepacom EcoPanel add-ons for Home Assistant.
Apache License 2.0
15 stars 2 forks source link

Nginx port conflict and not discovering devices #10

Closed mikihacia closed 1 year ago

mikihacia commented 1 year ago

Hi,

I've tried to run your addon on my setup, but I cannot discover any devices through the WebUI. I've also had to change my Reverse SSL Proxy Nginx port from 80 to 81 to get the addon started at all. See attached logs below:

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting

Add-on: Bepacom EcoPanel BACnet/IP Interface Bepacom BACnet/IP interface for the Bepacom EcoPanel.

Add-on version: 0.1.3 You are running the latest version of this add-on. System: Home Assistant OS 10.1 (amd64 / generic-x86-64) Home Assistant Core: 2023.5.2 Home Assistant Supervisor: 2023.04.1

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-interface: starting s6-rc: info: service nginx: starting s6-rc: info: service nginx successfully started [15:36:00] INFO: Running NGINX [15:36:00] INFO: Generating BACpypes.ini 2023/05/08 15:36:00 [notice] 136#136: using the "epoll" event method 2023/05/08 15:36:00 [notice] 136#136: nginx/1.22.1 2023/05/08 15:36:00 [notice] 136#136: OS: Linux 6.1.25 2023/05/08 15:36:00 [notice] 136#136: getrlimit(RLIMIT_NOFILE): 1073741816:1073741816 2023/05/08 15:36:00 [notice] 136#136: start worker processes 2023/05/08 15:36:00 [notice] 136#136: start worker process 155 Using enp0s31f6 with 192.168.0.26... [BACpypes] objectName: EcoPanel address: 192.168.0.241 objectIdentifier: 4200 maxApduLengthAccepted: 1024 segmentationSupported: segmentedBoth vendorIdentifier: 15 foreignBBMD: - foreignTTL: 255 maxSegmentsAccepted: 24 loglevel: WARNING s6-rc: info: service init-interface successfully started s6-rc: info: service interface: starting s6-rc: info: service interface successfully started s6-rc: info: service discovery: starting [15:36:00] INFO: Running interface Traceback (most recent call last): File "/usr/bin/main.py", line 171, in main() File "/usr/bin/main.py", line 147, in main this_application = BACnetIOHandler(this_device, args.ini.address) File "/usr/bin/BACnetIOHandler.py", line 167, in init BIPSimpleApplication.init(self, *args) File "/usr/lib/python3.10/site-packages/bacpypes/app.py", line 535, in init self.mux = UDPMultiplexer(self.localAddress) File "/usr/lib/python3.10/site-packages/bacpypes/bvllservice.py", line 96, in init self.directPort = UDPDirector(self.addrTuple) File "/usr/lib/python3.10/site-packages/bacpypes/udp.py", line 155, in init self.bind(address) File "/usr/lib/python3.10/asyncore.py", line 333, in bind return self.socket.bind(addr) OSError: [Errno 99] Address not available [15:36:05] ERROR: Got unexpected response from the API: Service bacnet_interface not found for dictionary value @ data['service']. Got 'bacnet_interface' [15:36:05] INFO: Successfully send discovery information to Home Assistant. s6-rc: info: service discovery successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started

mikihacia commented 1 year ago

FYI:

I am using IP 192.168.0.241 as a target address for the virtual BACNet Interface. Did try with auto, but with no luck neither.

GravySeal commented 1 year ago

Thank you for your report! I'm going to take a look. For now, port 80 is still being used by the webserver and I won't immediately change it. I updated the add-on to include /24 after IP address automatically. Maybe it'll work once you uninstall, refresh the add-on store and reinstall now. Just make sure you use the physical IP of the Home Assistant machine connected to the local BACnet network.

mikihacia commented 1 year ago

After the update I've used my HASS IP address and the auto in the configuration field, but with no luck.

I've tried to setup your integration as well, but it came back with following error log:

This error originated from a custom integration.

Logger: aiohttp.server Source: custom_components/bacnet_interface/config_flow.py:77 Integration: bacnet_interface First occurred: 15:41:20 (2 occurrences) Last logged: 16:00:21

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 148, in post return await super().post(request) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper result = await method(view, request, data, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post result = await self._flow_mgr.async_init( File "/usr/src/homeassistant/homeassistant/config_entries.py", line 845, in async_init flow, result = await task File "/usr/src/homeassistant/homeassistant/config_entries.py", line 873, in _async_init result = await self._async_handle_step(flow, flow.init_step, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/bacnet_interface/config_flow.py", line 77, in async_step_user CONF_HOST, description={"suggested_value": ip_addr} UnboundLocalError: local variable 'ip_addr' referenced before assignment

GravySeal commented 1 year ago

The integration won't work without the add-on, so best to leave it be until the problem is solved. It seems the issue is that the BACpypes library in my add-on can't bind to the IP address. Could you provide me with the latest logs, the local IP of your machine, the local IP of a BACnet device and a list of add-ons you use? It might be worth trying to run the add-on without any other (networking) add-ons running in the background.

mikihacia commented 1 year ago

My current setup is: HASS - 192.168.0.26 BACNet Interface - Had it set as 192.168.0.26, 192.168.0.241 or auto BACNet Device (Siemens PXC.100-E) I'm willing to communicate with - 192.168.0.240 List of addons:

It's running on the latest Home Assistant OS and Supervisor versions.

See latest log: s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting

Add-on: Bepacom EcoPanel BACnet/IP Interface Bepacom BACnet/IP interface for the Bepacom EcoPanel.

Add-on version: 0.1.3 You are running the latest version of this add-on. System: Home Assistant OS 10.1 (amd64 / generic-x86-64) Home Assistant Core: 2023.5.2 Home Assistant Supervisor: 2023.04.1

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-interface: starting s6-rc: info: service nginx: starting s6-rc: info: service nginx successfully started [17:28:22] INFO: Running NGINX [17:28:22] INFO: Generating BACpypes.ini 2023/05/08 17:28:22 [notice] 136#136: using the "epoll" event method 2023/05/08 17:28:22 [notice] 136#136: nginx/1.22.1 2023/05/08 17:28:22 [notice] 136#136: OS: Linux 6.1.25 2023/05/08 17:28:22 [notice] 136#136: getrlimit(RLIMIT_NOFILE): 1073741816:1073741816 2023/05/08 17:28:22 [notice] 136#136: start worker processes 2023/05/08 17:28:22 [notice] 136#136: start worker process 155 [BACpypes] objectName: EcoPanel address: 192.168.0.26/24 objectIdentifier: 4201 maxApduLengthAccepted: 1024 segmentationSupported: segmentedBoth vendorIdentifier: 15 foreignBBMD: - foreignTTL: 255 maxSegmentsAccepted: 24 loglevel: WARNING s6-rc: info: service init-interface successfully started s6-rc: info: service interface: starting s6-rc: info: service interface successfully started s6-rc: info: service discovery: starting [17:28:22] INFO: Running interface Traceback (most recent call last): File "/usr/bin/main.py", line 171, in main() File "/usr/bin/main.py", line 147, in main this_application = BACnetIOHandler(this_device, args.ini.address) File "/usr/bin/BACnetIOHandler.py", line 167, in init BIPSimpleApplication.init(self, args) File "/usr/lib/python3.10/site-packages/bacpypes/app.py", line 535, in init self.mux = UDPMultiplexer(self.localAddress) File "/usr/lib/python3.10/site-packages/bacpypes/bvllservice.py", line 96, in init self.directPort = UDPDirector(self.addrTuple) File "/usr/lib/python3.10/site-packages/bacpypes/udp.py", line 155, in init self.bind(address) File "/usr/lib/python3.10/asyncore.py", line 333, in bind return self.socket.bind(addr) OSError: [Errno 98] Address in use [17:28:27] ERROR: Got unexpected response from the API: Service bacnet_interface not found for dictionary value @ data['service']. Got 'bacnet_interface' [17:28:27] INFO: Successfully send discovery information to Home Assistant. s6-rc: info: service discovery successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started 2023/05/08 17:30:12 [info] 155#155: 4 client 172.30.32.2 closed keepalive connection

GravySeal commented 1 year ago

So what I see is that 192.168.0.26 should be working. The "OSError: [Errno 98] Address in use" error indicates something is using the IP address, probably with the same port as the BACnet interface? Can you try disabling Node-Red and NGINX Home Assistant SSL proxy and see if it runs then?

mikihacia commented 1 year ago

Disabling the Node-Red seemed to work. Just reminded that I've had some BACNet stuff on it, so that maybe caused some issues. Thought it dropped some other messages:

[18:25:08] INFO: Running interface ERROR: bufferOverflow from 192.168.0.240 on read multiple result [18:25:14] ERROR: Got unexpected response from the API: Service bacnet_interface not found for dictionary value @ data['service']. Got 'bacnet_interface' [18:25:14] INFO: Successfully send discovery information to Home Assistant. s6-rc: info: service discovery successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started

I have also checked and it discovered my PXC controller and it's points.

GravySeal commented 1 year ago

Awesome! So can you see the BACnet objects appear when you use the web UI? Mind sometimes it'll take a few seconds before the page shows it.

mikihacia commented 1 year ago

So far looking good and all objects seem to be there. Just the integration doesn't detect the Digital Inputs and some Analog Values, such as Setpoints (AVAL_OP blocks being 100% accurate. I can check it this one later and replace with AVAL block). All others looking great - Confirmed AVAL, Digital Outputs, Analog Inputs.

GravySeal commented 1 year ago

If you make an issue at the integration repository, I'll look at it when I can. I'll mark this as solved! Thanks for replying so quickly

mikihacia commented 1 year ago

Sure. Thanks for prompt and accurate help!

diablo581 commented 1 year ago

I am experiencing this same problem. One difference is that my BACnet devices are on a /20 network. I tried adding that to the IP interface but it didn't seem to change anything. I also disabled my Node-Red addon.

Here is what my log shows:

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-interface: starting s6-rc: info: service nginx: starting s6-rc: info: service nginx successfully started [08:50:47] INFO: Generating BACpypes.ini [08:50:47] INFO: Running NGINX 2023/06/07 08:50:47 [notice] 58#58: using the "epoll" event method 2023/06/07 08:50:47 [notice] 58#58: nginx/1.24.0 2023/06/07 08:50:47 [notice] 58#58: OS: Linux 6.1.29 2023/06/07 08:50:47 [notice] 58#58: getrlimit(RLIMIT_NOFILE): 1073741816:1073741816 2023/06/07 08:50:47 [notice] 58#58: start worker processes 2023/06/07 08:50:47 [notice] 58#58: start worker process 77 [BACpypes] objectName: EcoPanel address: 10.76.216.240/24 objectIdentifier: 420 maxApduLengthAccepted: 1024 segmentationSupported: segmentedBoth vendorIdentifier: 15 foreignBBMD: - foreignTTL: 255 maxSegmentsAccepted: 24 loglevel: WARNING defaultPriority: 15 s6-rc: info: service init-interface successfully started s6-rc: info: service interface: starting s6-rc: info: service interface successfully started s6-rc: info: service discovery: starting [08:50:48] INFO: Running interface Traceback (most recent call last): File "/usr/bin/main.py", line 183, in main() File "/usr/bin/main.py", line 158, in main this_application = BACnetIOHandler(this_device, args.ini.address) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/bin/BACnetIOHandler.py", line 171, in init BIPSimpleApplication.init(self, *args) File "/usr/local/lib/python3.11/site-packages/bacpypes/app.py", line 535, in init self.mux = UDPMultiplexer(self.localAddress) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/bacpypes/bvllservice.py", line 102, in init self.broadcastPort = UDPDirector(self.addrBroadcastTuple, reuse=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/bacpypes/udp.py", line 155, in init self.bind(address) File "/usr/local/lib/python3.11/asyncore.py", line 331, in bind return self.socket.bind(addr) ^^^^^^^^^^^^^^^^^^^^^^ OSError: [Errno 99] Address not available [08:50:53] ERROR: Got unexpected response from the API: Service bacnet_interface not found for dictionary value @ data['service']. Got 'bacnet_interface' [08:50:53] INFO: Successfully send discovery information to Home Assistant. s6-rc: info: service discovery successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started

Bepacom-Raalte commented 1 year ago

I just pushed a small update. If you remove the add-on, then check for updates and then reinstall, can you try to run it again with the IP written manually in the form of 10.76.216.240/20? Let me know if this works. I don't have a /20 network available right now so I can't test it locally.

diablo581 commented 1 year ago

So it looks like it took the IP correctly but I am still getting the error at the bottom and nothing seems to be showing up in the UI.

I am not sure what would causing it not to be able to bind.

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-interface: starting s6-rc: info: service nginx: starting s6-rc: info: service nginx successfully started [10:35:56] INFO: Running NGINX [10:35:56] INFO: Generating BACpypes.ini 2023/06/07 10:35:56 [notice] 58#58: using the "epoll" event method 2023/06/07 10:35:56 [notice] 58#58: nginx/1.24.0 2023/06/07 10:35:56 [notice] 58#58: OS: Linux 6.1.29 2023/06/07 10:35:56 [notice] 58#58: getrlimit(RLIMIT_NOFILE): 1073741816:1073741816 2023/06/07 10:35:56 [notice] 58#58: start worker processes 2023/06/07 10:35:56 [notice] 58#58: start worker process 77 [BACpypes] objectName: EcoPanel address: 10.76.216.240/20 objectIdentifier: 420 maxApduLengthAccepted: 1024 segmentationSupported: segmentedBoth vendorIdentifier: 15 foreignBBMD: - foreignTTL: 255 maxSegmentsAccepted: 24 loglevel: WARNING defaultPriority: 15 s6-rc: info: service init-interface successfully started s6-rc: info: service interface: starting s6-rc: info: service interface successfully started s6-rc: info: service discovery: starting [10:35:57] INFO: Running interface Traceback (most recent call last): File "/usr/bin/main.py", line 183, in main() File "/usr/bin/main.py", line 158, in main this_application = BACnetIOHandler(this_device, args.ini.address) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/bin/BACnetIOHandler.py", line 171, in init BIPSimpleApplication.init(self, *args) File "/usr/local/lib/python3.11/site-packages/bacpypes/app.py", line 535, in init self.mux = UDPMultiplexer(self.localAddress) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/bacpypes/bvllservice.py", line 96, in init self.directPort = UDPDirector(self.addrTuple) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/bacpypes/udp.py", line 155, in init self.bind(address) File "/usr/local/lib/python3.11/asyncore.py", line 331, in bind return self.socket.bind(addr) ^^^^^^^^^^^^^^^^^^^^^^ OSError: [Errno 99] Address not available [10:36:02] ERROR: Got unexpected response from the API: Service bacnet_interface not found for dictionary value @ data['service']. Got 'bacnet_interface' [10:36:02] INFO: Successfully send discovery information to Home Assistant. s6-rc: info: service discovery successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started

GravySeal commented 1 year ago

Just to confirm, the IP of your Home Assistant is also 10.76.216.240/20? I might have to set up such a network myself probably to test some things.

diablo581 commented 1 year ago

My HA install has 8 IP addresses. That is one of them yes. It is the network that the bacnet devices are connected to.

On Wed, Jun 7, 2023, 11:33 AM GravySeal @.***> wrote:

Just to confirm, the IP of your Home Assistant is also 10.76.216.240/20? I might have to set up such a network myself probably to test some things.

— Reply to this email directly, view it on GitHub https://github.com/Bepacom-Raalte/bepacom-HA-Addons/issues/10#issuecomment-1581170404, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALMR3MYPYF6KOBRMMABZNPLXKCUOXANCNFSM6AAAAAAX2BIGDE . You are receiving this because you commented.Message ID: @.***>

GravySeal commented 1 year ago

Hmm this is a tricky one. Are you sure there's nothing else bound to this IP and port 47808? I don't really see any obvious flaws. Course you maybe share some info about the internet adapters in Home Assistant?

diablo581 commented 1 year ago

It looks like maybe a full reboot was in order. I got the newest version of HA core and rebooted my VM and suddenly it is seeing A LOT of stuff. Adding the integration now.

GravySeal commented 1 year ago

That's great! Let me know how it went.