NEWS
Драйвер Mega-ESP
-
Извини мне бы 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> ```` `Да спасибо?
-
Извини мне бы 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 скинь.
-
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> -
Спасибо за драйвер.
Никак не пойму что я делаю не так…
Мучая RGB
В объектах значение у порта PWM - true.
Когда меняю значение, то оно практически мгновенно возвращается снова в true.
В конфиге драйвера РОЛЬ указывал и value и level и пусто, все равно или true или false вместо значений от 0 до 255.
P9 с ADC выдает всегда как и нужно цифры.
PS: С MQTT работало хорошо.
-
Спасибо за драйвер.
Никак не пойму что я делаю не так…
Мучая RGB
В объектах значение у порта PWM - true.
Когда меняю значение, то оно практически мгновенно возвращается снова в true.
В конфиге драйвера РОЛЬ указывал и value и level и пусто, все равно или true или false вместо значений от 0 до 255.
P9 с ADC выдает всегда как и нужно цифры.
PS: С MQTT работало хорошо. `
Обновись на 0.0.2 но ещё пока не работает RGB сейчас как рас делаю, не выходит :xcd /opt/iobroker npm install https://github.com/ausHaus/ioBroker.megaesp/tarball/master/ iobroker upload megaesp iobroker restart megaesp -
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 -
Обновись на 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.
-
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] -
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]работает нормально
[/color]
``` ` -
Что заметил, если использую Philips HUE и RGB color, то цвета регулируются… А если farbtastic то нет. А значения если смотреть - то true!!!
Объекты цветов прописываю во вкладке R.G.B.
Подправил, пробуй 0.0.3cd /opt/iobroker npm install https://github.com/ausHaus/ioBroker.megaesp/tarball/master/ iobroker upload megaesp iobroker restart megaesp -
Что заметил, если использую Philips HUE и RGB color, то цвета регулируются… А если farbtastic то нет. А значения если смотреть - то true!!!
Объекты цветов прописываю во вкладке R.G.B.
Подправил, пробуй 0.0.3cd /opt/iobroker npm install https://github.com/ausHaus/ioBroker.megaesp/tarball/master/ iobroker upload megaesp iobroker restart megaesp ```` `Спасибо!
Теперь норм.
PS: А у Вас P6 как сконфигурирован? Вопрос снят… понял что WS2811.
А кто встречал в продаже и где WS2811 в DIP корпусе, чтобы отдельно к нему усилители подключить можно было.
-
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]
``` -
@MSapogov:`
Подправил, пробуй 0.0.3cd /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. Зачем усилитель?
-
Если я правильно понимаю это сигнальная линия и на ленте к каждой WS2811 подключены три диода R,G,B, WS2812 там в диоде всё уже засунуто чип,R,G,B. Зачем усилитель? `
Это в том случае если хочется использывать уже имеющиеся световые линии RGB. У меня нет задачи управлять каждым диодом в линии.Просто экономия по GPIO получается.
-
Если я правильно понимаю это сигнальная линия и на ленте к каждой WS2811 подключены три диода R,G,B, WS2812 там в диоде всё уже засунуто чип,R,G,B. Зачем усилитель? `
Это в том случае если хочется использывать уже имеющиеся световые линии RGB. У меня нет задачи управлять каждым диодом в линии.Просто экономия по GPIO получается. `
Я думаю на этот случай есть и поддерживается прошивкой расширитель шим портов PCA9685. Кстати ещё можно заказать голую плату http://www.ab-log.ru/forum/viewtopic.ph … 180#p22605 -
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), пока что неважно
!

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--
!

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); ....... -
MegaD самая сложная система в принципе реализации конфигурации. У неё может быть 100 различных видов настроек. И никакой возможности считать эту конфигурацию, кроме, как парсить HTML страницы. Прошлый век..
Я уже писал http://www.ab-log.ru/forum/viewtopic.ph … =80#p22955
но они хотят оставаться в прошлом веке...
Я понимаю, если действительно места в памяти нет. Но в esp то вроде больше всего.
Почему не пропарсить главную страницу просто regexp?
var m = body.match(/[](\/([^) ```` [Как результат:/sec/?pt=0
/sec/?pt=1
/sec/?pt=2
/sec/?pt=3
/sec/?pt=4
/sec/?pt=5
/sec/?pt=6
/sec/?pt=7
/sec/?pt=8
/sec/?pt=9
/sec/?mc=1
/sec/?pc=1
/sec/?bm=1
/sec/?be=1
/sec/?bh=1 -
MegaD самая сложная система в принципе реализации конфигурации. У неё может быть 100 различных видов настроек. И никакой возможности считать эту конфигурацию, кроме, как парсить HTML страницы. Прошлый век..
Я уже писал http://www.ab-log.ru/forum/viewtopic.ph … =80#p22955
но они хотят оставаться в прошлом веке...
Я понимаю, если действительно места в памяти нет. Но в esp то вроде больше всего.
Почему не пропарсить главную страницу просто regexp?
var m = body.match(/[](\/([^) ```` [Как результат:/sec/?pt=0
/sec/?pt=1
/sec/?pt=2
/sec/?pt=3
/sec/?pt=4
/sec/?pt=5
/sec/?pt=6
/sec/?pt=7
/sec/?pt=8
/sec/?pt=9
/sec/?mc=1
/sec/?pc=1
/sec/?bm=1
/sec/?be=1
/sec/?bh=1](\/([^) ` [По твоему примеру нагородил вот такой скрипт](\/([^)
[request ( 'http://192.168.1.20/sec', function ( error, response, body ) {
if ( !error && response.statusCode == 200 ) {
var m = body.match(/](/([^)[](/([^)>! 22:09:07.207 [info] javascript.3 script.js.1A_testESP: /sec/?pt=0 >! 22:09:07.208 [info] javascript.3 script.js.1A_testESP: /sec/?pt=1 >! 22:09:07.208 [info] javascript.3 script.js.1A_testESP: /sec/?pt=2 >! 22:09:07.208 [info] javascript.3 script.js.1A_testESP: /sec/?pt=3 >! 22:09:07.208 [info] javascript.3 script.js.1A_testESP: /sec/?pt=4 >! 22:09:07.209 [info] javascript.3 script.js.1A_testESP: /sec/?pt=5 >! 22:09:07.209 [info] javascript.3 script.js.1A_testESP: /sec/?pt=6 >! 22:09:07.209 [info] javascript.3 script.js.1A_testESP: /sec/?pt=7 >! 22:09:07.209 [info] javascript.3 script.js.1A_testESP: /sec/?pt=8 >! 22:09:07.210 [info] javascript.3 script.js.1A_testESP: /sec/?pt=9 >! 22:09:07.262 [info] javascript.3 script.js.1A_testESP: /sec/?mc=10 >! 22:09:07.264 [info] javascript.3 script.js.1A_testESP: /sec/?mc=11 >! 22:09:07.265 [info] javascript.3 script.js.1A_testESP: /sec/?mc=12 >! 22:09:07.265 [info] javascript.3 script.js.1A_testESP: /sec/?mc=13 >! 22:09:07.265 [info] javascript.3 script.js.1A_testESP: /sec/?mc=14 >! 22:09:07.265 [info] javascript.3 script.js.1A_testESP: /sec/?mc=15 >! 22:09:07.265 [info] javascript.3 script.js.1A_testESP: /sec/?mc=16 >! 22:09:07.266 [info] javascript.3 script.js.1A_testESP: /sec/?mc=17 >! 22:09:07.266 [info] javascript.3 script.js.1A_testESP: /sec/?mc=18 >! 22:09:07.266 [info] javascript.3 script.js.1A_testESP: /sec/?mc=19 >! 22:09:07.266 [info] javascript.3 script.js.1A_testESP: /sec/?mc=20 >! 22:09:07.266 [info] javascript.3 script.js.1A_testESP: /sec/?mc=21 >! 22:09:07.267 [info] javascript.3 script.js.1A_testESP: /sec/?mc=22 >! 22:09:07.267 [info] javascript.3 script.js.1A_testESP: /sec/?mc=23 >! 22:09:07.267 [info] javascript.3 script.js.1A_testESP: /sec/?mc=24 >! 22:09:07.267 [info] javascript.3 script.js.1A_testESP: /sec/?mc=25 >! 22:09:07.333 [info] javascript.3 script.js.1A_testESP: /sec/?lcd=1&cl=1 >! 22:09:07.335 [info] javascript.3 script.js.1A_testESP: /sec/?lcd=1&bl=1 >! 22:09:07.336 [info] javascript.3 script.js.1A_testESP: /sec/?lcd=1&bl=2 Подскажи как его оптимизировать, и всунуть в драйвер](\/([^)
Hey! Du scheinst an dieser Unterhaltung interessiert zu sein, hast aber noch kein Konto.
Hast du es satt, bei jedem Besuch durch die gleichen Beiträge zu scrollen? Wenn du dich für ein Konto anmeldest, kommst du immer genau dorthin zurück, wo du zuvor warst, und kannst dich über neue Antworten benachrichtigen lassen (entweder per E-Mail oder Push-Benachrichtigung). Du kannst auch Lesezeichen speichern und Beiträge positiv bewerten, um anderen Community-Mitgliedern deine Wertschätzung zu zeigen.
Mit deinem Input könnte dieser Beitrag noch besser werden 💗
Registrieren Anmelden