snowdd1 / homebridge-knx-de

German Issue/Discussion forum for homebridge-knx
https://github.com/snowdd1/homebridge-knx
20 stars 4 forks source link

WindowCoveringTilt _ Raffstore fährt wieder auf #69

Closed borsti112 closed 3 years ago

borsti112 commented 3 years ago

Servus,

nachdem ich seit langem mich mal wieder an die Homebridge Konfiguration gemacht habe, bin ich auf ein Problem gestoßen, bei dem ich nicht weiter komme. Ich habe versucht die Raffstore in die Homebridge zu integrieren. Es läuft auch alles, bis auf die Tatsache dass bei einem runter fahren auf 100% geschlossen die Lamellen anschließend wieder auf fahren. Der Log in der ETS zeigt mir dass wohl das Homekit nach dem TargetPosition 100% automatisch ein TargetHorizontalTiltAngle 100% raus schickt. Nur sind bei mir die 100% Lamellenneigung offen und nicht geschlossen. Verbaut sind bei mir Theben JMG/JME 4S Aktoren.

Kann man das irgendwie umstellen?

Viele Grüße

Thorsten

giase82 commented 3 years ago

Servus,

Das liegt daran, dass die Einstellung für "Tilt" in Homekit weiterhin auf dem urspünglichen Wert bleibt, und der sich dann nach dem runterfahren einstellt. Ich habe das behoben, in für mich selber meinen WindowCoveringTilt angepasst habe. Ich habe das aber nicht committed, da es sein kann dass man das eben genau anders haben will. Das konfigurierbar zu machen, war mir bis jetzt zu viel Arbeit.

Hier der relevante Abschnitt (ganz unten, "// set shutters to closed as well"):

` onHKValueChange(field, oldValue, newValue) { // homekit will only send a TargetPosition value, so we do not care about (non-) potential others

    if (field === "TargetPosition") {
        console.log('INFO: onHKValueChange(' + field + ", "+ oldValue + ", "+ newValue + ")");
        // update the PositionState characteristic:     
        // get the last current Position
        var lastPos = this.myAPI.getValue("CurrentPosition");

        if (newValue > lastPos) {
            // newValue is higher, shutter's moving up
            this.myAPI.setValue("PositionState", 1); //up

        } else if (newValue < lastPos){
            // newValue is higher, shutter's moving down
            this.myAPI.setValue("PositionState", 0); //down

        }

        var knxValue = (255 - newValue*255 / 100);

        console.log('INFO: onHKValueChange after calc ('  + knxValue+ ")");
        this.myAPI.knxWrite("TargetPosition", knxValue, "DPT5"); // send the new position to the KNX bus

        if (newValue === 0){
            this.myAPI.setValue("TargetHorizontalTiltAngle", 90); // set shutters to closed as well
            this.onHKValueChange("TargetHorizontalTiltAngle", 0, 90);
        }`
giase82 commented 3 years ago

Ah, hab das doch committed: https://github.com/snowdd1/homebridge-knx/pull/147/files

//Christof

borsti112 commented 3 years ago

Hey, danke für die schnelle Antwort.

Hatte genau diese Passage auskommentiert, hat aber nichts gebracht. Jetzt habe den Code so geändert und jetzt funktioniert das.

        if (newValue === 0){
            this.myAPI.setValue("TargetHorizontalTiltAngle", -90); // set shutters to closed as well
            this.onHKValueChange("TargetHorizontalTiltAngle", 0, -90);
        }