Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. [Vorlage] LightControl

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [Vorlage] LightControl

    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User @Pittini last edited by

      @pittini Danke @pittini. Ja das macht Sinn. Nutze bis jetzt noch nicht die adaptive Helligkeit.

      Schmakus 1 Reply Last reply Reply Quote 0
      • Schmakus
        Schmakus Developer @Guest last edited by

        @kilian-z said in [Vorlage] LightControl:

        @pittini Danke @pittini. Ja das macht Sinn. Nutze bis jetzt noch nicht die adaptive Helligkeit.

        Du vielleicht nicht, aber das Script intern.
        Wie hast du GoogleHome eingebunden? Per iot? Wenn ja, einfach beide Datenpunkte, Power und Bri als ein Gerät anlegen.

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @Schmakus last edited by

          @schmakus Danke für die Antwort. Ich habe alle drei Datenpunkte in einem Gerät über iot eingebunden.

          Schmakus 1 Reply Last reply Reply Quote 0
          • Schmakus
            Schmakus Developer @passuff last edited by Schmakus

            @Pittini Die Fehlermeldung im log von @passuff deutet doch darauf hin, dass der Wert des Switch nicht gelesen werden kann, weil entweder kein Wert vorhanden ist, oder der Pfad zum DP nicht stimmt, oder?

            2022-01-18 23:32:50.312 - error: javascript.0 (32839) script.js.common.Licht.LightControl: TypeError: Cannot read property 'val' of null
            2022-01-18 23:32:50.315 - error: javascript.0 (32839) at SimpleGroupPowerOnOff (script.js.common.Licht.LightControl:707:83)
            2022-01-18 23:32:50.315 - error: javascript.0 (32839) at GroupPowerOnOff (script.js.common.Licht.LightControl:736:9)
            2022-01-18 23:32:50.315 - error: javascript.0 (32839) at AutoOnMotion (script.js.common.Licht.LightControl:965:9)
            2022-01-18 23:32:50.316 - error: javascript.0 (32839) at Controller (script.js.common.Licht.LightControl:1166:17)
            
            1 Reply Last reply Reply Quote 0
            • Schmakus
              Schmakus Developer @Guest last edited by

              @kilian-z said in [Vorlage] LightControl:

              @schmakus Danke für die Antwort. Ich habe alle drei Datenpunkte in einem Gerät über iot eingebunden.

              👍 Ich habe immer Power, Bri, ct und color eingebunden.

              ? 1 Reply Last reply Reply Quote 0
              • ?
                A Former User @Schmakus last edited by

                @schmakus Du musst aber trotzdem zwei Befehle absenden oder? Wenn Lampe aus ist: Helligkeit einstellen und dann Lampe anschalten. Habe ich das richtig verstanden?

                Schmakus 1 Reply Last reply Reply Quote 0
                • D
                  Dragon last edited by

                  In deinem Skript muss ein Datenpunkt mit einer Anzahl an anwesenden Personen angegeben werden. Darf ich fragen wofür er benötigt wird? Ich habe tatsächlich keinen Datenpunkt, da ich auch andere Geräte auf Presence checke...

                  Schmakus 1 Reply Last reply Reply Quote 0
                  • Schmakus
                    Schmakus Developer @Guest last edited by

                    @kilian-z said in [Vorlage] LightControl:

                    @schmakus Du musst aber trotzdem zwei Befehle absenden oder? Wenn Lampe aus ist: Helligkeit einstellen und dann Lampe anschalten. Habe ich das richtig verstanden?

                    Genau. Beim schalten per "power" Datenpunkt wird die Helligkeit, welche zuvor bei "bri" gesetzt ist an die Lampe gesendet.

                    1 Reply Last reply Reply Quote 0
                    • Schmakus
                      Schmakus Developer @Dragon last edited by

                      @dragon said in [Vorlage] LightControl:

                      In deinem Skript muss ein Datenpunkt mit einer Anzahl an anwesenden Personen angegeben werden. Darf ich fragen wofür er benötigt wird? Ich habe tatsächlich keinen Datenpunkt, da ich auch andere Geräte auf Presence checke...

                      Es gibt ja quasi 2 Variablen dafür. Einmal An- und Abwesenheit und dann den von dir beschriebenen.
                      Dieser wird benötigt, wenn du auch "AutoOn bei Anwesenheitszählererhöhung ab bestimmter Helligkeit (Begrüßungslicht bei heimkommen)" verwenden möchtest. einfach leer lassen, wenn du keinen Zähler hast.

                      1 Reply Last reply Reply Quote 0
                      • R
                        Rudi-Ment last edited by

                        Hallo.

                        Auch ich habe das Script zum Laufen gebracht und schon ein paar Lampen eingebunden.

                        Nun habe ich aber mehrere RGBWW LED Streifen in der Stube, die ich gerne gruppieren möchte.

                        Da gibt es aber zwei mal Power und zwei mal Dimmer. Außerdem haben die Colorwerte mit #00000000 bis #FFFFFFFF. Wie binde ich die ein ?

                        Schmakus 1 Reply Last reply Reply Quote 0
                        • Schmakus
                          Schmakus Developer @Rudi-Ment last edited by

                          @rudi-ment Um welche LED Streifen handelt es sich genau? Ich habe z.b. Shelly RGBW2 eingebunden. Das mit dem Hex klappt jedoch nur für die RGB Farben. Den Weißkanal steuere ich über die Farbtemperatur.

                          R 1 Reply Last reply Reply Quote 0
                          • R
                            Rudi-Ment @Schmakus last edited by

                            @schmakus Das ist eine gute Idee. Bei den Shelly kann ich das so machen.
                            Bei den mit Tasmota geflashten LED Treibern gibt es aber zwei mal Power. Einmal bunt und einmal weiß.
                            Da weiß ich nicht weiter.
                            Aber in der nächsten Zeit werden die Tasmota-Teile wohl eh rausfliegen.
                            Die Verbindung ist so unzuverlässig...
                            Vielleicht hat sich das damit schon erledigt.

                            1 Reply Last reply Reply Quote 0
                            • R
                              Rudi-Ment last edited by

                              Das mit dem Weissabgleich bekomme ich nicht hin.
                              Magst du mir vielleicht mal ein Beispiel zeigen ?

                              1 Reply Last reply Reply Quote 0
                              • fischi87
                                fischi87 @Pittini last edited by

                                @pittini hallo, wird es davon mal einen Adapter geben oder wird es lediglich als Skript bleiben?

                                grüße

                                Schmakus 1 Reply Last reply Reply Quote 0
                                • R
                                  Rudi-Ment last edited by

                                  Hat noch jemand das Problem, dass das Licht zu unbestimmter Zeit wieder ausgeht ?
                                  Trotz Bewegung und "bei Bewegung eingeschaltet bleiben" ?

                                  R 1 Reply Last reply Reply Quote 0
                                  • R
                                    Rudi-Ment @Rudi-Ment last edited by

                                    @rudi-ment said in [Vorlage] LightControl:

                                    Hat noch jemand das Problem, dass das Licht zu unbestimmter Zeit wieder ausgeht ?
                                    Trotz Bewegung und "bei Bewegung eingeschaltet bleiben" ?

                                    Ausserdem scheint die Zeit auch gar nicht zu passen.
                                    Die steht auf 30 min.
                                    Trotzdem schaltet die Lampe gefühlt - wann sie will aus.

                                    1 Reply Last reply Reply Quote 0
                                    • Schmakus
                                      Schmakus Developer @fischi87 last edited by

                                      @fischi87 said in [Vorlage] LightControl:

                                      @pittini hallo, wird es davon mal einen Adapter geben oder wird es lediglich als Skript bleiben?

                                      grüße

                                      Adapter ist aktuell in der Entwicklung.

                                      1 Reply Last reply Reply Quote 0
                                      • P
                                        passuff last edited by passuff

                                        Ich habe nach meinem ersten erfolglosen Anlauf nun einen Zweiten gestartet. Leider bekomme ich das Skript nicht zum laufen. Die Bewegungsmelder Stati werden erkannt, jedoch wird das Licht unabhängig davon scheinbar wahllos ein und ausgeschaltet.

                                        Ich würde mich freuen, wenn sich mal jemand meine Konfiguration ansehen könnte.

                                        const praefix = "0_userdata.0.LightControl2_2" // Skriptordner
                                        const LuxSensor = ""; // Datenpunkt des globalen Luxsensors, wird verwendet wenn in der Gruppe kein gesonderter definiert wird
                                        const IsPresenceDp = ""; // Datenpunkt für Anwesenheit (true/false)
                                        const PresenceCountDp = ""; // Datenpunkt für Anwesenheitszähler
                                        const logging = true; // Logging an/aus
                                        const RampSteps = 10; //Wieviele Schritte zum dimmen? Bitte nicht zu hoch setzen, wird zwar smoother, kann aber zu timing Problemen führen wenn gleichzeitig eine kurze Zeit in den Objekten gewählt.
                                        
                                        const minCt = 2700; //Regelbereich für Farbtemperatur in Kelvin für Adaptive Ct
                                        const maxCt = 6500;//Regelbereich für Farbtemperatur in Kelvin für Adaptive Ct
                                        const minBri = 10; //Mindesthelligkeit für AdaptiveBri
                                        
                                        const LightGroups = {
                                            0: {
                                                description: "FlurEG+OG1",
                                                lights: {
                                                    0: {
                                                        description: "StrahlerEG+OG1",
                                                        power: { oid: "shelly.0.SHDM-2#E0980695AD36#1.lights.Switch", onVal: true, offVal: false },
                                                        bri: { oid: "shelly.0.SHDM-2#E0980695AD36#1.lights.brightness", minVal: 0, maxVal: 100, defaultVal: 100 },
                                                        ct: { oid: "", minVal: null, maxVal: null },
                                                        sat: { oid: "", minVal: null, maxVal: null },
                                                        modeswitch: { oid: "", whiteModeVal: false, colorModeVal: true },
                                                        color: { oid: "", type: "", default: "" }
                                                    },
                                                },
                                                sensors: {
                                                    0: { id: 'mihome.0.devices.sensor_motion_aq2_158d0002ea1b58.state', motionVal: true, noMotionVal: false },
                                                    1: { id: 'mihome.0.devices.sensor_motion_aq2_158d0004aca6b9.state', motionVal: true, noMotionVal: false }
                                                }
                                            }, 
                                             1: {
                                                description: "FlurOG2+OG3",
                                                lights: {
                                                    0: {
                                                        description: "StrahlerOG2+OG3",
                                                        power: { oid: "shelly.0.SHDM-2#C45BBE5645E3#1.lights.Switch", onVal: true, offVal: false },
                                                        bri: { oid: "shelly.0.SHDM-2#C45BBE5645E3#1.lights.brightness", minVal: 0, maxVal: 100, defaultVal: 100 },
                                                        ct: { oid: "", minVal: null, maxVal: null },
                                                        sat: { oid: "", minVal: null, maxVal: null },
                                                        modeswitch: { oid: "", whiteModeVal: false, colorModeVal: true },
                                                        color: { oid: "", type: "", default: "" }
                                                    },
                                                },
                                                sensors: {
                                                    0: { id: 'mihome.0.devices.sensor_motion_aq2_158d0002ebffca.state', motionVal: true, noMotionVal: false }
                                                }
                                            }, 
                                            2: {
                                                description: "Esszimmer",
                                                lights: {
                                                    0: {
                                                        description: "SpotsDecke",
                                                        power: { oid: "shelly.0.SHSW-1#98CDAC2E4B10#1.Relay0.Switch", onVal: true, offVal: false },
                                                        bri: { oid: "", minVal: 0, maxVal: 100, defaultVal: 100 },
                                                        ct: { oid: "", minVal: null, maxVal: null },
                                                        sat: { oid: "", minVal: null, maxVal: null },
                                                        modeswitch: { oid: "", whiteModeVal: false, colorModeVal: true },
                                                        color: { oid: "", type: "", default: "" }
                                                    },
                                                },
                                                sensors: {
                                                    0: { id: 'hm-rpc.1.000C1D898D631A.1.PRESENCE_DETECTION_STATE', motionVal: true, noMotionVal: false },
                                                    1: { id: 'mihome.0.devices.sensor_motion_aq2_158d0002ec30dd.state', motionVal: true, noMotionVal: false }
                                                }
                                            }, 
                                        };
                                        

                                        Habe mich eben durch die entsprechenden Räume bewegt ohne dass die Lampen geschaltet wurden und dabei folgendes log erzeugt:

                                        2022-04-29 11:02:21.231 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Triggered linked Sensor mihome.0.devices.sensor_motion_aq2_158d0002ea1b58.state new value is true
                                        2022-04-29 11:02:21.232 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Reaching SummarizeSensors, Group=0
                                        2022-04-29 11:02:21.233 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Gruppe=0 Sensor 0 with target mihome.0.devices.sensor_motion_aq2_158d0002ea1b58.state has value true
                                        2022-04-29 11:02:21.233 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Summarized IsMotion for Group 0 = true
                                        2022-04-29 11:02:21.239 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Reaching Controller, Group=0 Property1=isMotion NewVal=true OldVal=false
                                        2022-04-29 11:02:27.224 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Triggered linked Sensor mihome.0.devices.sensor_motion_aq2_158d0004aca6b9.state new value is true
                                        2022-04-29 11:02:27.224 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Reaching SummarizeSensors, Group=0
                                        2022-04-29 11:02:27.224 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Gruppe=0 Sensor 0 with target mihome.0.devices.sensor_motion_aq2_158d0002ea1b58.state has value true
                                        2022-04-29 11:02:27.225 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Gruppe=0 Sensor 1 with target mihome.0.devices.sensor_motion_aq2_158d0004aca6b9.state has value true
                                        2022-04-29 11:02:27.225 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Summarized IsMotion for Group 0 = true
                                        2022-04-29 11:02:31.767 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Triggered linked Sensor mihome.0.devices.sensor_motion_aq2_158d0002ebffca.state new value is true
                                        2022-04-29 11:02:31.768 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Reaching SummarizeSensors, Group=1
                                        2022-04-29 11:02:31.768 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Gruppe=1 Sensor 0 with target mihome.0.devices.sensor_motion_aq2_158d0002ebffca.state has value true
                                        2022-04-29 11:02:31.768 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Summarized IsMotion for Group 1 = true
                                        2022-04-29 11:02:31.769 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Reaching Controller, Group=1 Property1=isMotion NewVal=true OldVal=false
                                        2022-04-29 11:02:59.980 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Triggered linked Sensor mihome.0.devices.sensor_motion_aq2_158d0002ec30dd.state new value is true
                                        2022-04-29 11:02:59.981 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Reaching SummarizeSensors, Group=2
                                        2022-04-29 11:02:59.981 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Gruppe=2 Sensor 0 with target hm-rpc.1.000C1D898D631A.1.PRESENCE_DETECTION_STATE has value true
                                        2022-04-29 11:02:59.981 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Gruppe=2 Sensor 1 with target mihome.0.devices.sensor_motion_aq2_158d0002ec30dd.state has value true
                                        2022-04-29 11:02:59.982 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: Summarized IsMotion for Group 2 = true
                                        2022-04-29 11:03:05.866 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: adaptiveCtLinear=5264 adaptiveCtSolar=5648 adaptiveCtSolarInterpolated=4998 adaptiveCtTimed=0
                                        2022-04-29 11:04:05.866 - info: javascript.0 (412) script.js.common.Licht.Esszimmer_Lightcontrol: adaptiveCtLinear=5273 adaptiveCtSolar=5664 adaptiveCtSolarInterpolated=5010 adaptiveCtTimed=0
                                        
                                        P 1 Reply Last reply Reply Quote 0
                                        • P
                                          Pittini Developer @passuff last edited by

                                          @passuff Das Log is ja soweit ok, es hat erkannt was Du gemacht hast. Aber es hat nix geschaltet. Zeig doch mal nen Screenshot wo ich Deine settings für Gruppe 0 oder 1 seh, vorallem die settings für Bewegungsreaktionen.

                                          P 1 Reply Last reply Reply Quote 0
                                          • P
                                            passuff @Pittini last edited by passuff

                                            @pittini
                                            Ich habe den Fehler gefunden. Wenn man keinen Lux Sensor definiert(weder global noch innerhalb eines Raumes), funktioniert das Skript nicht.
                                            Könnte man eventuell für die Zukunft ändern. Ich habe jetzt einen globalen Fake Datenpunkt angelegt und es funktioniert.

                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            659
                                            Online

                                            31.9k
                                            Users

                                            80.2k
                                            Topics

                                            1.3m
                                            Posts

                                            javascript template
                                            25
                                            224
                                            27700
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo