bombadiltom / homebridge-rademacher-homepilot

MIT License
26 stars 21 forks source link

2 Kanal Schaltaktor #8

Closed ghost closed 5 years ago

ghost commented 5 years ago

wenn ich einen 2-Kanal Schaltaktor im Homepilot einbinde, erhalte ich folgenden Fehler:

/usr/local/lib/node_modules/homebridge-rademacher-homepilot/accessories/RademacherSwitchAccessory.js:50 body.devices.forEach(function(data) { ^ homebridge.service: Main process exited, code=exited, status=1/FAILURE homebridge.service: Unit entered failed state. homebridge.service: Failed with result 'exit-code'. pam_unix(sudo:session): session closed for user root homebridge.service: Service hold-off time over, scheduling restart.

Die Homebridge startet dann permanent neu, sobald getCurrentState aufgerufen wird. Wenn ich nur einen Kanal des Autors in den Homepilot einbinde, funktioniert es.

ghost commented 5 years ago

anscheinend kann folgendes passieren. Im JSON, das zurückgegeben wird, könnte ein Duplikat der selben Instanz erzeugt werden (darauf hin stürzt die Homebridge ab) ich habe folgendes JSON beim Aufruf von /deviceajax.do?devices=1 erhalten

"devices": [ { "did": 1010014, "name": "DuoFern Universal-Aktor 2-Kanal", "description": "Esszimmer", "initialized": 1, "position": 0, "productName": "DuoFern Universal-Aktor 2-Kanal", "serial": "43 89 89", "statusesMap": { "Position": 0, "Manuellbetrieb": 0 }, ..... }, { "did": 1010015, "name": "DuoFern Universal-Aktor 2-Kanal", "description": "Küche", "initialized": 1, "position": 100, "productName": "DuoFern Universal-Aktor 2-Kanal", "serial": "43 89 89", "statusesMap": { "Position": 100, "Manuellbetrieb": 0 },....

daher habe ich in RademacherSwitchAccessory.js diese Änderung gemacht (in der Hoffnung dass devices.did tatsächlich KEIN Duplikat sein kann

RademacherSwitchAccessory.prototype.getCurrentState = function(callback) { this.log("%s - Getting current state for %s", this.accessory.displayName, this.accessory.UUID); var self = this; var serial = this.sw.serial; var name = this.sw.name; var did = this.sw.did; // anscheinend eine id, die kein Duplikat zu sein scheint request.get({ timeout: 1500, strictSSL: false, url: this.url + "/deviceajax.do?devices=1" }, function(e,r,b) { if(e) return callback(new Error("Request failed: "+e), false); var body = JSON.parse(b); body.devices.forEach(function(data) { if(data.did==did && data.serial == serial && data.name == name ){ // Prüfung auf Duplikate var pos = data.position; callback(null, (pos==100?true:false)); } }); }); };

bombadiltom commented 5 years ago

Moin,

macht Sinn, es hätte auch genügt, die unterschiedlich zu benennen:

"did": 10029, "name": "Flursteckdose 2", "description": "Flursteckdose 2", "initialized": 1, "position": 100, "productName": "DuoFern Universal-Aktor 2-Kanal“,

Werde ich morgen mal in allen Accessories korrigieren...

MfG,

Tom Lorenz Im Grünen Winkel 21 59423 Unna Tel: 02303 592524 Fax: 02303 592534 mailto:tom@lorenz-unna.de

Am 08.12.2018 um 18:53 schrieb Alexander Flint notifications@github.com:

anscheinend kann folgendes passieren. Im JSON, das zurückgegeben wird, könnte ein Duplikat der selben Instanz erzeugt werden (darauf hin stürzt die Homebridge ab), daher habe ich in RademacherSwitchAccessory.js diese Änderung gemacht (in der Hoffnung dass devices.did tatsächlich KEIN Duplikat sein kann ;-)

RademacherSwitchAccessory.prototype.getCurrentState = function(callback) { this.log("%s - Getting current state for %s", this.accessory.displayName, this.accessory.UUID);

var self = this; var serial = this.sw.serial; var name = this.sw.name; var did = this.sw.did; request.get({ timeout: 1500, strictSSL: false, url: this.url + "/deviceajax.do?devices=1" }, function(e,r,b) { if(e) return callback(new Error("Request failed: "+e), false); var body = JSON.parse(b);

body.devices.forEach(function(data) {
    if(**data.did==did** && data.serial == serial && data.name == name )
    {
        var pos = data.position;
        callback(null, (pos==100?true:false));
    }
});

}); };

ich habe folgendes JSON beim Aufruf von /deviceajax.do?devices=1 erhalten

"devices": [ { "did": 1010014, "name": "DuoFern Universal-Aktor 2-Kanal", "description": "Esszimmer", "initialized": 1, "position": 0, "productName": "DuoFern Universal-Aktor 2-Kanal", "serial": "43 89 89", "statusesMap": { "Position": 0, "Manuellbetrieb": 0 }, ..... }, { "did": 1010015, "name": "DuoFern Universal-Aktor 2-Kanal", "description": "Küche", "initialized": 1, "position": 100, "productName": "DuoFern Universal-Aktor 2-Kanal", "serial": "43 89 89", "statusesMap": { "Position": 100, "Manuellbetrieb": 0 },....

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bombadiltom/homebridge-rademacher-homepilot/issues/8#issuecomment-445477342, or mute the thread https://github.com/notifications/unsubscribe-auth/AS6kJJMvrWWbz0Mojoph6fgho9drgJfmks5u2_yjgaJpZM4ZJunR.

ghost commented 5 years ago

Hi,

Leider nicht, da man device.name nicht selbst benennen kann. Das macht der Homepilot . Wenn man das Gerät umbenennt wird device.description geändert.

Gruß

Am 09.12.2018 um 00:34 schrieb Tom Lorenz notifications@github.com:

Moin,

macht Sinn, es hätte auch genügt, die unterschiedlich zu benennen:

"did": 10029, "name": "Flursteckdose 2", "description": "Flursteckdose 2", "initialized": 1, "position": 100, "productName": "DuoFern Universal-Aktor 2-Kanal“,

Werde ich morgen mal in allen Accessories korrigieren...

MfG,

Tom Lorenz Im Grünen Winkel 21 59423 Unna Tel: 02303 592524 Fax: 02303 592534 mailto:tom@lorenz-unna.de

Am 08.12.2018 um 18:53 schrieb Alexander Flint notifications@github.com:

anscheinend kann folgendes passieren. Im JSON, das zurückgegeben wird, könnte ein Duplikat der selben Instanz erzeugt werden (darauf hin stürzt die Homebridge ab), daher habe ich in RademacherSwitchAccessory.js diese Änderung gemacht (in der Hoffnung dass devices.did tatsächlich KEIN Duplikat sein kann ;-)

RademacherSwitchAccessory.prototype.getCurrentState = function(callback) { this.log("%s - Getting current state for %s", this.accessory.displayName, this.accessory.UUID);

var self = this; var serial = this.sw.serial; var name = this.sw.name; var did = this.sw.did; request.get({ timeout: 1500, strictSSL: false, url: this.url + "/deviceajax.do?devices=1" }, function(e,r,b) { if(e) return callback(new Error("Request failed: "+e), false); var body = JSON.parse(b);

body.devices.forEach(function(data) { if(data.did==did && data.serial == serial && data.name == name ) { var pos = data.position; callback(null, (pos==100?true:false)); } });

}); };

ich habe folgendes JSON beim Aufruf von /deviceajax.do?devices=1 erhalten

"devices": [ { "did": 1010014, "name": "DuoFern Universal-Aktor 2-Kanal", "description": "Esszimmer", "initialized": 1, "position": 0, "productName": "DuoFern Universal-Aktor 2-Kanal", "serial": "43 89 89", "statusesMap": { "Position": 0, "Manuellbetrieb": 0 }, ..... }, { "did": 1010015, "name": "DuoFern Universal-Aktor 2-Kanal", "description": "Küche", "initialized": 1, "position": 100, "productName": "DuoFern Universal-Aktor 2-Kanal", "serial": "43 89 89", "statusesMap": { "Position": 100, "Manuellbetrieb": 0 },....

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bombadiltom/homebridge-rademacher-homepilot/issues/8#issuecomment-445477342, or mute the thread https://github.com/notifications/unsubscribe-auth/AS6kJJMvrWWbz0Mojoph6fgho9drgJfmks5u2_yjgaJpZM4ZJunR.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bombadiltom/homebridge-rademacher-homepilot/issues/8#issuecomment-445498086, or mute the thread https://github.com/notifications/unsubscribe-auth/Afnd-2vUn7iRY6e6mh2aRye9PiPeGaYxks5u3EyagaJpZM4ZJunR.

bombadiltom commented 5 years ago

Hmm, ich kann im Homepilot beides ändern, das JSON ist echt

Best mobile regards,

Tom Lorenz

Am 09.12.2018 um 01:22 schrieb Alexander Flint notifications@github.com:

Hi,

Leider nicht, da man device.name nicht selbst benennen kann. Das macht der Homepilot . Wenn man das Gerät umbenennt wird device.description geändert.

Gruß

Am 09.12.2018 um 00:34 schrieb Tom Lorenz notifications@github.com:

Moin,

macht Sinn, es hätte auch genügt, die unterschiedlich zu benennen:

"did": 10029, "name": "Flursteckdose 2", "description": "Flursteckdose 2", "initialized": 1, "position": 100, "productName": "DuoFern Universal-Aktor 2-Kanal“,

Werde ich morgen mal in allen Accessories korrigieren...

MfG,

Tom Lorenz Im Grünen Winkel 21 59423 Unna Tel: 02303 592524 Fax: 02303 592534 mailto:tom@lorenz-unna.de

Am 08.12.2018 um 18:53 schrieb Alexander Flint notifications@github.com:

anscheinend kann folgendes passieren. Im JSON, das zurückgegeben wird, könnte ein Duplikat der selben Instanz erzeugt werden (darauf hin stürzt die Homebridge ab), daher habe ich in RademacherSwitchAccessory.js diese Änderung gemacht (in der Hoffnung dass devices.did tatsächlich KEIN Duplikat sein kann ;-)

RademacherSwitchAccessory.prototype.getCurrentState = function(callback) { this.log("%s - Getting current state for %s", this.accessory.displayName, this.accessory.UUID);

var self = this; var serial = this.sw.serial; var name = this.sw.name; var did = this.sw.did; request.get({ timeout: 1500, strictSSL: false, url: this.url + "/deviceajax.do?devices=1" }, function(e,r,b) { if(e) return callback(new Error("Request failed: "+e), false); var body = JSON.parse(b);

body.devices.forEach(function(data) { if(data.did==did && data.serial == serial && data.name == name ) { var pos = data.position; callback(null, (pos==100?true:false)); } });

}); };

ich habe folgendes JSON beim Aufruf von /deviceajax.do?devices=1 erhalten

"devices": [ { "did": 1010014, "name": "DuoFern Universal-Aktor 2-Kanal", "description": "Esszimmer", "initialized": 1, "position": 0, "productName": "DuoFern Universal-Aktor 2-Kanal", "serial": "43 89 89", "statusesMap": { "Position": 0, "Manuellbetrieb": 0 }, ..... }, { "did": 1010015, "name": "DuoFern Universal-Aktor 2-Kanal", "description": "Küche", "initialized": 1, "position": 100, "productName": "DuoFern Universal-Aktor 2-Kanal", "serial": "43 89 89", "statusesMap": { "Position": 100, "Manuellbetrieb": 0 },....

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bombadiltom/homebridge-rademacher-homepilot/issues/8#issuecomment-445477342, or mute the thread https://github.com/notifications/unsubscribe-auth/AS6kJJMvrWWbz0Mojoph6fgho9drgJfmks5u2_yjgaJpZM4ZJunR.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bombadiltom/homebridge-rademacher-homepilot/issues/8#issuecomment-445498086, or mute the thread https://github.com/notifications/unsubscribe-auth/Afnd-2vUn7iRY6e6mh2aRye9PiPeGaYxks5u3EyagaJpZM4ZJunR.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

ghost commented 5 years ago

Wieder was gelernt. Danke für den Tip

Am 09.12.2018 um 01:32 schrieb Tom Lorenz notifications@github.com:

Hmm, ich kann im Homepilot beides ändern, das JSON ist echt

Best mobile regards,

Tom Lorenz

Am 09.12.2018 um 01:22 schrieb Alexander Flint notifications@github.com:

Hi,

Leider nicht, da man device.name nicht selbst benennen kann. Das macht der Homepilot . Wenn man das Gerät umbenennt wird device.description geändert.

Gruß

Am 09.12.2018 um 00:34 schrieb Tom Lorenz notifications@github.com:

Moin,

macht Sinn, es hätte auch genügt, die unterschiedlich zu benennen:

"did": 10029, "name": "Flursteckdose 2", "description": "Flursteckdose 2", "initialized": 1, "position": 100, "productName": "DuoFern Universal-Aktor 2-Kanal“,

Werde ich morgen mal in allen Accessories korrigieren...

MfG,

Tom Lorenz Im Grünen Winkel 21 59423 Unna Tel: 02303 592524 Fax: 02303 592534 mailto:tom@lorenz-unna.de

Am 08.12.2018 um 18:53 schrieb Alexander Flint notifications@github.com:

anscheinend kann folgendes passieren. Im JSON, das zurückgegeben wird, könnte ein Duplikat der selben Instanz erzeugt werden (darauf hin stürzt die Homebridge ab), daher habe ich in RademacherSwitchAccessory.js diese Änderung gemacht (in der Hoffnung dass devices.did tatsächlich KEIN Duplikat sein kann ;-)

RademacherSwitchAccessory.prototype.getCurrentState = function(callback) { this.log("%s - Getting current state for %s", this.accessory.displayName, this.accessory.UUID);

var self = this; var serial = this.sw.serial; var name = this.sw.name; var did = this.sw.did; request.get({ timeout: 1500, strictSSL: false, url: this.url + "/deviceajax.do?devices=1" }, function(e,r,b) { if(e) return callback(new Error("Request failed: "+e), false); var body = JSON.parse(b);

body.devices.forEach(function(data) { if(data.did==did && data.serial == serial && data.name == name ) { var pos = data.position; callback(null, (pos==100?true:false)); } });

}); };

ich habe folgendes JSON beim Aufruf von /deviceajax.do?devices=1 erhalten

"devices": [ { "did": 1010014, "name": "DuoFern Universal-Aktor 2-Kanal", "description": "Esszimmer", "initialized": 1, "position": 0, "productName": "DuoFern Universal-Aktor 2-Kanal", "serial": "43 89 89", "statusesMap": { "Position": 0, "Manuellbetrieb": 0 }, ..... }, { "did": 1010015, "name": "DuoFern Universal-Aktor 2-Kanal", "description": "Küche", "initialized": 1, "position": 100, "productName": "DuoFern Universal-Aktor 2-Kanal", "serial": "43 89 89", "statusesMap": { "Position": 100, "Manuellbetrieb": 0 },....

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bombadiltom/homebridge-rademacher-homepilot/issues/8#issuecomment-445477342, or mute the thread https://github.com/notifications/unsubscribe-auth/AS6kJJMvrWWbz0Mojoph6fgho9drgJfmks5u2_yjgaJpZM4ZJunR.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bombadiltom/homebridge-rademacher-homepilot/issues/8#issuecomment-445498086, or mute the thread https://github.com/notifications/unsubscribe-auth/Afnd-2vUn7iRY6e6mh2aRye9PiPeGaYxks5u3EyagaJpZM4ZJunR.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bombadiltom/homebridge-rademacher-homepilot/issues/8#issuecomment-445500608, or mute the thread https://github.com/notifications/unsubscribe-auth/Afnd-y1vfrk-as__YZjSC_HPoIcr66LDks5u3Fo3gaJpZM4ZJunR.

bombadiltom commented 5 years ago

Hi nochmal,

an vielen anderen Stellen war das schon auf did alleine umgestellt, habe es in 0.0.7 angepasst. Danke für den Hinweis.

MfG,

Tom Lorenz Im Grünen Winkel 21 59423 Unna Tel: 02303 592524 Fax: 02303 592534 mailto:tom@lorenz-unna.de

Am 09.12.2018 um 01:34 schrieb Alexander Flint notifications@github.com:

Wieder was gelernt. Danke für den Tip

Am 09.12.2018 um 01:32 schrieb Tom Lorenz notifications@github.com:

Hmm, ich kann im Homepilot beides ändern, das JSON ist echt

Best mobile regards,

Tom Lorenz

Am 09.12.2018 um 01:22 schrieb Alexander Flint notifications@github.com:

Hi,

Leider nicht, da man device.name nicht selbst benennen kann. Das macht der Homepilot . Wenn man das Gerät umbenennt wird device.description geändert.

Gruß

Am 09.12.2018 um 00:34 schrieb Tom Lorenz notifications@github.com:

Moin,

macht Sinn, es hätte auch genügt, die unterschiedlich zu benennen:

"did": 10029, "name": "Flursteckdose 2", "description": "Flursteckdose 2", "initialized": 1, "position": 100, "productName": "DuoFern Universal-Aktor 2-Kanal“,

Werde ich morgen mal in allen Accessories korrigieren...

MfG,

Tom Lorenz Im Grünen Winkel 21 59423 Unna Tel: 02303 592524 Fax: 02303 592534 mailto:tom@lorenz-unna.de

Am 08.12.2018 um 18:53 schrieb Alexander Flint notifications@github.com:

anscheinend kann folgendes passieren. Im JSON, das zurückgegeben wird, könnte ein Duplikat der selben Instanz erzeugt werden (darauf hin stürzt die Homebridge ab), daher habe ich in RademacherSwitchAccessory.js diese Änderung gemacht (in der Hoffnung dass devices.did tatsächlich KEIN Duplikat sein kann ;-)

RademacherSwitchAccessory.prototype.getCurrentState = function(callback) { this.log("%s - Getting current state for %s", this.accessory.displayName, this.accessory.UUID);

var self = this; var serial = this.sw.serial; var name = this.sw.name; var did = this.sw.did; request.get({ timeout: 1500, strictSSL: false, url: this.url + "/deviceajax.do?devices=1" }, function(e,r,b) { if(e) return callback(new Error("Request failed: "+e), false); var body = JSON.parse(b);

body.devices.forEach(function(data) { if(data.did==did && data.serial == serial && data.name == name ) { var pos = data.position; callback(null, (pos==100?true:false)); } });

}); };

ich habe folgendes JSON beim Aufruf von /deviceajax.do?devices=1 erhalten

"devices": [ { "did": 1010014, "name": "DuoFern Universal-Aktor 2-Kanal", "description": "Esszimmer", "initialized": 1, "position": 0, "productName": "DuoFern Universal-Aktor 2-Kanal", "serial": "43 89 89", "statusesMap": { "Position": 0, "Manuellbetrieb": 0 }, ..... }, { "did": 1010015, "name": "DuoFern Universal-Aktor 2-Kanal", "description": "Küche", "initialized": 1, "position": 100, "productName": "DuoFern Universal-Aktor 2-Kanal", "serial": "43 89 89", "statusesMap": { "Position": 100, "Manuellbetrieb": 0 },....

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bombadiltom/homebridge-rademacher-homepilot/issues/8#issuecomment-445477342, or mute the thread https://github.com/notifications/unsubscribe-auth/AS6kJJMvrWWbz0Mojoph6fgho9drgJfmks5u2_yjgaJpZM4ZJunR.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bombadiltom/homebridge-rademacher-homepilot/issues/8#issuecomment-445498086, or mute the thread https://github.com/notifications/unsubscribe-auth/Afnd-2vUn7iRY6e6mh2aRye9PiPeGaYxks5u3EyagaJpZM4ZJunR.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bombadiltom/homebridge-rademacher-homepilot/issues/8#issuecomment-445500608, or mute the thread https://github.com/notifications/unsubscribe-auth/Afnd-y1vfrk-as__YZjSC_HPoIcr66LDks5u3Fo3gaJpZM4ZJunR.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bombadiltom/homebridge-rademacher-homepilot/issues/8#issuecomment-445500674, or mute the thread https://github.com/notifications/unsubscribe-auth/AS6kJFp_Sg6drVaSg_Fko1FowB2S7OC2ks5u3FqYgaJpZM4ZJunR.