Closed s0170071 closed 10 months ago
quickfix: I wrote a shell script that you call via crontab every x minutes... It checks the thing status and if it reads "Jetty start failed" restarts piVCCU.
Make sure to chmod +x the file and put in your API key. You generate this in OH if you click on the lock on the lower left. Scroll down...
#!/bin/bash
# Redirect all output to the log file
log_file="restartpiVCCU_log.txt"
exec &>> "$log_file"
# put this line in crontab: use crontab -e to edit
# */5 * * * * /home/pi/restartpiVCCU.sh
# Step 2: Run the curl command and check the result
curl_result=$(curl -X GET 'http://192.168.1.30:8080/rest/things/homematic:bridge:ccu/status' -u 'oh.RestApi.Wmqq...yourAPIkeyhere...b7DQ': | grep -q -E '\bONLINE\b' > /dev/null ; echo $?)
# If the curl command exits with code 0, exit the script
if [ "$curl_result" -eq 0 ]; then
echo "$(date) homematic device is online"
exit 0
fi
# Step 3: Restart pivccu.service
curl_result=$(curl --silent -X GET 'http://192.168.1.30:8080/rest/things/homematic:bridge:ccu/status' -u 'oh.RestApi.Wmqq...yourAPIkeyhere...b7DQ': | grep -q -E '\bJetty\b' > /dev/null ; echo $?)
# If the curl command exits with code 0, exit the script
if [ "$curl_result" -eq 0 ]; then
echo "$(date) homematic device: Jetty start failed. Restarting pivccu.service"
sudo systemctl restart pivccu.service
exit 1
fi
Additional info: After OpenHAB log reads:
2023-10-07 09:06:15.445 [DEBUG] [ernal.handler.HomematicBridgeHandler] - HomematicConfig[gatewayAddress=192.168.1.31,callbackHost=192.168.1.30,xmlCallbackPort=9125,binCallbackPort=9126,gatewayType=auto,rfPort=2001,wiredPort=2000,hmIpPort=2010,cuxdPort=8701,groupPort=9292,timeout=15,discoveryTimeToLive=-1,installModeDuration=300,socketMaxAlive=900]
2023-10-07 09:06:15.480 [INFO ] [ternal.communicator.client.RpcClient] - Interface 'CUXD' on gateway 'ccu' not available, disabling support
2023-10-07 09:06:15.498 [DEBUG] [ommunicator.AbstractHomematicGateway] - Initializing gateway with id 'ccu'
2023-10-07 09:06:15.499 [INFO ] [ommunicator.AbstractHomematicGateway] - HmGatewayInfo[id=CCU,type=CCU2,firmware=3.71.12,address=PEQ0173550,rf=true,wired=true,hmip=true,cuxd=false,group=true]
2023-10-07 09:06:15.499 [DEBUG] [ommunicator.AbstractHomematicGateway] - Used Homematic transfer modes: RF:XML_RPC, WIRED:XML_RPC, HMIP:XML_RPC, GROUP:XML_RPC
2023-10-07 09:06:15.508 [DEBUG] [nal.communicator.server.XmlRpcServer] - Initializing XML-RPC server at port 9125
2023-10-07 09:06:15.516 [DEBUG] [ernal.handler.HomematicBridgeHandler] - Homematic bridge was set to OFFLINE-COMMUNICATION_ERROR due to the following exception: Jetty start failed
java.io.IOException: Jetty start failed
at org.openhab.binding.homematic.internal.communicator.server.XmlRpcServer.start(XmlRpcServer.java:92) ~[?:?]
at org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway.startServers(AbstractHomematicGateway.java:255) ~[?:?]
at org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway.initialize(AbstractHomematicGateway.java:192) ~[?:?]
at org.openhab.binding.homematic.internal.handler.HomematicBridgeHandler.initializeInternal(HomematicBridgeHandler.java:111) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.io.IOException: Failed to bind to /0.0.0.0:9125
running curl 192.168.1.30:9125
on the host machine returns:
<?xml version="1.0" encoding="ISO-8859-1"?>
<methodResponse><params><param><value></value></param></params></methodResponse>
aparently the issue has been solved by an update: apt-get update apt-get upgrade
The following packages will be upgraded:
bind9-host bind9-libs containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin file libc-bin libc-dev-bin libc-devtools libc-l10n libc6 libc6-dbg libc6-dev libflac8 libmagic-mgc libmagic1 libssl-dev libssl1.1 libwebp6
libwebpdemux2 libwebpmux3 libx11-6 libx11-data libxpm4 locales openssl
If I now restart the openhab container it re-gains access to piVCCU
Setting:
RPI4 with docker and PiVccu on it. OpenHab (latest: 4.0.3) as docker container.
Problem
After system start everything is fine. But if the OpenHab container is restarted, (
docker compose restart openhab
) it is not able to re-connect to piVCCU. The device is offline, the error message is Jetty start failed.Restarting piVCCU fixes this.
sudo systemctl restart pivccu.service
And just like that without any further interaction the thing goes online.