andig / homebridge-fritz

Homebridge platform for Fritz!Box router and supported DECT devices
MIT License
74 stars 22 forks source link

Plugin stopped working? No devices listed #109

Open BionicThomas opened 4 years ago

BionicThomas commented 4 years ago

Hi! First of all thanks for the very good plugin! Homebridge:0.4.50 Fritz Plugin 0.9.2 FritzBox 7490 with 07.12 FritzOS

It worked for me before I had about 10 devices from my FritzBox showing up, but now not a single device shows up on the homebridge list of devices and HomeKit for the FritzBox. Maybe the recent update from 0.9.0 to 0.9.2 caused it? I only noticed it today and cannot pinpoint an exact event though.

According to the log the login works but then an error is presented that would suggest no device is found, however shortly after messages about updating an outlet are shown.

2020-1-28 2:36:32 PM] [FritzBoxSmartHome] Fritz!Box platform login successful [2020-1-28 2:36:32 PM] [FritzBoxSmartHome] Discovering accessories [2020-1-28 2:36:33 PM] [Config] Homebridge Config UI X v4.8.1 is listening on :: port 8080 [2020-1-28 2:36:35 PM] [FritzBoxSmartHome] Alarm sensors found: none [2020-1-28 2:36:35 PM] [FritzBoxSmartHome] Could not get devices from Fritz!Box. Please check if device supports the smart home API and user has sufficient privileges. [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Outlets found: 087610215451,087610206592,087610243230,087610213856,087610211268,087610242979,087610328584,116570026378,116570130373,116300105298 [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Updating outlet 087610215451 [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Updating outlet 087610206592 [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Updating outlet 087610243230 [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Updating outlet 087610213856 [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Updating outlet 087610211268 [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Updating outlet 087610242979 [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Updating outlet 087610328584 [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Updating outlet 116570026378 [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Updating outlet 116570130373 [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Updating outlet 116300105298 [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Thermostats found: none [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Updating temperature sensor 116570188239 [2020-1-28 2:36:37 PM] [FritzBoxSmartHome] Sensors found: 116570188239

My config is simple:

{ "platform": "Fritz!Box", "name": "FritzBoxSmartHome", "username": "admin", "password": "xxxx", "url": "https://192.168.178.1", "interval": 60, "concurrent": false, "devices": { "wifi": { "name": "Guest WLAN", "display": false } }, "options": { "strictSSL": false } },

Question, should the user be the same that is used to log on to the fritz box, the one where basically only the password is asked for? is this the user "admin"? Tries as well to leave it "" blank, with the same results.

michi692 commented 4 years ago

Ich habe das gleiche Problem auch bereits in #106 beschrieben!

Die Rahmenbedingungen sind bei mir ähnlich. Allerdings sind es 12x FritzDECT 200 und eine FritzBox 7590

BionicThomas commented 4 years ago

Hi! Danke Michi692. Also scheint es am update von 0.9.0 zu 0.9.2 zu liegen. Ich warte noch diese Woche ob es eine Lösung gibt ansonsten versuche ich dann auch zu downgraden. Gibt es dafür ein Kommando oder eine Anleitung?

Vielen Dank im Voraus!

michi692 commented 4 years ago

Das müsste funktionieren:

npm install -g homebridge-fritz@0.9.0

jngmrks commented 4 years ago

Ich hab die 0.9.1 und alles funktioniert, jetzt bin ich mir gerade unsicher ob ich die 0.9.2 probieren soll 😅

andig commented 4 years ago

Danke für Euer Feedback! Könntet ihr bitte mal probieren, mit welchem commit es "kaputt" geht: 03d54b2ab9937c5c866ce354097ce918f7b234ff, 6dcf23d55b840d8b65a5e4efa2da79b75eccc6bc oder 915e1700f4d2535c77b146554996846ea5daceed? Was ist der letzte "gute" und der erste "schlechte"? Ich muss leider so doof fragen da ich nicht erkennen kann, wie bei NPM Versionen und Commits zusammen hängen. Könnt ihr bestätigen, dass bis 0.9.1 alles in Ordnung ist?

michi692 commented 4 years ago

Ok, will Ich gerne testen. Frage: wie installiere ich einen Commit?!

andig commented 4 years ago

Genau wie eine version, nur mit #commit-hash am Ende.

andig commented 4 years ago

@BionicThomas kannst Du bitte mal DEBUG Log anfertigen (siehe Readme). Ich würde gerne verstehen was da bei Initialisierung der Thermostate zurück kommt. Sehr merkwürdig...

jngmrks commented 4 years ago

Ich bin jetzt auf der 0.9.2 und funktioniert wunderbar mit den DECT 200, dann bin ich raus und kann leider nicht helfen. homebridge-fritz@0.9.2, fritzapi@0.10.7

andig commented 4 years ago

Könnt ihr bitte jeweils Eure Config posten? Welche geht, welche geht nicht?

BionicThomas commented 4 years ago

Downgrade auf 0.91 bringt alle DECT200 wieder. Daher sollte bei mir commit 915e170 das Problem sein.

michi692 commented 4 years ago

Kann ich bestätigen. Habe in einer Testumgebung auf 0.9.1 getestet. Hier ist alles vorhanden.

BionicThomas commented 4 years ago

Hi Andig, ich starte Homebridge auf einem Pi via systemctl. wenn ich "systemctl start homebridge -D" eingebe kommt nur "systemctl: ungültige Option -- D"- Hat jemand einen Tipp? Dann würde ich noch einmal auf 0.9.2 gehen um ein log zu erstellen.

andig commented 4 years ago

ich starte Homebridge auf einem Pi via systemctl.

Am einfachsten wäre es eine neue Installation im Userordner zum testen zu machen. Ohne SystemD und ohne globale installation. Dem sysctl kannst Du nicht einfach weitere Optionen mitgeben...

andig commented 4 years ago

@BionicThomas kannst Du Dir bitte mal https://github.com/andig/homebridge-fritz/commit/915e1700f4d2535c77b146554996846ea5daceed#diff-d65fb0a4a1a5707f12955fe28f74c8e6R171-R192 anschauen? Das ist der einzige Code der irgendetwas inhaltliches beiträgt. Wa passiert wenn Du wieder die https://github.com/andig/homebridge-fritz/commit/915e1700f4d2535c77b146554996846ea5daceed installiert, den Code dann aber auskommentierst?

Ich hab jetzt mehrfach drauf geschaut und finde einfach keinen Fehler :O

andig commented 4 years ago

ping @BionicThomas hast Du Gelegenheit das auszuprobieren?

BionicThomas commented 4 years ago

Meine steps: 1. sudo npm install -g homebridge-fritz@0.9.2

2. Homebridge neugestartet

=> Alle 200er und 201er wieder verschwunden.

3. sudo nano /usr/lib/node_modules/homebridge-fritz/lib/platform.js Zeile 172 bis 192 auskommentiert

4. Homebridge neugestartet

5. => Alle 200er und 201er sind wieder da!

BionicThomas commented 4 years ago

in meinem Set-up befinden sich auch 2 HAN-FUN Taster von der Telekom. Könnten diese die Ursache für die Inkompatibilität meiner Konfiguration mit Versionen > 0.9.1 sein?

BionicThomas commented 4 years ago

bin jetzt auf 0.9.4 gegangen. Dort selbes Bild, nur wenn ich die platform.js editiere erscheinen die Fritz Devices.

andig commented 4 years ago

Moin Thomas,

das beschriebene Verhalten ist eindeutig, ich sehe aber keine offensichtliche Fehlerursache. Falls möglich- könntest Du mich per SSH auf den Raspi lassen? Austausch von public key oder Passwort per Mail (cpuidle@gmx.de mailto:cpuidle@gmx.de).

Alternativ als letzten Versuch- könntest Du bitte ein

console.log(self.devicelist);

in den Code (vor die Buttons) mit einbauen? Dann würde ich versuchen die Initialisierung anders zu machen und die getSwitchList und getThermostatList calls komplett zu vermeiden.

Viele Grüße, Andreas

On 2. Feb 2020, at 16:21, Thomas notifications@github.com wrote:

bin jetzt auf 0.9.4 gegangen. Dort selbes Bild, nur wenn ich die platform.js editiere erscheinen die Fritz Devices.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/andig/homebridge-fritz/issues/109?email_source=notifications&email_token=AABND367UYMDRIVRK7MYGZDRA3QGTA5CNFSM4KMS4NX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKRZIAA#issuecomment-581145600, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABND37ZUN53H67QPCMB5MLRA3QGTANCNFSM4KMS4NXQ.

andig commented 4 years ago

Ping @BionicThomas

BionicThomas commented 4 years ago

Hi andig! Sorry für die verspätete Antwort. Ich war auf Dienstreise.

die Zeile habe ich eingefügt und neu gestartet

... self.log("Alarm sensors found: %s", self.getArrayString(alarms)); self.log(self.devicelist); console.log(self.devicelist); ...

Im Log erscheint nur "Undefined"?

[2020-2-6 12:33:33 PM] [FritzBoxSmartHome] Alarm sensors found: none [2020-2-6 12:33:33 PM] [FritzBoxSmartHome] undefined undefined [2020-2-6 12:33:34 PM] [FritzBoxSmartHome] Outlets found: 087610215451,087610206592,087610243230,087610213856,087610211268,087610242979,087610328584,116570026378,116570130373,116300105298

Am Besten gebe ich dir SSH access auf meinen PI?

andig commented 4 years ago

Am Besten gebe ich dir SSH access auf meinen PI?

bitte an: cpuidle@gmx.de

BionicThomas commented 4 years ago

hi andig!

Ich habe mal zur platform.js die Zeile eingefügt um die wirkliche Fehlermeldung zu erhalten. .... .catch(function(error) { self.log.error(error.message); self.log.error("Could not get devices from Fritz!Box. Please check if device supports the smart home API and user has sufficient privileges."); callback(accessories); .....

dann erschien im log:

[2020-2-7 1:18:26 PM] [FritzBoxSmartHome] device.button.forEach is not a function [2020-2-7 1:18:26 PM] [FritzBoxSmartHome] Could not get devices from Fritz!Box. Please check if device supports the smart home API and user has sufficient privileges.

Könnte dies helfen?

BionicThomas commented 4 years ago

Sehe gerade du hast eine branch "init" angelegt, die den Fehler beheben soll. Wie kann ich die installieren?

sudo npm install -g homebridge-fritz@init

hat nicht geklappt.

andig commented 4 years ago

Wie kann ich die installieren?

Siehe https://stackoverflow.com/questions/39732397/install-specific-branch-from-github-using-npm

BionicThomas commented 4 years ago

Der Anleitung hatte ich vorher schon versucht zu folgen. Schlußendlich habe ich die Datei manuell ausgetauscht.

dies führte leider zu folgendem Fehler:

[2020-2-7 2:45:58 PM] [FritzBoxSmartHome] Sensors found: 087610215451,087610206592,087610243230,087610213856,087610211268,087610242979,087610328584,116570188239,116570130373,116300105298 [2020-2-7 2:45:58 PM] [FritzBoxSmartHome] Alarm sensors found: none Unhandled rejection ReferenceError: message is not defined at /usr/lib/node_modules/homebridge-fritz/lib/platform.js:179:18 at tryCatcher (/usr/lib/node_modules/homebridge-fritz/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/usr/lib/node_modules/homebridge-fritz/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/usr/lib/node_modules/homebridge-fritz/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/usr/lib/node_modules/homebridge-fritz/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/usr/lib/node_modules/homebridge-fritz/node_modules/bluebird/js/release/promise.js:725:18) at _drainQueueStep (/usr/lib/node_modules/homebridge-fritz/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/usr/lib/node_modules/homebridge-fritz/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/usr/lib/node_modules/homebridge-fritz/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/usr/lib/node_modules/homebridge-fritz/node_modules/bluebird/js/release/async.js:15:14) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5)

Konnte [2020-2-7 1:18:26 PM] [FritzBoxSmartHome] device.button.forEach is not a function vielleicht ein Hinweis auf den Fehler im Master branch sein? Der init Branch half leider nicht.

andig commented 4 years ago

Mach mal bitte ein

console.log(devices);

nach der Zeile mit Sensors found:.

Unhandled rejection ReferenceError: message is not defined

Sehr merkwürdig, weil das kommt im ganzen Code nicht vor. Ich steh auf dem Schlauch. SSH wäre Klasse ;)

BionicThomas commented 4 years ago

das bringt folgenden Output. ps. Ich bin wieder zurück auf 0.9.4 Master mit auskommentiertem Buttons code

[ { identifier: '119340137738-2', id: '2000', functionbitmask: '8200', fwversion: '0.0', manufacturer: '0x0feb', productname: 'HAN-FUN', present: '1', name: 'Springbrunnen', etsiunitinfo: { etsideviceid: '406', unittype: '273', interfaces: '772' }, button: { lastpressedtimestamp: '1581092520' } }, { identifier: '119340137738-1', id: '2001', functionbitmask: '8200', fwversion: '0.0', manufacturer: '0x0feb', productname: 'HAN-FUN', present: '1', name: 'Dachbeleuchtung', etsiunitinfo: { etsideviceid: '406', unittype: '273', interfaces: '772' }, button: { lastpressedtimestamp: '1580512738' } }, { identifier: '119340120992-2', id: '2002', functionbitmask: '8200', fwversion: '0.0', manufacturer: '0x0feb', productname: 'HAN-FUN', present: '1', name: 'HAN-FUN #3 - F2', etsiunitinfo: { etsideviceid: '408', unittype: '273', interfaces: '772' }, button: { lastpressedtimestamp: '1581200111' } }, { identifier: '119340120992-1', id: '2003', functionbitmask: '8200', fwversion: '0.0', manufacturer: '0x0feb', productname: 'HAN-FUN', present: '1', name: 'HAN-FUN #3 - F1', etsiunitinfo: { etsideviceid: '408', unittype: '273', interfaces: '772' }, button: { lastpressedtimestamp: '1581200111' } }, { identifier: '087610215451', id: '16', functionbitmask: '2944', fwversion: '04.16', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Trockner', switch: { state: '1', mode: 'manuell', lock: '0', devicelock: '0' }, powermeter: { voltage: '229544', power: '876610', energy: '2071263' }, temperature: { celsius: '195', offset: '0' } }, { identifier: '087610206592', id: '17', functionbitmask: '2944', fwversion: '04.16', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Waschmaschine', switch: { state: '1', mode: 'manuell', lock: '0', devicelock: '0' }, powermeter: { voltage: '228326', power: '0', energy: '1620953' }, temperature: { celsius: '170', offset: '0' } }, { identifier: '087610243230', id: '18', functionbitmask: '2944', fwversion: '04.16', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Dachbeleuchtung', switch: { state: '0', mode: 'auto', lock: '0', devicelock: '0' }, powermeter: { voltage: '228106', power: '0', energy: '171328' }, temperature: { celsius: '185', offset: '0' } }, { identifier: '087610213856', id: '19', functionbitmask: '2944', fwversion: '04.16', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Wohnzimmer Stern', switch: { state: '0', mode: 'manuell', lock: '0', devicelock: '0' }, powermeter: { voltage: '226639', power: '0', energy: '1479572' }, temperature: { celsius: '210', offset: '0' } }, { identifier: '087610211268', id: '20', functionbitmask: '2944', fwversion: '04.16', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Küche Stern', switch: { state: '0', mode: 'manuell', lock: '0', devicelock: '0' }, powermeter: { voltage: '228506', power: '0', energy: '420092' }, temperature: { celsius: '225', offset: '0' } }, { identifier: '087610242979', id: '21', functionbitmask: '2944', fwversion: '04.16', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Wohnzimmer', switch: { state: '1', mode: 'manuell', lock: '0', devicelock: '0' }, powermeter: { voltage: '226343', power: '18810', energy: '1717520' }, temperature: { celsius: '210', offset: '0' } }, { identifier: '087610328584', id: '22', functionbitmask: '2944', fwversion: '04.16', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Keller Lüftung', switch: { state: '0', mode: 'auto', lock: '0', devicelock: '0' }, powermeter: { voltage: '228475', power: '0', energy: '75306' }, temperature: { celsius: '195', offset: '0' } }, { identifier: '116570026378', id: '23', functionbitmask: '2688', fwversion: '04.17', manufacturer: 'AVM', productname: 'FRITZ!DECT 210', present: '0', name: 'Springbrunnen', switch: { state: '', mode: '', lock: '', devicelock: '' }, powermeter: { voltage: '', power: '', energy: '' } }, { identifier: '116570188239', id: '24', functionbitmask: '1280', fwversion: '04.16', manufacturer: 'AVM', productname: 'FRITZ!DECT Repeater 100', present: '1', name: 'FRITZ!DECT Repeater 100', temperature: { celsius: '225', offset: '0' } }, { identifier: '116570130373', id: '25', functionbitmask: '2944', fwversion: '04.17', manufacturer: 'AVM', productname: 'FRITZ!DECT 210', present: '0', name: 'Balkon', switch: { state: '', mode: '', lock: '', devicelock: '' }, powermeter: { voltage: '', power: '', energy: '' }, temperature: { celsius: '', offset: '' } }, { identifier: '119340137738', id: '406', functionbitmask: '1', fwversion: '31.20', manufacturer: '0x0feb', productname: 'HAN-FUN', present: '1', name: 'Taster Küche' }, { identifier: '119340120992', id: '408', functionbitmask: '1', fwversion: '31.20', manufacturer: '0x0feb', productname: 'HAN-FUN', present: '1', name: 'Taster Küche 2 (Stern)' }, { identifier: '116300105298', id: '26', functionbitmask: '2944', fwversion: '04.16', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Schlafzimmer Stern', switch: { state: '0', mode: 'auto', lock: '0', devicelock: '0' }, powermeter: { voltage: '225686', power: '0', energy: '282' }, temperature: { celsius: '210', offset: '0' } } ]

BionicThomas commented 4 years ago

ich habe einfach mal um den Buttons code einen eigenen try / catch gebaut. es stört sich wie gehabt an "device.button.forEach is not a function" Interessanterweise gibt er dann aber doch noch einen Button zurück. Siehe log weiter unten.

try
                {
                // buttons
                var buttons = [];
                devices.forEach(function (device) {
                    let FritzButtonAccessory = require('./accessories/button')(Homebridge);

                    if (device.button) {
                        var ain = device.identifier.replace(/\s/g, '');
                        if (!accessories.find(function (accessory) {
                            return accessory.ain && accessory.ain == ain;
                        })) {
                       buttons.push(ain);

                            if (self.deviceConfig(`${ain}.display`, true)) {
                                device.button.forEach(function(button, index) {
                                    accessories.push(new FritzButtonAccessory(self, ain, index, button.name));
                                });
                            }
                        }
                    }
                });
                } // try
                catch (e) {
                self.log("Button Error:" + e.name + "-" + e.message);
                }
                self.log("Buttons found: %s", self.getArrayString(buttons));

[2020-2-9 1:16:59 PM] [FritzBoxSmartHome] Alarm sensors found: none [2020-2-9 1:16:59 PM] [FritzBoxSmartHome] Button Error:TypeError-device.button.forEach is not a function [2020-2-9 1:16:59 PM] [FritzBoxSmartHome] Buttons found: 119340137738-2

andig commented 4 years ago

Wie gesagt, das ist völlig ungetestet weil bei mir grad kein Homebridge läuft. Dein Output hilft aber, muss mich nur noch ransetzen und das aufräumen...

BionicThomas commented 4 years ago

Hi andig! Mittlerweile habe ich auf eine FB 7590 umgestellt. Meine Konfiguration habe ich dabei übernommen. Unter 0.9.5 läuft es leider aber weiterhin nur wenn ich die buttons section entweder auskommentiere oder per try / catch dafür sorge, dass nur dieser Bereich in eine Exception läuft.

[1.5.2020, 12:19:59] [FritzBoxSmartHome] Alarm sensors found: none [1.5.2020, 12:19:59] [FritzBoxSmartHome] Button Error:TypeError-device.button.forEach is not a function [1.5.2020, 12:19:59] [FritzBoxSmartHome] Buttons found: 119340137738-2

Der eine als "Buttons found" dargestellte AIN ist übrigens ein HAN-FUN 2-fach Button in meiner Konfiguration. Davon habe ich eigentlich 2. Es handelt sich dabei um die Buttons von der Telekom. Reagieren diese vielleicht anders als erwartet? Kann es sein, dass die dieses Problem nicht haben auch keinen solchen button haben und anders herum?

andig commented 4 years ago

Ich hab momentan leider extrem wenig Zeit da https://github.com/andig/evcc meine Freizeit voll beansprucht. Würde mich über einen PR aber sehr freuen!