Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communication goes silent between -ha and -ws if the box that the -ws docker is running on is rebooted #2

Open
ltgcc opened this issue Nov 12, 2024 · 2 comments

Comments

@ltgcc
Copy link

ltgcc commented Nov 12, 2024

Communication goes silent between concord4ha and concord4ws if the box that the ws docker is running on is rebooted (on purpose or otherwise).

Communication restarts (resumes?) if I:

 sudo systemctl restart home-assistant.service.

in the box running home-assistant. Until the next time the box running concord4ws is rebooted anyway.

the physical box running concord4ws docker is an rpi3b running dietpi bookworm. Connection to the concord4 automation module is with a prologic PL2303 usb-serial adapter.

udev rule on -ws box:

ser2net ~/concord4ws $ cat /etc/udev/rules.d/99-usb-serial.rules 

SUBSYSTEM=="tty",ATTRS{serial}=="BVBOb132ann",SYMLINK+="ttyConcord232"

the actual device is /dev/ttyUSB1

The docker is not being run as root. Right now it's being started as a normal user (me). My uid is a member of the dialout group, so access to the serial port shouldn't be a problem.

The docker is started with:

ser2net ~/concord4ws $ cat concord4ws_docker_start.sh 
docker run --name concord4ws -d \
  --restart unless-stopped \
  --device=/dev/ttyConcord232 \
  -p 8080:8080 \
  -e SERIAL_DEVICE=/dev/ttyConcord232 \
  -e SOCKET_PORT=8080 \
  ghcr.io/joeyeamigh/concord4ws:latest

side note: I also have a docker-compose.yml that I can use also. The connection has the same issue on reboot.

The "box" running home assistant with the concord4ha integration is a proxmox 7 kvm (not LXC) running dietpi bookworm. Not sure what information I need to post about that here.

concord4ws log:

ser2net ~ $ docker container logs concord4ws -f
2024-11-12T07:42:38.152321Z INFO concord4ws: initializing concord4 connection
2024-11-12T07:42:38.158766Z INFO concord4::serial: Receiving data on /dev/ttyConcord232 at 9600 baud:
2024-11-12T07:42:38.158983Z INFO concord4ws: starting websocket server
2024-11-12T07:42:38.159214Z INFO concord4ws: Listening on: 0.0.0.0:8080
2024-11-12T07:42:39.453229Z INFO concord4::serial::loop: panel requested an image reset
2024-11-12T07:42:49.258218Z INFO concord4::serial::loop: panel is ready to go!
2024-11-12T07:43:51.011962Z INFO concord4ws::websocket: new websocket connection: 192.168.22.23:54102
2024-11-12T07:43:51.016859Z INFO concord4ws::websocket: websocket connection closed: 192.168.22.23:54102
2024-11-12T07:43:51.025945Z INFO concord4ws::websocket: new websocket connection: 192.168.22.23:54116
2024-11-12T07:49:55.974219Z INFO concord4ws::monitoring: received SIGTERM, shutting down REBOOTED HERE
2024-11-12T07:49:55.974367Z INFO concord4ws: shutting down websocket server
2024-11-12T07:49:55.974411Z INFO concord4ws: waiting for threads to finish
2024-11-12T07:49:55.974474Z INFO concord4ws::websocket: gracefully shutting down websocket connection: 192.168.22.23:54116
2024-11-12T07:49:55.974866Z INFO concord4ws::websocket: closed websocket connection: 192.168.22.23:54116
2024-11-12T07:50:32.386055Z INFO concord4ws: initializing concord4 connection
2024-11-12T07:50:32.404864Z INFO concord4::serial: Receiving data on /dev/ttyConcord232 at 9600 baud:
2024-11-12T07:50:32.405256Z INFO concord4ws: starting websocket server
2024-11-12T07:50:32.405705Z INFO concord4ws: Listening on: 0.0.0.0:8080
2024-11-12T07:50:33.548334Z INFO concord4::serial::loop: panel requested an image reset

I hit return a bunch of time here so I could see new entries better

2024-11-12T07:50:47.365182Z INFO concord4::serial::loop: panel is ready to go!

and this is where the logs stop for a while. there are no updates in the homeassistant concord4ha binary_sensors list or in the logbook

Restarted the home-assistant.service in the kvm running home-assistant.
2024-11-12T07:51:48.958648Z INFO concord4ws::websocket: new websocket connection: 192.168.22.23:54196
2024-11-12T07:51:48.965991Z INFO concord4ws::websocket: websocket connection closed: 192.168.22.23:54196
2024-11-12T07:51:48.975678Z INFO concord4ws::websocket: new websocket connection: 192.168.22.23:54212

and now the homeassistant concord4ha binary_sensors list and the logbook in home-assistant integration starts updating. Anything that happened between the concord4ws reboot and the home-assistant restart does not appear in the logbook.

This was sort of my brain dump. If you want/need any other info I'm happy to provide.

@JoeyEamigh
Copy link
Owner

so it seems like home assistant is not getting the message that the WS server died and therefore is not trying to reconnect. I will take a look at that next time I get a minute to work on this project. great bug report and sorry for the inconvenience! I had not noticed that as my WS server and HA are on the same machine and the WS comes up much faster than HA does.

@ltgcc
Copy link
Author

ltgcc commented Nov 13, 2024

Thanks for the compliment on the bug report. Usually people tell me I say too much lol. the 'disconnect' has not been at all an inconvenience because I'm still assembling all this stuff.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants