Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. ioBroker Allgemein
  4. Tradfri RGB über deconz und Yahka, Farbwahl nicht möglich

NEWS

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    18
    1
    837

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    18
    1
    6.3k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.6k

Tradfri RGB über deconz und Yahka, Farbwahl nicht möglich

Scheduled Pinned Locked Moved ioBroker Allgemein
tradfri
65 Posts 8 Posters 12.9k Views 8 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M marco-mh

    Danke für deine Antwort. die helligkeit habe ich schon hinbekommen.
    die Farbänderungen leider nicht. hab das alles so eingegeben doch er macht es leider nicht.
    Bildschirmfoto 2019-12-04 um 19.54.05.png
    Bildschirmfoto 2019-12-04 um 19.54.28.png
    ast du eine idee?

    AsgothianA Offline
    AsgothianA Offline
    Asgothian
    Developer
    wrote on last edited by
    #38

    @marco-mh
    Was macht er denn, und wie ?

    Was passiert wenn du die Datenpunkte direkt in den Objekten im ioBroker veränderst ?

    A.

    ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
    "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      marco-mh
      wrote on last edited by marco-mh
      #39

      ich hab noch hue Lampen, wenn ich von der den xy wert in die Ikea kopiere verändert sich die Farbe.
      wenn ich bei zb hue den wert verändere und enter drücke passiert nichts. wenn ich aber nach der Eingabe in das Feld xy Clicke und ohne Änderung enter drücke verändert sich auch das licht. bei sat das selbe

      node.js 16.15.1, NPM 8.11, js.Controller 4.0.23

      1 Reply Last reply
      0
      • M Offline
        M Offline
        marco-mh
        wrote on last edited by
        #40

        was er jetzt in Homekit ganz neu macht ist wenn ich die Farbe verändere das er auf Farbtemperatur springt.
        und es erscheinen kurzzeitig Riesen zahlen in den Datenpunkten.
        Bildschirmfoto 2019-12-04 um 20.20.33.png

        node.js 16.15.1, NPM 8.11, js.Controller 4.0.23

        AsgothianA 1 Reply Last reply
        0
        • M marco-mh

          was er jetzt in Homekit ganz neu macht ist wenn ich die Farbe verändere das er auf Farbtemperatur springt.
          und es erscheinen kurzzeitig Riesen zahlen in den Datenpunkten.
          Bildschirmfoto 2019-12-04 um 20.20.33.png

          AsgothianA Offline
          AsgothianA Offline
          Asgothian
          Developer
          wrote on last edited by
          #41

          @marco-mh Welche version deconz hast du laufen ? Wenn die Ikea Lampen auf Anpassung von hue und sat nicht reagieren dann liegt das nicht an deinen Einstellungen, sondern an deconz.

          A.

          ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
          "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            marco-mh
            wrote on last edited by
            #42

            ich hab die 1.1.2 laufen.

            node.js 16.15.1, NPM 8.11, js.Controller 4.0.23

            AsgothianA 1 Reply Last reply
            0
            • M marco-mh

              ich hab die 1.1.2 laufen.

              AsgothianA Offline
              AsgothianA Offline
              Asgothian
              Developer
              wrote on last edited by
              #43

              @marco-mh deconz software, nicht iobroker adapter.

              ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
              "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                marco-mh
                wrote on last edited by
                #44

                läuft auf einem ubuntu 18.04 VM auf meiner QNAP

                Bildschirmfoto 2019-12-04 um 20.51.04.png

                node.js 16.15.1, NPM 8.11, js.Controller 4.0.23

                AsgothianA 1 Reply Last reply
                0
                • M marco-mh

                  läuft auf einem ubuntu 18.04 VM auf meiner QNAP

                  Bildschirmfoto 2019-12-04 um 20.51.04.png

                  AsgothianA Offline
                  AsgothianA Offline
                  Asgothian
                  Developer
                  wrote on last edited by
                  #45

                  @marco-mh Ich fürchte du brauchst eine Funktion die bis auf xy umrechnet. Ich kann mal schauen ob ich die für mich noch habe. Zusätzlich solltest du einen bug request bei deconz (GitHub) stellen, das die Ikea Lampen nicht auf hue und sat reagieren - das sollen sie eigentlich.

                  A.

                  ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
                  "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    marco-mh
                    wrote on last edited by
                    #46

                    das wäre klasse wenn du da mal gucken könntest.
                    die meldung beim support werde ich gleich machen.

                    node.js 16.15.1, NPM 8.11, js.Controller 4.0.23

                    AsgothianA 1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      marco-mh
                      wrote on last edited by
                      #47

                      noch eine kleine anmerkung, in der Phoscon APP funktioniert es aber .

                      node.js 16.15.1, NPM 8.11, js.Controller 4.0.23

                      AsgothianA 1 Reply Last reply
                      0
                      • M marco-mh

                        noch eine kleine anmerkung, in der Phoscon APP funktioniert es aber .

                        AsgothianA Offline
                        AsgothianA Offline
                        Asgothian
                        Developer
                        wrote on last edited by
                        #48

                        @marco-mh dann schau doch mal bitte im log ob der korrekte Befehl geschickt wird, und/oder versuch den Befehl direkt an die REST-api zu schicken.

                        Auch: in der App wird meines Wissens immer xy geschaltet

                        A.

                        ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
                        "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          marco-mh
                          wrote on last edited by marco-mh
                          #49

                          ich hab nach der eingabe bei Hue und sat jedesmal enter gedrückt. erst nach Clicken und enter in XY kam die änderung an der lampe.

                          deconz.0	2019-12-04 21:27:14.464	info	(19314) options: {"url":"http://192.168.178.7:8080/api/6DDBBD345E/lights/8/state","method":"PUT","headers":"Content-Type\" : \"application/json","body":"{\"transitiontime\": 0, \"xy\": [0.3269,0.4426]
                          deconz.0	2019-12-04 21:27:14.453	info	(19314) setLightState: {"transitiontime": 0, "xy": [0.3269,0.4426]} 8 deconz.0.Lights.8.xy
                          deconz.0	2019-12-04 21:27:06.690	info	(19314) options: {"url":"http://192.168.178.7:8080/api/6DDBBD345E/lights/8/state","method":"PUT","headers":"Content-Type\" : \"application/json","body":"{\"transitiontime\": 0, \"sat\": 100}"}
                          deconz.0	2019-12-04 21:27:06.667	info	(19314) setLightState: {"transitiontime": 0, "sat": 100} 8 deconz.0.Lights.8.sat
                          deconz.0	2019-12-04 21:26:30.986	info	(19314) options: {"url":"http://192.168.178.7:8080/api/6DDBBD345E/lights/8/state","method":"PUT","headers":"Content-Type\" : \"application/json","body":"{\"transitiontime\": 0, \"hue\": 18204}"}
                          deconz.0	2019-12-04 21:26:30.980	info	(19314) setLightState: {"transitiontime": 0, "hue": 18204} 8 deconz.0.Lights.8.hue
                          

                          was meinst du mit direkt an Rest api schicken, wie mache ich das?

                          Edit:wobei ich bei hue 100 eingegeben habe

                          node.js 16.15.1, NPM 8.11, js.Controller 4.0.23

                          AsgothianA 1 Reply Last reply
                          0
                          • M marco-mh

                            ich hab nach der eingabe bei Hue und sat jedesmal enter gedrückt. erst nach Clicken und enter in XY kam die änderung an der lampe.

                            deconz.0	2019-12-04 21:27:14.464	info	(19314) options: {"url":"http://192.168.178.7:8080/api/6DDBBD345E/lights/8/state","method":"PUT","headers":"Content-Type\" : \"application/json","body":"{\"transitiontime\": 0, \"xy\": [0.3269,0.4426]
                            deconz.0	2019-12-04 21:27:14.453	info	(19314) setLightState: {"transitiontime": 0, "xy": [0.3269,0.4426]} 8 deconz.0.Lights.8.xy
                            deconz.0	2019-12-04 21:27:06.690	info	(19314) options: {"url":"http://192.168.178.7:8080/api/6DDBBD345E/lights/8/state","method":"PUT","headers":"Content-Type\" : \"application/json","body":"{\"transitiontime\": 0, \"sat\": 100}"}
                            deconz.0	2019-12-04 21:27:06.667	info	(19314) setLightState: {"transitiontime": 0, "sat": 100} 8 deconz.0.Lights.8.sat
                            deconz.0	2019-12-04 21:26:30.986	info	(19314) options: {"url":"http://192.168.178.7:8080/api/6DDBBD345E/lights/8/state","method":"PUT","headers":"Content-Type\" : \"application/json","body":"{\"transitiontime\": 0, \"hue\": 18204}"}
                            deconz.0	2019-12-04 21:26:30.980	info	(19314) setLightState: {"transitiontime": 0, "hue": 18204} 8 deconz.0.Lights.8.hue
                            

                            was meinst du mit direkt an Rest api schicken, wie mache ich das?

                            Edit:wobei ich bei hue 100 eingegeben habe

                            AsgothianA Offline
                            AsgothianA Offline
                            Asgothian
                            Developer
                            wrote on last edited by
                            #50

                            @marco-mh

                            @marco-mh sagte in Tradfri RGB über deconz und Yahka, Farbwahl nicht möglich:

                            was meinst du mit direkt an Rest api schicken, wie mache ich das?

                            wenn du hier schaust kannst du sehen was du tun musst um einen Befehl an die api zu schicken. Den Befehl findest du hier :

                             {"url":"http://192.168.178.7:8080/api/6DDBBD345E/lights/8/state","method":"PUT","headers":"Content-Type\" : \"application/json","body":"{\"transitiontime\": 0, \"hue\": 18204}"}
                            

                            ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
                            "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

                            M 1 Reply Last reply
                            0
                            • AsgothianA Asgothian

                              @marco-mh

                              @marco-mh sagte in Tradfri RGB über deconz und Yahka, Farbwahl nicht möglich:

                              was meinst du mit direkt an Rest api schicken, wie mache ich das?

                              wenn du hier schaust kannst du sehen was du tun musst um einen Befehl an die api zu schicken. Den Befehl findest du hier :

                               {"url":"http://192.168.178.7:8080/api/6DDBBD345E/lights/8/state","method":"PUT","headers":"Content-Type\" : \"application/json","body":"{\"transitiontime\": 0, \"hue\": 18204}"}
                              
                              M Offline
                              M Offline
                              marco-mh
                              wrote on last edited by marco-mh
                              #51

                              @Asgothian
                              das hat er mir im Addon ausgegeben

                              8: {
                              "ctmax": 454,
                              "ctmin": 250,
                              "etag": "1df88ead883bb7843b662ffe4948526c",
                              "hascolor": true,
                              "manufacturername": "IKEA of Sweden",
                              "modelid": "TRADFRI bulb E14 CWS opal 600lm",
                              "name": "Weihnachtsstern",
                              "state": {
                              "alert": "none",
                              "bri": 150,
                              "colormode": "xy",
                              "effect": "none",
                              "hue": 18204,
                              "on": true,
                              "reachable": true,
                              "sat": 254,
                              "xy": [
                                0.3161,
                                0.587
                              ],
                              },
                              "swversion": "1.3.002",
                              "type": "Color light",
                              "uniqueid": "cc:cc:cc:ff:fe:99:56:xx-xx"
                              }
                              

                              das kann ich dir anbieten. das andere hab ich nicht hinbekommen-

                              node.js 16.15.1, NPM 8.11, js.Controller 4.0.23

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                marco-mh
                                wrote on last edited by
                                #52

                                das kommt im terminal

                                iobroker@ubuntu1804vm:/opt/iobroker$ curl -H 'Content-Type: application/json' -X PUT -d '{"hue": 18204}' http://192.168.178.7:8080/api/6DDBBDxxxx/lights/8/config
                                [{"error":{"address":"/lights/8/config","description":"method, PUT, not available for resource, /lights/8/config","type":4}}]iobroker@ubuntu1804vm:/opt/iobroker$ 
                                
                                

                                sorry, ich stehngrad auf dem schlauch. alles nicht so leicht
                                Danke für deine mühe

                                node.js 16.15.1, NPM 8.11, js.Controller 4.0.23

                                AsgothianA 1 Reply Last reply
                                0
                                • M marco-mh

                                  das kommt im terminal

                                  iobroker@ubuntu1804vm:/opt/iobroker$ curl -H 'Content-Type: application/json' -X PUT -d '{"hue": 18204}' http://192.168.178.7:8080/api/6DDBBDxxxx/lights/8/config
                                  [{"error":{"address":"/lights/8/config","description":"method, PUT, not available for resource, /lights/8/config","type":4}}]iobroker@ubuntu1804vm:/opt/iobroker$ 
                                  
                                  

                                  sorry, ich stehngrad auf dem schlauch. alles nicht so leicht
                                  Danke für deine mühe

                                  AsgothianA Offline
                                  AsgothianA Offline
                                  Asgothian
                                  Developer
                                  wrote on last edited by Asgothian
                                  #53

                                  @marco-mh ersetz bitte das 'config' durch 'state' im Befehl
                                  wenn das klappt, bitte hinterher noch einmal, aber das "hue":18204 ersetzen durch

                                  "hue":18204, "sat": 230, "bri":230

                                  und danach noch :

                                  "hue":18204, "sat": 230, "bri":230 , "colormode": hue

                                  A.

                                  ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
                                  "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

                                  1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    marco-mh
                                    wrote on last edited by
                                    #54

                                    das hat geklappt.

                                    [{"success":{"/lights/8/state/hue":18204}}]iobroker@ubuntu1804vm:/opt/iobroker$ 
                                    
                                    

                                    aber selbes problem. erst änderung wenn ich in xy klicke und enter drücke

                                    node.js 16.15.1, NPM 8.11, js.Controller 4.0.23

                                    AsgothianA 1 Reply Last reply
                                    0
                                    • M marco-mh

                                      das hat geklappt.

                                      [{"success":{"/lights/8/state/hue":18204}}]iobroker@ubuntu1804vm:/opt/iobroker$ 
                                      
                                      

                                      aber selbes problem. erst änderung wenn ich in xy klicke und enter drücke

                                      AsgothianA Offline
                                      AsgothianA Offline
                                      Asgothian
                                      Developer
                                      wrote on last edited by
                                      #55

                                      @marco-mh was ist mit den beiden zusätzlichen Befehlen die ich oben gepostet habe ?

                                      A.

                                      ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
                                      "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

                                      1 Reply Last reply
                                      0
                                      • M marco-mh

                                        das wäre klasse wenn du da mal gucken könntest.
                                        die meldung beim support werde ich gleich machen.

                                        AsgothianA Offline
                                        AsgothianA Offline
                                        Asgothian
                                        Developer
                                        wrote on last edited by
                                        #56

                                        @marco-mh sagte in Tradfri RGB über deconz und Yahka, Farbwahl nicht möglich:

                                        das wäre klasse wenn du da mal gucken könntest.
                                        die meldung beim support werde ich gleich machen.

                                        Im Spoiler ist das Script. ich hatte das damals fuer die Hue Lampen gemacht, bei denen es im deconz auch noch einen bug gab.

                                        Wichtig: fuer eine korrekte Umrechnung der Farben musst du eine der Philips Lampenbezeichnungen mit angeben, damit korrekt umgerechnet wird. Da heist es schauen und spielen.

                                        Ansonsten musst du nur in den LightID's jeweils die Objektbezeichnungen vorgeben.. als erstes den Namen für die Scriptgesteuerten Objekte, als zweites den Namen des Objektes im deconz, als drittes halt den typstring.

                                        Die States legt er beim ersten start selber an.

                                        var colorconv = require('color-convert');
                                        var converter = require('@q42philips/hue-color-converter');
                                        var JS = "javascript.0."
                                        var LightIDs = [ ["Light1","deconz.0.Light_1","LCT015"]];
                                        
                                        /*
                                        * Setup
                                        */
                                        
                                        for (i=0; i<LightIDs.length; i++)
                                        {
                                         createState(LightIDs[i][0]+"-y_hue"); 
                                         createState(LightIDs[i][0]+"-y_sat");
                                         createState(LightIDs[i][0]+"-y_ct")
                                         var LinkedObject = { self: JS+LightIDs[i][0], id: LightIDs[i][1], type:[i][2], v: ".bri", xy: '.xy', ct: '.ct' };
                                         createState(LightIDs[i][0]+"-LinkedObject");
                                         setState(LightIDs[i][0]+"-LinkedObject", { val: LinkedObject, ack:false });
                                         on({ id:LightIDs[i][0] + "-y_hue", change: "ne"}, CalcXYfromHueSat);
                                         on({ id:LightIDs[i][0] + "-y_sat", change: "ne"}, CalcXYfromHueSat);
                                         on({ id:LightIDs[i][0] + "-y_ct", change: "ne"}, CalcXYfromct);
                                        }
                                        
                                        var timer = null;
                                        
                                        function CalcXYfromHueSat(obj)
                                        {
                                         console.log('Object ' + JSON.stringify(obj.id) + ' was changed set');
                                         var ChangedIdName = JSON.stringify(obj.id);
                                         
                                         var i = ChangedIdName.lastIndexOf("-");
                                         ObjectName = ChangedIdName.substring(1, i);
                                         var Link = getState(ObjectName + "-LinkedObject").val
                                         console.log('Link = '+JSON.stringify(Link))
                                        
                                         console.log('Getting ' + Link.self + '-y_hue');
                                         var Hue = getState(Link.self + '-y_hue').val; // 0 .. 360
                                         console.log('Getting ' + Link.self + '-y_sat');
                                         var Sat = getState(Link.self + '-y_sat').val; // 0 .. 100
                                         console.log('Getting ' + Link.id + Link.v);
                                         var Val = getState(Link.id + Link.v).val * 255 / 100; // 0 .. 100 
                                        
                                         console.log('Hue ' + JSON.stringify(Hue) + ' Sat ' + JSON.stringify(Sat) + ' Bri '+JSON.stringify(Val));
                                        
                                         var rgb = colorconv.hsv.rgb(Hue, Sat, Val);
                                         console.log('RGB returned ' + JSON.stringify(rgb))
                                         var xy = converter.calculateXY(rgb[0], rgb[1], rgb[2], 'LCT015');
                                         console.log('xy returned ' + JSON.stringify(xy))
                                         if (!timer) {  setState(Link.id + Link.xy, xy[0]+','+xy[1]); }
                                        }
                                        
                                        
                                        function CalcXYfromct(obj)
                                        {
                                         var ct = obj.state.val
                                         var ctk = 6500 - ((ct-153) / (500-153) * 4500);
                                         console.log('Object ' + JSON.stringify(obj.id) + ' was set to raw'+ct+' '+ctk+'K')
                                         
                                         var ChangedIdName = JSON.stringify(obj.id);
                                         var i = ChangedIdName.lastIndexOf("-");
                                         ObjectName = ChangedIdName.substring(1, i);
                                         var Link = getState(ObjectName + "-LinkedObject").val
                                         console.log('Link = '+JSON.stringify(Link))
                                        
                                         var rgb = colorTemperatureToRGB(ctk);
                                         console.log('RGB returned ' + JSON.stringify(rgb))
                                         var hsv = colorconv.rgb.hsv(rgb.r, rgb.g, rgb.b);
                                         console.log('hsv returned ' + JSON.stringify(hsv))
                                         if (!timer) {
                                             timer = setTimeout(function() { timer = null; }, 50); 
                                             setState(Link.self+"-y_hue", hsv[0], false)
                                             setState(Link.self+"-y_sat", hsv[1], false)
                                             setState(Link.id + Link.ct, ct);
                                         }
                                        }
                                        
                                        function colorTemperatureToRGB(kelvin){
                                        
                                           var temp = kelvin / 100;
                                           var red, green, blue;
                                        
                                           if( temp <= 66 ){ 
                                               red = 255; 
                                               green = temp;
                                               green = 99.4708025861 * Math.log(green) - 161.1195681661;
                                               if( temp <= 19){
                                                   blue = 0;
                                               } else {
                                                   blue = temp-10;
                                                   blue = 138.5177312231 * Math.log(blue) - 305.0447927307;
                                               }
                                           } else {
                                               red = temp - 60;
                                               red = 329.698727446 * Math.pow(red, -0.1332047592);
                                               green = temp - 60;
                                               green = 288.1221695283 * Math.pow(green, -0.0755148492 );
                                               blue = 255;
                                           }
                                           return {
                                               r : clamp(red,   0, 255),
                                               g : clamp(green, 0, 255),
                                               b : clamp(blue,  0, 255)
                                           }
                                        }
                                        
                                        function clamp( x, min, max ) {
                                           if(x<min){ return min; }
                                           if(x>max){ return max; }
                                           return x;
                                        }
                                        

                                        ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
                                        "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

                                        M G 2 Replies Last reply
                                        0
                                        • AsgothianA Asgothian

                                          @marco-mh sagte in Tradfri RGB über deconz und Yahka, Farbwahl nicht möglich:

                                          das wäre klasse wenn du da mal gucken könntest.
                                          die meldung beim support werde ich gleich machen.

                                          Im Spoiler ist das Script. ich hatte das damals fuer die Hue Lampen gemacht, bei denen es im deconz auch noch einen bug gab.

                                          Wichtig: fuer eine korrekte Umrechnung der Farben musst du eine der Philips Lampenbezeichnungen mit angeben, damit korrekt umgerechnet wird. Da heist es schauen und spielen.

                                          Ansonsten musst du nur in den LightID's jeweils die Objektbezeichnungen vorgeben.. als erstes den Namen für die Scriptgesteuerten Objekte, als zweites den Namen des Objektes im deconz, als drittes halt den typstring.

                                          Die States legt er beim ersten start selber an.

                                          var colorconv = require('color-convert');
                                          var converter = require('@q42philips/hue-color-converter');
                                          var JS = "javascript.0."
                                          var LightIDs = [ ["Light1","deconz.0.Light_1","LCT015"]];
                                          
                                          /*
                                          * Setup
                                          */
                                          
                                          for (i=0; i<LightIDs.length; i++)
                                          {
                                           createState(LightIDs[i][0]+"-y_hue"); 
                                           createState(LightIDs[i][0]+"-y_sat");
                                           createState(LightIDs[i][0]+"-y_ct")
                                           var LinkedObject = { self: JS+LightIDs[i][0], id: LightIDs[i][1], type:[i][2], v: ".bri", xy: '.xy', ct: '.ct' };
                                           createState(LightIDs[i][0]+"-LinkedObject");
                                           setState(LightIDs[i][0]+"-LinkedObject", { val: LinkedObject, ack:false });
                                           on({ id:LightIDs[i][0] + "-y_hue", change: "ne"}, CalcXYfromHueSat);
                                           on({ id:LightIDs[i][0] + "-y_sat", change: "ne"}, CalcXYfromHueSat);
                                           on({ id:LightIDs[i][0] + "-y_ct", change: "ne"}, CalcXYfromct);
                                          }
                                          
                                          var timer = null;
                                          
                                          function CalcXYfromHueSat(obj)
                                          {
                                           console.log('Object ' + JSON.stringify(obj.id) + ' was changed set');
                                           var ChangedIdName = JSON.stringify(obj.id);
                                           
                                           var i = ChangedIdName.lastIndexOf("-");
                                           ObjectName = ChangedIdName.substring(1, i);
                                           var Link = getState(ObjectName + "-LinkedObject").val
                                           console.log('Link = '+JSON.stringify(Link))
                                          
                                           console.log('Getting ' + Link.self + '-y_hue');
                                           var Hue = getState(Link.self + '-y_hue').val; // 0 .. 360
                                           console.log('Getting ' + Link.self + '-y_sat');
                                           var Sat = getState(Link.self + '-y_sat').val; // 0 .. 100
                                           console.log('Getting ' + Link.id + Link.v);
                                           var Val = getState(Link.id + Link.v).val * 255 / 100; // 0 .. 100 
                                          
                                           console.log('Hue ' + JSON.stringify(Hue) + ' Sat ' + JSON.stringify(Sat) + ' Bri '+JSON.stringify(Val));
                                          
                                           var rgb = colorconv.hsv.rgb(Hue, Sat, Val);
                                           console.log('RGB returned ' + JSON.stringify(rgb))
                                           var xy = converter.calculateXY(rgb[0], rgb[1], rgb[2], 'LCT015');
                                           console.log('xy returned ' + JSON.stringify(xy))
                                           if (!timer) {  setState(Link.id + Link.xy, xy[0]+','+xy[1]); }
                                          }
                                          
                                          
                                          function CalcXYfromct(obj)
                                          {
                                           var ct = obj.state.val
                                           var ctk = 6500 - ((ct-153) / (500-153) * 4500);
                                           console.log('Object ' + JSON.stringify(obj.id) + ' was set to raw'+ct+' '+ctk+'K')
                                           
                                           var ChangedIdName = JSON.stringify(obj.id);
                                           var i = ChangedIdName.lastIndexOf("-");
                                           ObjectName = ChangedIdName.substring(1, i);
                                           var Link = getState(ObjectName + "-LinkedObject").val
                                           console.log('Link = '+JSON.stringify(Link))
                                          
                                           var rgb = colorTemperatureToRGB(ctk);
                                           console.log('RGB returned ' + JSON.stringify(rgb))
                                           var hsv = colorconv.rgb.hsv(rgb.r, rgb.g, rgb.b);
                                           console.log('hsv returned ' + JSON.stringify(hsv))
                                           if (!timer) {
                                               timer = setTimeout(function() { timer = null; }, 50); 
                                               setState(Link.self+"-y_hue", hsv[0], false)
                                               setState(Link.self+"-y_sat", hsv[1], false)
                                               setState(Link.id + Link.ct, ct);
                                           }
                                          }
                                          
                                          function colorTemperatureToRGB(kelvin){
                                          
                                             var temp = kelvin / 100;
                                             var red, green, blue;
                                          
                                             if( temp <= 66 ){ 
                                                 red = 255; 
                                                 green = temp;
                                                 green = 99.4708025861 * Math.log(green) - 161.1195681661;
                                                 if( temp <= 19){
                                                     blue = 0;
                                                 } else {
                                                     blue = temp-10;
                                                     blue = 138.5177312231 * Math.log(blue) - 305.0447927307;
                                                 }
                                             } else {
                                                 red = temp - 60;
                                                 red = 329.698727446 * Math.pow(red, -0.1332047592);
                                                 green = temp - 60;
                                                 green = 288.1221695283 * Math.pow(green, -0.0755148492 );
                                                 blue = 255;
                                             }
                                             return {
                                                 r : clamp(red,   0, 255),
                                                 g : clamp(green, 0, 255),
                                                 b : clamp(blue,  0, 255)
                                             }
                                          }
                                          
                                          function clamp( x, min, max ) {
                                             if(x<min){ return min; }
                                             if(x>max){ return max; }
                                             return x;
                                          }
                                          

                                          M Offline
                                          M Offline
                                          marco-mh
                                          wrote on last edited by
                                          #57

                                          @Asgothian
                                          Hey Asgothian, ich bin noch voll bei dir. Nur is gerade wenig Zeit. Ich komme gerade von der Weihnachtsfeier 🥃🥳🍺😇🍸🎊🍼. Am we ist auch wenig Zeit, Weihnachtszeit eben, du weißt was ich meine. Ich teste spätestens am Montag, ev schaffe ich es auch am Samstag.
                                          Aber ich bedanke mich schon einmal bei dir. Gruß Marco

                                          node.js 16.15.1, NPM 8.11, js.Controller 4.0.23

                                          1 Reply Last reply
                                          0

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate
                                          FAQ Cloud / IOT
                                          HowTo: Node.js-Update
                                          HowTo: Backup/Restore
                                          Downloads
                                          BLOG

                                          445

                                          Online

                                          32.8k

                                          Users

                                          82.7k

                                          Topics

                                          1.3m

                                          Posts
                                          Community
                                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                          ioBroker Community 2014-2025
                                          logo
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Home
                                          • Recent
                                          • Tags
                                          • Unread 0
                                          • Categories
                                          • Unreplied
                                          • Popular
                                          • GitHub
                                          • Docu
                                          • Hilfe