homematic-community / hm_pdetect

:iphone: A HomeMatic CCU-Addon to regularly query AVM FRITZ!-devices for registered WiFi/LAN devices and deduce general user presence from this information
GNU Lesser General Public License v3.0
74 stars 6 forks source link

SID wird nicht gespeichert wenn eine http(s)-URL als FritzBox IP angegeben wird #128

Closed hotroot closed 1 year ago

hotroot commented 1 year ago

Konfiguriert man hm_pdetect so, dass es die FritzBox per HTTPS anfragt, wird die SID nicht mehr gespeichert. Dies äußert sich zunächst einmal dadurch, dass die erste Logzeile eines jeden Durchlaufs den Zusatz (fresh login) erhält. Auch wird das FritzBox Log mit Einträgen zu den Login gefüllt.

Führt man hm_pdetect manuell aus, stellt man fest, dass bei jedem Durchlauf folgender Fehler geloggt wird: /usr/local/addons/hm_pdetect/bin/hm_pdetect.sh: line 475: /tmp/hm_pdetect-https://192.168.133.1.sid: No such file or directory

Mit folgendem kleinen Patch kann man das Problem lösen:

--- hm_pdetect.sh.orig
+++ hm_pdetect.sh
@@ -445,6 +445,8 @@
   # identifier or if we have to add it ourself
   if [[ ! ${ip} =~ ^http(s)?:\/\/ ]]; then
     uri="http://${ip}"
+  else
+    ip=$(echo ${ip} | sed -E 's/^http(s)?:\/\///g')
   fi

   # retrieve the network device list from the fritzbox using a