Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Русский
    3. ioBroker
    4. ioBroker драйвера
    5. Драйвер Mega-ESP

    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

    Драйвер Mega-ESP

    This topic has been deleted. Only users with topic management privileges can see it.
    • Alex1808
      Alex1808 last edited by

      @Haus:

      Alex па пробуйте без MCP23017 и PCA9685 только сама ESP, какая ESP у вас и прошивка? `

      Тест проводил на ESP8266 ESP-12E (Wemos D1), прошивка последняя (fw: 0.33b2).

      Без MCP23017 попробую сегодня вечером.

      > При добавлении портов в ручную настройки надо выбирать в ручную
      ясно. значит порты должны были добавится при сканировании в авто-режиме?

      > Порт P9 может быть только ADC
      Ну я так и понял, сам порт работает и шлёт данные.

      > P.S. Скинь скриншот с подключённым MCP23017 и какие настройки в порте P10…
      Здесь

      ! ![](</s><URL url=)<link_text text="http://image.prntscr.com/image/da081e63 ... 28f581.png">http://image.prntscr.com/image/da081e63795747c8bb9234aee628f581.png</link_text>" />
      !
      ![](</s><URL url=)<link_text text="http://image.prntscr.com/image/e5ef3864 ... 2d0afd.png">http://image.prntscr.com/image/e5ef3864335947febc2124e05e2d0afd.png</link_text>" />
      ! ![](</s><URL url=)<link_text text="http://image.prntscr.com/image/327bace1 ... 28a3ec.png">http://image.prntscr.com/image/327bace1ce1d4c208e1fb1d5ff28a3ec.png</link_text>" />~~~~ ~~~~~~Upd.

      Проверил без МСР23017, порты прописались автоматом

      ! ![](</s><URL url=)<link_text text="http://image.prntscr.com/image/68dbf234 ... f3a9f0.png">http://image.prntscr.com/image/68dbf23476014b96a667b42727f3a9f0.png</link_text>" />~~~~~~

      1 Reply Last reply Reply Quote 0
      • H
        Haus last edited by

        @Alex1808:

        @Haus:

        > P.S. Скинь скриншот с подключённым MCP23017 и какие настройки в порте P10…
        Здесь

        ! ![](</s><URL url=)<link_text text="http://image.prntscr.com/image/da081e63 ... 28f581.png">http://image.prntscr.com/image/da081e63795747c8bb9234aee628f581.png</link_text>" />
        !
        ![](</s><URL url=)<link_text text="http://image.prntscr.com/image/e5ef3864 ... 2d0afd.png">http://image.prntscr.com/image/e5ef3864335947febc2124e05e2d0afd.png</link_text>" />
        ! ![](</s><URL url=)<link_text text="http://image.prntscr.com/image/327bace1 ... 28a3ec.png">http://image.prntscr.com/image/327bace1ce1d4c208e1fb1d5ff28a3ec.png</link_text>" />~~~~ ~~~~~~Извини мне бы html 🙂

        В принципе МСР23017 не должен мешать.~~~~~~

        1 Reply Last reply Reply Quote 0
        • Alex1808
          Alex1808 last edited by

          @Haus:

          Извини мне бы html 🙂

          В принципе МСР23017 не должен мешать. `

          так?

          <title>MegaESP</title>[Back](/sec/)
          -- Ports --
          [P10 - IN](/sec/?mc=10)
          [P11 - IN](/sec/?mc=11)
          [P12 - IN](/sec/?mc=12)
          [P13 - IN](/sec/?mc=13)
          [P14 - IN](/sec/?mc=14)
          [P15 - IN](/sec/?mc=15)
          [P16 - IN](/sec/?mc=16)
          [P17 - IN](/sec/?mc=17)
          [P18 - OUT](/sec/?mc=18)
          [P19 - OUT](/sec/?mc=19)
          [P20 - OUT](/sec/?mc=20)
          [P21 - OUT](/sec/?mc=21)
          [P22 - OUT](/sec/?mc=22)
          [P23 - OUT](/sec/?mc=23)
          [P24 - OUT](/sec/?mc=24)
          [P25 - OUT](/sec/?mc=25)
          
          
          <title>MegaESP</title>[Back](/sec/?mc=1)
          (pin A0)
          P10/OFF
          
          <form action="/sec/">Type: <select name="in"><option value="0">OUT</option><option value="1" selected="">IN</option></select>
          mod <select name="pm"><option value="0">P</option><option value="1">P&R</option><option value="2" selected="">R</option></select> | <select name="rm"><option value="0" selected="">Default</option><option value="1">Act</option></select>
          Act: 
          </form>
          
          
          1 Reply Last reply Reply Quote 0
          • H
            Haus last edited by

            @Alex1808:

            @Haus:

            Извини мне бы html 🙂

            В принципе МСР23017 не должен мешать. `

            так?

            <title>MegaESP</title>[Back](/sec/)
            -- Ports --
            [P10 - IN](/sec/?mc=10)
            [P11 - IN](/sec/?mc=11)
            [P12 - IN](/sec/?mc=12)
            [P13 - IN](/sec/?mc=13)
            [P14 - IN](/sec/?mc=14)
            [P15 - IN](/sec/?mc=15)
            [P16 - IN](/sec/?mc=16)
            [P17 - IN](/sec/?mc=17)
            [P18 - OUT](/sec/?mc=18)
            [P19 - OUT](/sec/?mc=19)
            [P20 - OUT](/sec/?mc=20)
            [P21 - OUT](/sec/?mc=21)
            [P22 - OUT](/sec/?mc=22)
            [P23 - OUT](/sec/?mc=23)
            [P24 - OUT](/sec/?mc=24)
            [P25 - OUT](/sec/?mc=25)
            
            
            <title>MegaESP</title>[Back](/sec/?mc=1)
            (pin A0)
            P10/OFF
            
            <form action="/sec/">Type: <select name="in"><option value="0">OUT</option><option value="1" selected="">IN</option></select>
            mod <select name="pm"><option value="0">P</option><option value="1">P&R</option><option value="2" selected="">R</option></select> | <select name="rm"><option value="0" selected="">Default</option><option value="1">Act</option></select>
            Act: 
            </form>
            
            ```` `  
            

            Да спасибо?

            1 Reply Last reply Reply Quote 0
            • H
              Haus last edited by

              @Alex1808:

              @Haus:

              Извини мне бы html 🙂

              В принципе МСР23017 не должен мешать. `

              так?

              <title>MegaESP</title>[Back](/sec/)
              -- Ports --
              [P10 - IN](/sec/?mc=10)
              [P11 - IN](/sec/?mc=11)
              [P12 - IN](/sec/?mc=12)
              [P13 - IN](/sec/?mc=13)
              [P14 - IN](/sec/?mc=14)
              [P15 - IN](/sec/?mc=15)
              [P16 - IN](/sec/?mc=16)
              [P17 - IN](/sec/?mc=17)
              [P18 - OUT](/sec/?mc=18)
              [P19 - OUT](/sec/?mc=19)
              [P20 - OUT](/sec/?mc=20)
              [P21 - OUT](/sec/?mc=21)
              [P22 - OUT](/sec/?mc=22)
              [P23 - OUT](/sec/?mc=23)
              [P24 - OUT](/sec/?mc=24)
              [P25 - OUT](/sec/?mc=25)
              
              
              <title>MegaESP</title>[Back](/sec/?mc=1)
              (pin A0)
              P10/OFF
              
              <form action="/sec/">Type: <select name="in"><option value="0">OUT</option><option value="1" selected="">IN</option></select>
              mod <select name="pm"><option value="0">P</option><option value="1">P&R</option><option value="2" selected="">R</option></select> | <select name="rm"><option value="0" selected="">Default</option><option value="1">Act</option></select>
              Act: 
              </form>
              
              ```` `  
              

              OUT html скинь.

              1 Reply Last reply Reply Quote 0
              • Alex1808
                Alex1808 last edited by

                @Haus:

                OUT html скинь. `

                <title>MegaESP</title>[Back](/sec/?mc=1)
                (pin B0)
                P18/OFF
                [ON](/sec/?mc=18&cmd=18:1)
                
                <form action="/sec/">Type: <select name="in"><option value="0" selected="">OUT</option><option value="1">IN</option></select> | <select name="dm"><option value="0" selected="">OFF</option><option value="1">ON</option></select>
                </form>
                
                
                1 Reply Last reply Reply Quote 0
                • M
                  MSapogov last edited by

                  Спасибо за драйвер.

                  Никак не пойму что я делаю не так…

                  Мучая RGB

                  В объектах значение у порта PWM - true.

                  Когда меняю значение, то оно практически мгновенно возвращается снова в true.

                  В конфиге драйвера РОЛЬ указывал и value и level и пусто, все равно или true или false вместо значений от 0 до 255.

                  P9 с ADC выдает всегда как и нужно цифры.

                  PS: С MQTT работало хорошо.

                  1 Reply Last reply Reply Quote 0
                  • H
                    Haus last edited by

                    @MSapogov:

                    Спасибо за драйвер.

                    Никак не пойму что я делаю не так…

                    Мучая RGB

                    В объектах значение у порта PWM - true.

                    Когда меняю значение, то оно практически мгновенно возвращается снова в true.

                    В конфиге драйвера РОЛЬ указывал и value и level и пусто, все равно или true или false вместо значений от 0 до 255.

                    P9 с ADC выдает всегда как и нужно цифры.

                    PS: С MQTT работало хорошо. `
                    Обновись на 0.0.2 но ещё пока не работает RGB сейчас как рас делаю, не выходит :x

                    cd /opt/iobroker
                    npm install https://github.com/ausHaus/ioBroker.megaesp/tarball/master/
                    iobroker upload megaesp
                    iobroker restart megaesp
                    
                    
                    1 Reply Last reply Reply Quote 0
                    • H
                      Haus last edited by

                      Bluefox помоги, ни как команду с 'http://espIP/sec/?pt=3&r=25&g=180&b=164' вывести не могу в main.js sendCommandToRGB, то всё одного цвета то Send command "pt=2&r=undefined&g=undefined&b=128" to 192.168.1.20 :x

                      main.js "function sendCommandToRGB"

                      function sendCommandToRGB(port, value) {
                          //'http://espIP/sec/?pt=3&r=25&g=25&b=25'       //////////////////////////////
                          var data = 'pt=' + port + (value || 0);                   //////////////////////////////
                      
                          var parts = adapter.config.ip.split(':');
                      
                          var options = {
                              host: parts[0],
                              port: parts[1] || 80,
                              path: '/' + adapter.config.password + '/?' + data
                          };
                          adapter.log.debug('Send command "' + data + '" to ' + adapter.config.ip);
                          // Set up the request
                          http.get(options, function (res) {
                              var xmldata = '';
                              res.setEncoding('utf8');
                              res.on('error', function (e) {
                                  adapter.log.warn(e.toString());
                              });
                              res.on('data', function (chunk) {
                                  xmldata += chunk;
                              });
                              res.on('end', function () {
                                  adapter.log.debug('Response "' + xmldata + '"');
                              });
                          }).on('error', function (e) {
                              adapter.log.warn('Got error by post request ' + e.toString());
                          });
                      }
                      
                      

                      main.js "sendCommandToRGB"

                      adapter.on('stateChange', function (id, state) {
                          if (id && state && !state.ack) {
                              if (!ports[id]) {
                                  adapter.log.error('Unknown port ID ' + id);
                                  return;
                              ........
                              ........
                              if (parseFloat(state.val) == state.val) {
                                  // If number => set position
                                  state.val = parseFloat(state.val);
                                  if (state.val < 0) {
                                      adapter.log.warn(': invalid control value ' + state.val + '. Value must be positive');
                                      state.val = 0;
                                  }
                                  ........
                                  ........
                                  if (ports[id].common.type == 'string') {   ////////////////////////////////////////////////////
                      
                                  } else if (id.indexOf('_red') !== -1) {
                                      var red = (ports[id].native.red, state.val);
                                      adapter.log.debug('R: ' + red);
                      
                                  } else if (id.indexOf('_green') !== -1) {
                                      var green = (ports[id].native.green, state.val);
                                      adapter.log.debug('G: ' + green);
                      
                                  } else if (id.indexOf('_blue') !== -1) {
                                      var blue = (ports[id].native.blue, state.val);
                                      adapter.log.debug('B: ' + blue);
                      
                                      adapter.log.debug('RGB: ' + red + green + blue);
                                      state.val = ('&r=' + red + '&g=' + green + '&b=' + blue);
                                      sendCommandToRGB(ports[id].native.port, state.val);      //////////////////////////////////////////
                      
                                  } else {
                                      ports[id].native.offset = parseFloat(ports[id].native.offset || 0) || 0;
                                      ports[id].native.factor = parseFloat(ports[id].native.factor || 1) || 1;
                      
                                      state.val = (state.val - ports[id].native.offset) / ports[id].native.factor;
                                      state.val = Math.round(state.val);
                      
                                      sendCommand(ports[id].native.port, state.val);
                                  }
                              }
                          }
                      });
                      

                      log

                      megaesp.0	2016-08-23 02:27:58.730	debug	megaesp.0 Response "Back
                      P2
                      val. 0-255
                      megaesp.0	2016-08-23 02:27:58.730	debug	megaesp.0 Send command "pt=2&r=undefined&g=undefined&b=128" to 192.168.1.20
                      megaesp.0	2016-08-23 02:27:58.729	debug	megaesp.0 RGB: undefinedundefined128
                      megaesp.0	2016-08-23 02:27:58.729	debug	megaesp.0 B: 128
                      megaesp.0	2016-08-23 02:27:58.729	info	megaesp.0 try to control megaesp.0.p2_P2_blue with 128
                      megaesp.0	2016-08-23 02:27:58.729	debug	megaesp.0 G: 130
                      megaesp.0	2016-08-23 02:27:58.729	info	megaesp.0 try to control megaesp.0.p2_P2_green with 130
                      megaesp.0	2016-08-23 02:27:58.728	debug	inMem message megaesp.0.* megaesp.0.p2_P2_blue
                      megaesp.0	2016-08-23 02:27:58.728	debug	inMem message megaesp.0.* megaesp.0.p2_P2_green
                      megaesp.0	2016-08-23 02:27:58.686	debug	megaesp.0 R: 185
                      megaesp.0	2016-08-23 02:27:58.686	info	megaesp.0 try to control megaesp.0.p2_P2_red with 185
                      megaesp.0	2016-08-23 02:27:58.684	debug	inMem message megaesp.0.* megaesp.0.p2_P2_red
                      
                      1 Reply Last reply Reply Quote 0
                      • M
                        MSapogov last edited by

                        @Haus:

                        Обновись на 0.0.2 но ещё пока не работает RGB сейчас как рас делаю, не выходит :x

                        cd /opt/iobroker
                        npm install https://github.com/ausHaus/ioBroker.megaesp/tarball/master/
                        iobroker upload megaesp
                        iobroker restart megaesp
                        
                        ```` `  
                        

                        Да у меня и так 0.0.2 версия.

                        Я использую три выхода как PWM, а не WS2811… Или можно RGB подключить по другому?

                        Что заметил, если использую Philips HUE и RGB color, то цвета регулируются... А если farbtastic то нет. А значения если смотреть - то true!!!

                        Объекты цветов прописываю во вкладке R.G.B.

                        1 Reply Last reply Reply Quote 0
                        • Bluefox
                          Bluefox last edited by

                          @Haus:

                          Bluefox помоги, ни как команду с 'http://espIP/sec/?pt=3&r=25&g=180&b=164' вывести не могу в main.js sendCommandToRGB, то всё одного цвета то Send command "pt=2&r=undefined&g=undefined&b=128" to 192.168.1.20 :x

                          main.js "function sendCommandToRGB" `
                          Мне было бы проще, если бы код был на гите.

                          ! ```
                          `var rgbs = {};
                          ! ....
                          ! function sendCommandToRGB(rgbId) {
                          rgbs[rgbId].timer = null;
                          var port = ports[rgbId + '_blue'].native.port;

                          //'http://espIP/sec/?pt=3&r=25&g=25&b=25'
                          var data = 'pt=' + port + '&r=' + (rgbs[rgbId].red || 0) + '&g=' + (rgbs[rgbId].green || 0) + '&b=' + (rgbs[rgbId].blue || 0);
                          

                          ! var parts = adapter.config.ip.split(':');
                          ! var options = {
                          host: parts[0],
                          port: parts[1] || 80,
                          path: '/' + adapter.config.password + '/?' + data
                          };
                          adapter.log.debug('Send command "' + data + '" to ' + adapter.config.ip);
                          // Set up the request
                          http.get(options, function (res) {
                          var xmldata = '';
                          res.setEncoding('utf8');
                          res.on('error', function (e) {
                          adapter.log.warn(e.toString());
                          });
                          res.on('data', function (chunk) {
                          xmldata += chunk;
                          });
                          res.on('end', function () {
                          adapter.log.debug('Response "' + xmldata + '"');
                          });
                          }).on('error', function (e) {
                          adapter.log.warn('Got error by post request ' + e.toString());
                          });
                          }
                          ! .....
                          ! adapter.on('stateChange', function (id, state) {
                          ....
                          if (ports[id].common.type === 'string') { ////////////////////////////////////////////////////
                          ! } else if (id.match(/_red|_blue|green^/)) {
                          var pos = id.lastIndexOf('
                          ');
                          var rgbId = id.substring(0, pos);
                          var color = id.substring(pos + 1);

                          	rgbs[rgbId] = rgbs[rgbId] || {};
                          	rgbs[rgbId][color] = state.val;
                          	// stop timer if running
                          	if (rgbs[rgbId].timer) clearTimeout(rgbs[rgbId].timer);
                          	// if no more changes in 100 ms, send command to device
                          	rgbs[rgbId].timer = setTimeout(sendCommandToRGB, 100, rgbId);	
                          } else {
                          	...
                          }`[/color]
                          
                          1 Reply Last reply Reply Quote 0
                          • H
                            Haus last edited by

                            @Bluefox:

                            @Haus:

                            Bluefox помоги, ни как команду с 'http://espIP/sec/?pt=3&r=25&g=180&b=164' вывести не могу в main.js sendCommandToRGB, то всё одного цвета то Send command "pt=2&r=undefined&g=undefined&b=128" to 192.168.1.20 :x

                            main.js "function sendCommandToRGB" `
                            Мне было бы проще, если бы код был на гите.

                            ! ```
                            `var rgbs = {};
                            ! ....
                            ! function sendCommandToRGB(rgbId) {
                            rgbs[rgbId].timer = null;
                            var port = ports[rgbId + '_blue'].native.port;

                            //'http://espIP/sec/?pt=3&r=25&g=25&b=25'
                            var data = 'pt=' + port + '&r=' + (rgbs[rgbId].red || 0) + '&g=' + (rgbs[rgbId].green || 0) + '&b=' + (rgbs[rgbId].blue || 0);

                            ! var parts = adapter.config.ip.split(':');
                            ! var options = {
                            host: parts[0],
                            port: parts[1] || 80,
                            path: '/' + adapter.config.password + '/?' + data
                            };
                            adapter.log.debug('Send command "' + data + '" to ' + adapter.config.ip);
                            // Set up the request
                            http.get(options, function (res) {
                            var xmldata = '';
                            res.setEncoding('utf8');
                            res.on('error', function (e) {
                            adapter.log.warn(e.toString());
                            });
                            res.on('data', function (chunk) {
                            xmldata += chunk;
                            });
                            res.on('end', function () {
                            adapter.log.debug('Response "' + xmldata + '"');
                            });
                            }).on('error', function (e) {
                            adapter.log.warn('Got error by post request ' + e.toString());
                            });
                            }
                            ! .....
                            ! adapter.on('stateChange', function (id, state) {
                            ....
                            if (ports[id].common.type === 'string') { ////////////////////////////////////////////////////
                            ! } else if (id.match(/_red|_blue|green^/)) {
                            var pos = id.lastIndexOf('
                            ');
                            var rgbId = id.substring(0, pos);
                            var color = id.substring(pos + 1);

                              rgbs[rgbId] = rgbs[rgbId] || {};
                              rgbs[rgbId][color] = state.val;
                              // stop timer if running
                              if (rgbs[rgbId].timer) clearTimeout(rgbs[rgbId].timer);
                              // if no more changes in 100 ms, send command to device
                              rgbs[rgbId].timer = setTimeout(sendCommandToRGB, 100, rgbId);	
                            

                            } else {
                            ...
                            }`
                            Спасибо, сейчас буду про бывать 🙂

                            ! Уже две недели там :roll: https://github.com/ausHaus/ioBroker.megaesp
                            ! P.S. Всё вроде неплохо но один цвет отправляет на "cmd"
                            ~~[code]~~megaesp-0 2016-08-23 17:52:39.516 debug Response for 192.168.1.20[all]: 155;255;80;temp:20.00/hum:79.60;temp:19.50;ON;RGB;NC;NC;33 megaesp-0 2016-08-23 17:52:39.420 debug getPortState http://192.168.1.20/sec/?cmd=all megaesp-0 2016-08-23 17:52:35.634 debug Response "Back P6 val. 0-255 megaesp-0 2016-08-23 17:52:35.615 debug Send command "pt=6&r=255&g=209&b=0" to 192.168.1.20 inMem 2016-08-23 17:52:35.591 debug message megaesp.0.* megaesp.0.p6_P6 val=null, ack=true, ts=1471963955585, q=0, from=system.adapter.megaesp.0, lc=1471961464774 megaesp-0 2016-08-23 17:52:35.568 debug Response "Done" megaesp-0 2016-08-23 17:52:35.547 debug Send command "cmd=6:43" to 192.168.1.20 megaesp-0 2016-08-23 17:52:35.546 info try to control megaesp.0.p6_P6_blue with 43 inMem 2016-08-23 17:52:35.541 debug message megaesp.0.* megaesp.0.p6_P6_blue val=43, ack=false, ts=1471963955507, q=0, from=system.adapter.socketio.0, lc=1471963954498 megaesp-0 2016-08-23 17:52:35.514 info try to control megaesp.0.p6_P6_green with 209 inMem 2016-08-23 17:52:35.511 debug message megaesp.0.* megaesp.0.p6_P6_green val=209, ack=false, ts=1471963955497, q=0, from=system.adapter.socketio.0, lc=1471963954490 megaesp-0 2016-08-23 17:52:35.486 info try to control megaesp.0.p6_P6_red with 255 inMem 2016-08-23 17:52:35.479 debug message megaesp.0.* megaesp.0.p6_P6_red val=255, ack=false, ts=1471963955466, q=0, from=system.adapter.socketio.0, lc=1471963952798[/code]
                            ! P.S.2 Добавил "....|blue|^..."
                            ~~[code]~~} else if (id.match(/_red|_green|_blue|_^/)) {[/code] работает нормально
                            443_rgb.png [/color]
                            ``` `

                            1 Reply Last reply Reply Quote 0
                            • H
                              Haus last edited by

                              @MSapogov:

                              @Haus:

                              Что заметил, если использую Philips HUE и RGB color, то цвета регулируются… А если farbtastic то нет. А значения если смотреть - то true!!!

                              Объекты цветов прописываю во вкладке R.G.B.
                              Подправил, пробуй 0.0.3

                              cd /opt/iobroker
                              npm install https://github.com/ausHaus/ioBroker.megaesp/tarball/master/
                              iobroker upload megaesp
                              iobroker restart megaesp
                              
                              1 Reply Last reply Reply Quote 0
                              • M
                                MSapogov last edited by

                                @Haus:

                                @MSapogov:

                                @Haus:

                                Что заметил, если использую Philips HUE и RGB color, то цвета регулируются… А если farbtastic то нет. А значения если смотреть - то true!!!

                                Объекты цветов прописываю во вкладке R.G.B.
                                Подправил, пробуй 0.0.3

                                cd /opt/iobroker
                                npm install https://github.com/ausHaus/ioBroker.megaesp/tarball/master/
                                iobroker upload megaesp
                                iobroker restart megaesp
                                ```` `  
                                

                                Спасибо!

                                Теперь норм.

                                PS: А у Вас P6 как сконфигурирован? Вопрос снят… понял что WS2811.

                                А кто встречал в продаже и где WS2811 в DIP корпусе, чтобы отдельно к нему усилители подключить можно было.

                                1 Reply Last reply Reply Quote 0
                                • Bluefox
                                  Bluefox last edited by

                                  @Haus:

                                  @Bluefox:

                                  @Haus:

                                  Bluefox помоги, ни как команду с 'http://espIP/sec/?pt=3&r=25&g=180&b=164' вывести не могу в main.js sendCommandToRGB, то всё одного цвета то Send command "pt=2&r=undefined&g=undefined&b=128" to 192.168.1.20 :x

                                  main.js "function sendCommandToRGB" `
                                  Мне было бы проще, если бы код был на гите.

                                  ! ```
                                  `var rgbs = {};
                                  ! ....
                                  ! function sendCommandToRGB(rgbId) {
                                  rgbs[rgbId].timer = null;
                                  var port = ports[rgbId + '_blue'].native.port;

                                  //'http://espIP/sec/?pt=3&r=25&g=25&b=25'
                                  var data = 'pt=' + port + '&r=' + (rgbs[rgbId].red || 0) + '&g=' + (rgbs[rgbId].green || 0) + '&b=' + (rgbs[rgbId].blue || 0);
                                  

                                  ! var parts = adapter.config.ip.split(':');
                                  ! var options = {
                                  host: parts[0],
                                  port: parts[1] || 80,
                                  path: '/' + adapter.config.password + '/?' + data
                                  };
                                  adapter.log.debug('Send command "' + data + '" to ' + adapter.config.ip);
                                  // Set up the request
                                  http.get(options, function (res) {
                                  var xmldata = '';
                                  res.setEncoding('utf8');
                                  res.on('error', function (e) {
                                  adapter.log.warn(e.toString());
                                  });
                                  res.on('data', function (chunk) {
                                  xmldata += chunk;
                                  });
                                  res.on('end', function () {
                                  adapter.log.debug('Response "' + xmldata + '"');
                                  });
                                  }).on('error', function (e) {
                                  adapter.log.warn('Got error by post request ' + e.toString());
                                  });
                                  }
                                  ! .....
                                  ! adapter.on('stateChange', function (id, state) {
                                  ....
                                  if (ports[id].common.type === 'string') { ////////////////////////////////////////////////////
                                  ! } else if (id.match(/_red|_blue|green^/)) {
                                  var pos = id.lastIndexOf('
                                  ');
                                  var rgbId = id.substring(0, pos);
                                  var color = id.substring(pos + 1);

                                    rgbs[rgbId] = rgbs[rgbId] || {};
                                    rgbs[rgbId][color] = state.val;
                                    // stop timer if running
                                    if (rgbs[rgbId].timer) clearTimeout(rgbs[rgbId].timer);
                                    // if no more changes in 100 ms, send command to device
                                    rgbs[rgbId].timer = setTimeout(sendCommandToRGB, 100, rgbId);	
                                  } else {
                                    ...
                                  }`
                                  

                                  Спасибо, сейчас буду про бывать 🙂

                                  ! Уже две недели там :roll: https://github.com/ausHaus/ioBroker.megaesp
                                  ! P.S. Всё вроде неплохо но один цвет отправляет на "cmd"
                                  ~~[code]~~megaesp-0 2016-08-23 17:52:39.516 debug Response for 192.168.1.20[all]: 155;255;80;temp:20.00/hum:79.60;temp:19.50;ON;RGB;NC;NC;33 megaesp-0 2016-08-23 17:52:39.420 debug getPortState http://192.168.1.20/sec/?cmd=all megaesp-0 2016-08-23 17:52:35.634 debug Response "Back P6 val. 0-255 megaesp-0 2016-08-23 17:52:35.615 debug Send command "pt=6&r=255&g=209&b=0" to 192.168.1.20 inMem 2016-08-23 17:52:35.591 debug message megaesp.0.* megaesp.0.p6_P6 val=null, ack=true, ts=1471963955585, q=0, from=system.adapter.megaesp.0, lc=1471961464774 megaesp-0 2016-08-23 17:52:35.568 debug Response "Done" megaesp-0 2016-08-23 17:52:35.547 debug Send command "cmd=6:43" to 192.168.1.20 megaesp-0 2016-08-23 17:52:35.546 info try to control megaesp.0.p6_P6_blue with 43 inMem 2016-08-23 17:52:35.541 debug message megaesp.0.* megaesp.0.p6_P6_blue val=43, ack=false, ts=1471963955507, q=0, from=system.adapter.socketio.0, lc=1471963954498 megaesp-0 2016-08-23 17:52:35.514 info try to control megaesp.0.p6_P6_green with 209 inMem 2016-08-23 17:52:35.511 debug message megaesp.0.* megaesp.0.p6_P6_green val=209, ack=false, ts=1471963955497, q=0, from=system.adapter.socketio.0, lc=1471963954490 megaesp-0 2016-08-23 17:52:35.486 info try to control megaesp.0.p6_P6_red with 255 inMem 2016-08-23 17:52:35.479 debug message megaesp.0.* megaesp.0.p6_P6_red val=255, ack=false, ts=1471963955466, q=0, from=system.adapter.socketio.0, lc=1471963952798[/code]
                                  ! P.S.2 Добавил "....|blue|^..."
                                  ~~[code]~~} else if (id.match(/_red|_green|_blue|_^/)) {[/code] работает нормально
                                  filename="RGB.png" index="0">~~
                                  Там ошибка была в regexp. Я тебе pull request отправил.[/color]
                                  ```

                                  1 Reply Last reply Reply Quote 0
                                  • H
                                    Haus last edited by

                                    @Bluefox:

                                    @Haus:

                                    @Bluefox: Там ошибка была в regexp. Я тебе pull request отправил. `
                                    Спасибо, всё работает

                                    1 Reply Last reply Reply Quote 0
                                    • H
                                      Haus last edited by

                                      @MSapogov:

                                      @Haus:

                                      @MSapogov: `
                                      Подправил, пробуй 0.0.3

                                      cd /opt/iobroker
                                      npm install https://github.com/ausHaus/ioBroker.megaesp/tarball/master/
                                      iobroker upload megaesp
                                      iobroker restart megaesp
                                      ```` `  
                                      

                                      Спасибо!

                                      Теперь норм.

                                      PS: А у Вас P6 как сконфигурирован? Вопрос снят… понял что WS2811.

                                      А кто встречал в продаже и где WS2811 в DIP корпусе, чтобы отдельно к нему усилители подключить можно было. `
                                      Вариантов море https://www.google.com/search?q=WS2811+ … dlaMmvM%3A

                                      Если я правильно понимаю это сигнальная линия и на ленте к каждой WS2811 подключены три диода R,G,B, WS2812 там в диоде всё уже засунуто чип,R,G,B. Зачем усилитель?

                                      1 Reply Last reply Reply Quote 0
                                      • M
                                        MSapogov last edited by

                                        @Haus:

                                        Если я правильно понимаю это сигнальная линия и на ленте к каждой WS2811 подключены три диода R,G,B, WS2812 там в диоде всё уже засунуто чип,R,G,B. Зачем усилитель? `
                                        Это в том случае если хочется использывать уже имеющиеся световые линии RGB. У меня нет задачи управлять каждым диодом в линии.

                                        Просто экономия по GPIO получается.

                                        1 Reply Last reply Reply Quote 0
                                        • H
                                          Haus last edited by

                                          @MSapogov:

                                          @Haus:

                                          Если я правильно понимаю это сигнальная линия и на ленте к каждой WS2811 подключены три диода R,G,B, WS2812 там в диоде всё уже засунуто чип,R,G,B. Зачем усилитель? `
                                          Это в том случае если хочется использывать уже имеющиеся световые линии RGB. У меня нет задачи управлять каждым диодом в линии.

                                          Просто экономия по GPIO получается. `
                                          Я думаю на этот случай есть и поддерживается прошивкой расширитель шим портов PCA9685. Кстати ещё можно заказать голую плату http://www.ab-log.ru/forum/viewtopic.ph … 180#p22605

                                          1 Reply Last reply Reply Quote 0
                                          • H
                                            Haus last edited by

                                            Bluefox помогай

                                            192.168.1.20/sec

                                            Это стандарт только ESP у которой 9(настраиваемых "pty" портов) + 1(всегда ADC и только на этом порту P9)

                                            Всё это у нас сделано на 90%

                                            При подключении устройств по I2C шине, на 192.168.1.20/sec появляются дополнительные устройства.

                                            –EXT-IO--

                                            (MCP23017) начиная с P10-...(mc=10;..) порты, все 15(настраиваемых "in" портов) могут быть IN(in=1)/OUT(in=0).

                                            --EXT-PWM--

                                            (PCA9685) начиная с P10-...(pc=10;..) порты, все 15 только PWM.

                                            --Ext-DS--

                                            (BMP085/180) начиная с P10 (bm=10)

                                            (BME280) начиная с P10 (be=10)

                                            (BH1750) начиная с P10 (bh=10)

                                            в конце всегда если подключён LCD (lcd=1), пока что неважно

                                            ! 443_megaesp.png
                                            html

                                            <title>MegaESP</title>MegaESP api by [ab-log.ru](http://ab-log.ru) (fw: 0.33b3)
                                            [Config](/sec/cfg/)
                                            -- Ports --
                                            [P0 - IN](/sec/?pt=0)
                                            [P1 - PWM_OUT](/sec/?pt=1)
                                            [P2 - SL_OUT](/sec/?pt=2)
                                            [P3 - DS](/sec/?pt=3)
                                            [P4 - DS](/sec/?pt=4)
                                            [P5 - SW_OUT](/sec/?pt=5)
                                            [P6 - WS281x](/sec/?pt=6)
                                            [P7 - I2C_SDA](/sec/?pt=7)
                                            [P8 - I2C_SCL](/sec/?pt=8)
                                            [P9 - ADC](/sec/?pt=9)
                                            -- ExtIO --
                                            [EXT - IO](/sec/?mc=1)
                                            [LCD](/sec/?lcd=1)
                                            
                                            

                                            –EXT-IO--

                                            ! 443_megaesp_extio.png
                                            html

                                            <title>MegaESP</title>[Back](/sec/)
                                            -- Ports --
                                            [P10 - IN](/sec/?mc=10)
                                            [P11 - IN](/sec/?mc=11)
                                            [P12 - IN](/sec/?mc=12)
                                            [P13 - OUT](/sec/?mc=13)
                                            [P14 - OUT](/sec/?mc=14)
                                            [P15 - OUT](/sec/?mc=15)
                                            [P16 - OUT](/sec/?mc=16)
                                            [P17 - OUT](/sec/?mc=17)
                                            [P18 - OUT](/sec/?mc=18)
                                            [P19 - OUT](/sec/?mc=19)
                                            [P20 - IN](/sec/?mc=20)
                                            [P21 - OUT](/sec/?mc=21)
                                            [P22 - OUT](/sec/?mc=22)
                                            [P23 - OUT](/sec/?mc=23)
                                            [P24 - OUT](/sec/?mc=24)
                                            [P25 - OUT](/sec/?mc=25)
                                            
                                            

                                            –EXT-IO--

                                            --Ext-DS--

                                            
                                                <title>MegaESP</title>
                                            
                                                MegaESP api by[ab-log.ru](http://ab-log.ru)(fw: 0.33b4)
                                            
                                                [Config](/sec/cfg/)
                                            
                                                -- Ports --
                                            
                                                [P0 - NC](/sec/?pt=0)
                                            
                                                [P1 - PWM_OUT](/sec/?pt=1)
                                            
                                                [P2 - NC](/sec/?pt=2)
                                            
                                                [P3 - WS281x](/sec/?pt=3)
                                            
                                                [P4 - DS](/sec/?pt=4)
                                            
                                                [P5 - DS](/sec/?pt=5)
                                            
                                                [P6 - NC](/sec/?pt=6)
                                            
                                                [P7 - I2C_SDA](/sec/?pt=7)
                                            
                                                [P8 - I2C_SCL](/sec/?pt=8)
                                            
                                                [P9 - ADC](/sec/?pt=9)
                                            
                                                -- ExtIO --
                                            
                                                [EXT - IO](/sec/?mc=1)
                                            
                                                [EXT - PWM](/sec/?pc=1)
                                            
                                                -- ExtDS --
                                            
                                                [BMP085/180](/sec/?bm=1)
                                            
                                                [BME280](/sec/?be=1)
                                            
                                                [BH1750](/sec/?bh=1)
                                            
                                            

                                            Отсюда вопрос

                                            1. Как ограничить опрос path: '/' + pass + '/?pt=' + port c 0 до 9 и продолжить опрос c 10…. path: '/' + pass + '/?mc=' + port , path: '/' + pass + '/?pc=' + port , path: '/' + pass + '/?bm=' + port , path: '/' + pass + '/?be=' + port , path: '/' + pass + '/?bh=' + port ?

                                            function detectPortConfig(ip, pass, length, callback, port, result) {
                                                if (port === undefined) {
                                                    port = 0;
                                                    result = [];
                                                } else {
                                                    port++;
                                                    if (port >= length) {
                                                        return callback(result);
                                                    }
                                                }
                                            
                                                var parts = ip.split(':');
                                                var options = {
                                                    host: parts[0],
                                                    port: parts[1] || 80,
                                                    path: '/' + pass + '/?pt=' + port
                                                };
                                            
                                                adapter.log.info('read config from port: http://' + ip + options.path);
                                                .......
                                            
                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            545
                                            Online

                                            31.9k
                                            Users

                                            80.1k
                                            Topics

                                            1.3m
                                            Posts

                                            7
                                            37
                                            9201
                                            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