This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.
Closed

what is correct object to write to /api/manager/ledring with rest

NattelipNattelip Member
edited February 2016 in Archive
with next  javascript

   var sendstring2 = "";
        var frame = [];
        var frames = [];

        for (var pixel = 0; pixel < 24; pixel++) {

            

            frame.push({
                r: 0, // 0 - 255
                g: 255 ,// 0 - 255
                b: 0  // 0 - 255
            });
        }

        for (var i = 0; i < 10; i++) {



            frames.push(frame);
        }

        sendstring2 = JSON.stringify(frames);

i get

 "{"status":500,"result":"invalid animation"}"     

Comments

  • NattelipNattelip Member
    edited February 2016
     this works neither


       var animation = {

                      options: {
                    fps: 1, // real frames per second
                    tfps: 60, // target frames per second. this means that every frame will be interpolated 60 times
                    rpm: 0, // rotations per minute
                },

                      frames: [],
                 priority: 'CRITICAL',
                duration: 3000



            }






            var sendstring2 = "";
            
            var frame = [];
            var frames = [];

            for (var j = 0; j < 24; j++) {

                var pixel = [];

               // var pixel = { r: 0, g: 0, b : 0};          
                   //pixel.r = 0, // 0 - 255
                   //pixel.g = 255 ,// 0 - 255
                   //pixel.b = 0  // 0 - 255
              

                pixel.push(0);
                pixel.push(255);
                pixel.push(0);

                frame.push(pixel)

            }

            for (var i = 0; i < 10; i++) {



                frames.push(frame);
            }

            animation.frames = frames;

            sendstring2 = JSON.stringify(animation);


    result  "{"status":500,"result":"invalid animation"}"     
  • MarcoFMarcoF Member
    edited February 2016
    Did you manage to get it work?
    Maybe @Emile could help?
  • NattelipNattelip Member
    edited February 2016
    no , i wait.      i know it will come   i asked for it again in  the new put post en get app thread. Rome wasn't build in one day.
  • still waiting for a working ledring rest example
This discussion has been closed.