thkl / hap-homematic

a AddOn for HomeMatic CCU3 (Raspberrymatic) that will bring HomeKit to your CCU
MIT License
222 stars 24 forks source link

homekit homematic stürtzt ab. #614

Open oppey666 opened 1 year ago

oppey666 commented 1 year ago

Hi, ich nutze die Zusatz Software schon etwas länger und war immer zufrieden. Seit geraumer Zeit stürzt diese ab sobald ich was ändern möchte oder ein gerät hinzufüge. Auch nach warten kommt diese nicht wieder. Der Neustart bringt eine Fehlermeldung über die CCU (raspmatic) wie auf dem Bild zusehen. Den Inhalt des logs habe ich auch angehängt. Erst der komplette Neustart von raspmatic macht Homekit wieder erreichbar. Ich habe bereits alles einmal deinstalliert und neu erstellt. Wo muss ich weiter suchen um das Problem zu lösen?

Danke und Grüße

homkit homkit2
AlexG-78 commented 1 year ago

Hi, ist bei mir auch genauso gewesen nach einem Raspberrymatic Update. ich habe letztlich den Cache manuell aus dem persist Ordner gelöscht.

:/usr/local/etc/config/addons/hap-homematic/persist dort den Inhalt löschen und um Anschluss den Service neustarten mit start-stop-daemon --start --quiet --oknodo --make-pidfile --background --pidfile /var/run/hap-homematic.pid --exec node /usr/local/addons/hap-homematic/node_modules/

Danach lässt sich die HAP-Homematic Seite wieder aufrufen.

oppey666 commented 1 year ago

start-stop-daemon --start --quiet --oknodo --make-pidfile --background --pidfile /var/run/hap-homematic.pid --exec node /usr/local/addons/hap-homematic/node_modules/

danke für die Unterstützung. ist das mit copy und paste getan? Also den Ordner hab ich geleert anschließend und versucht den Service neu zu starten. Hab aber das Gefühl, dass das nicht funktioniert, da ich kein Feedback bekomme. Veröffentlichen von Instanzen reicht um den Service wieder abstürzten zu lassen.

AlexG-78 commented 1 year ago

Ich glaube da war ein Fehler: stop den Dienst erstmal mit: start-stop-daemon --stop --quiet --oknodo --retry 5 --pidfile /var/run/hap-homematic.pid Falls das pid file noch da ist unter /var/run lösch es manuell Dann nochmal start-stop-daemon --start --quiet --oknodo --make-pidfile --background --pidfile /var/run/hap-homematic.pid --exec node /usr/local/addons/hap-homematic/node_modules/hap-homematic/index.js

Es dauert ein wenig bis die Geräte wieder erreichbar sind in Homekit. Ansonsten nochmal die CCU neustarten. Danach kann man via Webinterface wieder auf HAP zugreifen.

oppey666 commented 1 year ago

-Dienst gestoppt -kein pid file vorhanden gewesen -deamon ausgeführt...

sieht nicht ganz schlecht aus. der Service läuft stabil. Hab mal ein gerät hinzugefügt und veröffentlicht. leider haben tablets und handys keine Verbindung mehr zur Bridge und versucht permanent zu aktualisieren. hab jetzt den Service übern Browser neu gestartet.

edit: habe gerade festgestellt, dass wenn ich ein Gerät lösche und wieder hinzufüge im Homekit, dann funktioniert es. gibt es ne bequemere variante als alle zu löschen und neu hinzuzufügen? Hab ich leider schon zu oft hinter mir.

AlexG-78 commented 1 year ago

Ich habe für jeden Raum eine Bridge angelegt. Musste in hk dann nur noch die bridges neu verknüpfen. Die Geräte sind dann automatisch da.

oppey666 commented 1 year ago

logisch. danke für die hilfe. Hoffe es läuft weiter so gut wie jetzt.

oppey666 commented 1 year ago

heute morgen war der Service wieder down. Ich kann ihn neu starten ober er hängt sich wieder auf. zu Beginn. Abhilfe bringt wieder nur der CCU neustart.

Screenshot 2023-02-27 064056 Screenshot 2023-02-27 063859 Screenshot 2023-02-27 064741
AlexG-78 commented 1 year ago

Ich habe mal gesucht, es gitb hier ein Ticket, welches die Abstürze mit CuXD in Verbindung bringt. Die gleiche Fehlermeldung bekomme ich auch 'sendbinrpc(127.0.0.1:9876) - write() Connection refused' Das ist die Kommunikation zu meinen CuXD Devices, die in HK eingebunden sind ( Markisen von Somfy)

Ich nehme sie mal aus der Config raus und schau mal ob das Plugin stabil läuft. Hier der Link zum anderen Ticket: https://github.com/thkl/hap-homematic/issues/546

AlexG-78 commented 1 year ago

Kleines Update: Bei mir läuft alles seit einer WOche ohne Prbleme durch. Alle Geräte sind erkannt und nichts stürzt ab

oppey666 commented 1 year ago

Moin wenn ich nichts verändere läufts bei mir auch. Sobald ich allerdings ein neues Gerät zur Homebridge hinzufüge hilft mal wieder nur der Neustart von Raspmatic. Ich werde hoffen, dass ich bald an dem Punkt gelange an dem ich alles verfügbar habe und keine Geräte mehr hinzufügen muss......so läuft es stabil.

bloop16 commented 1 year ago

Hi, Ich Habe das selbe Problem. Seit dem Firmware Update von 3.65. zu 3.69.6.20230407 läuft HomeKit nicht mehr stabil. HAP stürzt mir immer wieder durch hinzufügen oder entfernen von Geräten ab. Durch einen Neustart ist das Problem wieder behoben. Wenn keine Änderungen gemacht werden läuft HAP stabil. Gibt es Bereits eine Lösung? Die angegebenen Befehlen haben bei mir leider nicht für Abhilfe gesorgt. Herzlichen Dank!

omueller99 commented 1 year ago

Bei mir das gleiche Problem - weder o.g. Befehle noch ein Neustart der Homematic haben bisher geholfen :-(

ZenitES commented 1 year ago

Eine Frage, habt ihr alle ein HmIP-DLD im Einsatz?

ZenitES commented 1 year ago

571 ist dann die Lösung!

matthiaseinig commented 9 months ago

Hi Zusammen,

Mittlerweile hat sich zumindest bei mir das Absturzproblem beim hinzufügen/entfernen von Geräten gelöst (ich habe alles nochmal von neuem aufgesetzt gehabt).

Dennoch stürzt leider Homematic-HAP im normalen Betrieb sporadisch alle 2-3 Wochen ab. Ich habe bisher noch keine Ursache identifizieren können. #571 ist bei mir nicht relevant.

Da ich über 100 devices darüber an HomeKit anbinde, und alles normalerweise super funktioniert (danke dafür and alle Beteiligten), habe ich mir nun mit einem kleinen Workaround beholfen, den ich gerne mit allen teile.

Ich lasse nun einfach auf der CCU3 ein Bash Script laufen, das prüft ob die Url von Homematic-HAP erreichbar ist, wenn nicht wird der Prozess gekillt und neu gestartet. Das ganze passiert alle 10min über einen cron Job im Hintergrund.

Seitdem ich das so laufen habe, habe ich keine Probleme mehr. Danke @AlexG-78 für die Befehle zum Neustart.

Hier das Script mit Anleitung zur Installation als Crontab

#!/bin/sh

# This bash script will check if Homematic-HAP is up and running and if not
# attempts to restart the service.
# The script can be installed as recurring job on the CCU, to make sure that 
# Homematic-HAP is not down longer than 10mins
#
#
# To install as crontab recurring job:
# 1. enable SSH in Homematic CCU3 System > Security > SSH
# 2. safe file locally eg. restart-homematic-hap.sh
# 3. open terminal and run 
#    ssh root@<ipaddress of CCU3> 
#    enter password defined for SSH in CCU3 settings
# 4. create a folder for script eg /usr/local/scripts by executing command
#    md /usr/local/scripts
# 5. in a separate terminal, upload file to CCU3 to the remote path 
#    scp /<local path>/restart-homematic-hap.sh  root@<ipaddress of CCU3>:/usr/local/scripts
# 6. make the script executable by running the command chmod u+x restart-homematic-hap.sh
# 6. now install the script to run every 10mins as crontjob
#    a) to edit contrab configuration in vi run
#       crontab -e
#    b) type i to enable insert mode
#    c) insert the following as new line (the output will be piped into the restart.log file)
#       */10 * * * * /usr/local/scripts/restart-homematic-hap.sh >> /usr/local/scripts/restart.log  
#    d) pres ESC to exit edit mode and type :w <Enter> to safe and :q <Enter> to quit vi
# 7. wait 10mins and the cronttab should have created the log file with the output of the script, view with following command
#    cat /usr/local/scripts

date
echo "Checking if Homematic HAP is running"

# check if Homematic-HAP url is available by loading the configuration page and getting the status code
statuscode=`curl -s -I -L http://<ipaddress of CCU3>:9874 | grep -i -m 1 "HTTP" | awk '{print $2}'`

if [ -z "$statuscode" ] || [ $statuscode -ne 200 ]
then
   echo "Homematic-HAP unavailable, trying to restart"

   # Look for a running instance of hap-home
   p=$(ps -eaf | grep "node /usr/local/addons/hap-homematic/node_modules/hap-home")
   # Get the process number
   n=$(echo $p | awk '{print $1}')
   # if the process is running, kill it
   if [ "$n" ]
   then
      echo "Stopping service Homematic-HAP"
      start-stop-daemon --stop --quiet  --oknodo  --retry 5  --pidfile /var/run/hap-homematic.pid
   fi
   # Start a new instance after a 15s pause
   echo "Restarting in 15s"
   sleep 15
   start-stop-daemon --start --quiet --oknodo --make-pidfile --background  --pidfile /var/run/hap-homematic.pid --exec node /usr/local/addons/hap-homematic/node_modules/hap-homematic/index.js
   echo "Restarted"
else
    echo "Homematic-HAP running fine"
fi
echo "Done"