Ankündigung

Einklappen
Keine Ankündigung bisher.

LBS Nanoleafs

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    [Featurewunsch] LBS Nanoleafs

    Hallo zusammen,

    nutzt jemand Nanoleafs und hat evtl schon einen LBs dazu. Oder hat jemand Lust einen LBS dazu zu erstellen?


    Grüße
    Jascha

    #2
    Im Notfall lässt sich das ja über ifttt anbinden.....

    Kommentar


      #3
      Ich warte darauf, das die Lametric Sky eine API bekommen. Die finde ich deutlich wertiger und ansprechender im Design.

      Kommentar


        #4
        So nach langer Diesntreise auch mal wieder online....ja die sehen auch super aus. Hab aber schon die Leafs hier rumliegen und es hätte ja sein können das es schon einen LBS dazu gibt. Extra einen umweg über ifttt wollte ich jetzt nicht gehen.

        Grüße

        Kommentar


          #5
          Ich habe jetzt mal einen LBS für die LifeSmart ColoLights gebaut. Das Preis/Leistungsverhältnis ist ein wenig besser und die Effekte sind schon echt nett:



          Der LBS kommt dann in Kürze ins DL Portal mit der Nummer.
          Ist aber erstmal nur zum Schalten, Helligkeit einstellen, Farbe bzw. Effekt wählen. Den aktuellen Status kann der LBS nicht auslesen.

          Kommentar


            #6
            Hallo Andre,

            magst du evtl. meine Änderungen übernehmen? $effect ist nicht immer initiiert und ich habe E16 hinzugefügt. Damit kann man im Hex-Format (4Byte) Custom Effekte benutzen. Jedes Byte entspricht wohl einem Teile des Setups... Geschwindigkeit, Form usw. . Wie das aber genau tickt konnte ich noch nicht testen....

            PHP-Code:
            <??>// @formatterff
            ###[DEF]###
            [name = LifeSmart Cololight v0.2 ]

            [e#1 = IP/DNS Name of ColoLight ]
            [e#2 = Log Level (0-8) #init=0 ]
            [e#3 = Power ]
            [e#4 = Brightness ]
            [e#5 = Color (RGB) ]
            [e#6 = Effect 80's Party ]
            [e#7 = Effect Cherry Blossom ]
            [e#8 = Effect Rainbow ]
            [e#9 = Effect Clouds ]
            [e#10 = Effect Sunrise ]
            [e#11 = Effect Color Dance ]
            [e#12 = Effect Northern Lights ]
            [e#13 = Effect The Circus ]
            [e#14 = Effect Instagrammer ]
            [e#15 = Effect Christmas ]
            [e#16 = Custom Effect ]


            [v#100 = 0.1 ]
            [v#101 = 19002081 ]
            [v#102 = LifeSmart ColoLight ]
            [v#103 = 0 ]
            [v#104 = 0 ]
            [v#105 = 1 ]

            ###[/DEF]###


            ###[HELP]###
            <iframe id="myIframe" frameBorder='0' scrolling="no" height='220px' width='260px' src="https://edomi.anrath.net/edomi/lbs67.html" name="EDOMI LBS Header">Browser not compatible.</iframe>

            (c) 2016-2020 André Feld, All rights reserved, Free for personal use only.

            This LBS allows to control a LifeSmart ColoLight lamps from EDOMI


            E1: IP or DNS Name of SmartLife ColoLight Device
            E2: Loglevel 0-8
            E3: 0|1 to switch Cololight off/on
            E4: 0-100 to set brightness of Cololight
            E5: RRGGBB in hex format to set color of Cololight
            E6-E15: 1 to start respective effect
            E16: custom effect like \x01\xc1\x0a\x00, no information yet about possibilities

            V100: Version
            V101: LBS Number
            V102: Log file name
            V103: Log level
            V104: One log file per LBS instance
            V105: log ID in each log entry

            Changelog:
            ==========
            v0.1: Initial version
            v0.2: Custom effect added

            ###[/HELP]###
            // @formattern
            ###[LBS]###
            <?

            /**
            * ************************************************** *****
            * ** Author: Andre Feld andre.feld(at)anrath.net
            * ** (c) 2016-2020 André Feld, All rights reserved
            * ** For Personal use only.
            * ** The copyright holder grants free and unlicensed
            * ** use of this Software, but only for non-commercial
            * ** and non-profit use. You can make your own copies,
            * ** but you cannot distribute or modify them
            * ** without written approval of the author.
            * ************************************************** *****
            */
            function LB_LBSID_logging($id, $msg, $var = NULL, $priority = 8)
            {
            $E = getLogicEingangDataAll($id);
            $logLevel = getLogicElementVar($id, 103);
            if (is_int($priority) && $priority <= $logLevel && $priority > 0) {
            $logLevelNames = array(
            'none',
            'emerg',
            'alert',
            'crit',
            'err',
            'warning',
            'notice',
            'info',
            'debug'
            );
            $version = getLogicElementVar($id, 100);
            $lbsNo = getLogicElementVar($id, 101);
            $logName = getLogicElementVar($id, 102) . "-LBS$lbsNo";
            $logName = preg_replace('/ /', '_', $logName);
            if (logic_getVar($id, 104) == 1)
            $logName .= "-$id";
            if (logic_getVar($id, 105) == 1)
            $msg .= " ($id)";
            strpos($_SERVER['SCRIPT_NAME'], $lbsNo) ? $scriptname = 'EXE' . $lbsNo : $scriptname = 'LBS' . $lbsNo;
            writeToCustomLog($logName, str_pad($logLevelNames[$logLevel], 7), $scriptname . " [v$version]:\t" . $msg);
            if (isset($var)) {
            writeToCustomLog($logName, str_pad($logLevelNames[$logLevel], 7), $scriptname . " [v$version]:\t================ ARRAY/OBJECT START ================");
            writeToCustomLog($logName, str_pad($logLevelNames[$logLevel], 7), $scriptname . " [v$version]:\t" . json_encode($var));
            writeToCustomLog($logName, str_pad($logLevelNames[$logLevel], 7), $scriptname . " [v$version]:\t================ ARRAY/OBJECT END ================");
            }
            }
            }

            function LB_LBSID($id)
            {
            if ($E = logic_getInputs($id)) {
            Logic_setVar($id, 103, $E[2]['value']); // set loglevel to #VAR 103
            if ($E[3]['refresh'] || $E[4]['refresh'] || $E[5]['refresh'] || $E[6]['refresh'] || $E[7]['refresh'] || $E[8]['refresh'] || $E[9]['refresh'] || $E[10]['refresh'] || $E[11]['refresh'] || $E[12]['refresh'] || $E[13]['refresh'] || $E[14]['refresh'] || $E[15]['refresh'] || $E[16]['refresh']) {
            LB_LBSID_logging($id, 'Calling ColoLight EXEC Script...');
            logic_setInputsQueued($id, $E);
            logic_callExec(LBSID, $id);
            }
            }
            }

            ?>
            ###[/LBS]###


            ###[EXEC]###
            <?
            /**
            * ************************************************** *****
            * ** Author: Andre Feld andre.feld(at)anrath.net
            * ** (c) 2016-2020 André Feld, All rights reserved
            * ** For Personal use only.
            * ** The copyright holder grants free and unlicensed
            * ** use of this Software, but only for non-commercial
            * ** and non-profit use. You can make your own copies,
            * ** but you cannot distribute or modify them
            * ** without written approval of the author.
            * ************************************************** *****
            */

            require (dirname(__FILE__) . "/../../../../main/include/php/incl_lbsexec.php");
            set_time_limit(0);
            sql_connect();

            function logging($id, $msg, $var = NULL, $priority = 8)
            {
            $E = getLogicEingangDataAll($id);
            $logLevel = getLogicElementVar($id, 103);
            if (is_int($priority) && $priority <= $logLevel && $priority > 0) {
            $logLevelNames = array(
            'none',
            'emerg',
            'alert',
            'crit',
            'err',
            'warning',
            'notice',
            'info',
            'debug'
            );
            $version = getLogicElementVar($id, 100);
            $lbsNo = getLogicElementVar($id, 101);
            $logName = getLogicElementVar($id, 102) . "-LBS$lbsNo";
            $logName = preg_replace('/ /', '_', $logName);
            if (logic_getVar($id, 104) == 1)
            $logName .= "-$id";
            if (logic_getVar($id, 105) == 1)
            $msg .= " ($id)";
            strpos($_SERVER['SCRIPT_NAME'], $lbsNo) ? $scriptname = 'EXE' . $lbsNo : $scriptname = 'LBS' . $lbsNo;
            writeToCustomLog($logName, str_pad($logLevelNames[$logLevel], 7), $scriptname . " [v$version]:\t" . $msg);
            if (isset($var)) {
            writeToCustomLog($logName, str_pad($logLevelNames[$logLevel], 7), $scriptname . " [v$version]:\t================ ARRAY/OBJECT START ================");
            writeToCustomLog($logName, str_pad($logLevelNames[$logLevel], 7), $scriptname . " [v$version]:\t" . json_encode($var));
            writeToCustomLog($logName, str_pad($logLevelNames[$logLevel], 7), $scriptname . " [v$version]:\t================ ARRAY/OBJECT END ================");
            }
            }
            }

            while ($E = logic_getInputsQueued($id)) {
            $ip = $E[1]['value'];
            $port = 8900;
            $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
            if ($E[3]['refresh']) {
            if ($E[3]['value'] == 1)
            $message = "\x53\x5a\x30\x30\x00\x00\x00\x00\x00\x20\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 0\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\ x01\x03\x01\xcf\x35";
            elseif ($E[3]['value'] == 0)
            $message = "\x53\x5a\x30\x30\x00\x00\x00\x00\x00\x20\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 0\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\ x01\x03\x01\xce\x1e";
            }
            if ($E[4]['refresh']) {
            $bri = intval($E[4]['value']);
            if ($bri < 0)
            $bri = 0;
            elseif ($bri > 100)
            $bri = 100;
            $bri = hex2bin(str_pad(dechex($E[4]['value']), 2, '0', STR_PAD_LEFT));
            $message = "\x53\x5a\x30\x30\x00\x00\x00\x00\x00\x20\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 0\x00\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\ x16\x03\x01\xcf" . $bri;
            }
            if ($E[5]['refresh']) {
            $rgb = hex2bin($E[5]['value']);
            $message = "\x53\x5a\x30\x30\x00\x00\x00\x00\x00\x23\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 0\x00\x3f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\ x3f\x06\x02\xff\x00" . $rgb;
            }
            $effect="";
            if ($E[6]['refresh'] || $E[7]['refresh'] || $E[8]['refresh'] || $E[9]['refresh'] || $E[10]['refresh'] || $E[11]['refresh'] || $E[12]['refresh'] || $E[13]['refresh'] || $E[14]['refresh'] || $E[15]['refresh'] || $E[16]['refresh']) {
            if ($E[6]['refresh'] && $E[6]['value'] == 1)
            $effect .= "\x04\x9a\x00\x00";
            elseif ($E[7]['refresh'] && $E[7]['value'] == 1)
            $effect .= "\x04\x94\x08\x00";
            elseif ($E[8]['refresh'] && $E[8]['value'] == 1)
            $effect .= "\x05\xbd\x06\x90";
            elseif ($E[9]['refresh'] && $E[9]['value'] == 1)
            $effect .= "\x04\x97\x04\x00";
            elseif ($E[10]['refresh'] && $E[10]['value'] == 1)
            $effect .= "\x01\xc1\x0a\x00";
            elseif ($E[11]['refresh'] && $E[11]['value'] == 1)
            $effect .= "\x04\x9a\x0e\x00";
            elseif ($E[12]['refresh'] && $E[12]['value'] == 1)
            $effect .= "\x04\xc4\x06\x00";
            elseif ($E[13]['refresh'] && $E[13]['value'] == 1)
            $effect .= "\x04\x81\x01\x30";
            elseif ($E[14]['refresh'] && $E[14]['value'] == 1)
            $effect .= "\x03\xbc\x01\x90";
            elseif ($E[15]['refresh'] && $E[15]['value'] == 1)
            $effect .= "\x06\x8b\x09\x00";
            elseif ($E[16]['refresh'])
            $effect .= hex2bin(str_replace('\x','',$E[16]['value']));
            $message = "\x53\x5a\x30\x30\x00\x00\x00\x00\x00\x23\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 0\x00\xc0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\ xc0\x06\x02\xff" . $effect;
            }
            logging($id, "Sending message to ColoLight ($ip:$port): " . bin2hex($message));
            // sending command 3 times with 0,1 second delay
            for ($i = 1; $i <= 3; $i ++) {
            $result = socket_sendto($socket, $message, strlen($message), 0, $ip, $port);
            if ($result == - 1) {
            logging($id, "Error sending command to ColoLight $ip ($i/3)");
            usleep(900000); // wait 0,9 sec before next retry
            }
            else
            logging($id, "Command sent successfully to Cololight $ip ($i/3)");
            usleep(100000); // wait 0,1 sec before next repetition
            }
            }

            ?>
            ###[/EXEC]###
            Gruß
            Winni

            Kommentar


              #7
              Das mit dem $effect ist schon korrigiert. Es muss einfach der "." entfernt werden, also nicht .= sondern nur =
              Es hat sich heute ohnehin einiges geändert, da jetzt der Power-Status abgefragt werden kann.
              Einen Custom-Effekt habe ich auch schon, um selbst definierte Effekte aufzurufen. Die muss man dann aber auf dem Netzwerk sniffen.
              Power-Status wird vermutlich nur mit lokaler Kommunikation funktionieren. Bei einer Cloud basierten Steuerung hat das bei zu Problemen geführt.
              Das Update kommt vermutlich in den nächsten Tagen.

              Kommentar


                #8
                HIER gehts weiter bzgl. LifeSmart ColoLight.

                Kommentar

                Lädt...
                X