Hallo,
ich will meinen ESP8266 mit HTTPMOD auslesen z.B. die Uptime auf der Startseite.
Die Seite wird in den "buf" gelesen und die Regex habe ich mit www.regex101.com getestet.
Leider bekomme ich kein Reading und das Logfile sagt : 2016.05.08 22:45:55 3: ESP8266_01: Read response to update didn't match any Reading
Internals:
BUSY 0
CFGFN
CHANGED
DEF http://192.168.1.171/ 10
Interval 10
LASTSEND 1462740325.54625
MainURL http://192.168.1.171/
NAME ESP8266_01
NR 41436
STATE ???
TRIGGERTIME 1462740335.53995
TRIGGERTIME_FMT 2016-05-08 22:45:35
TYPE HTTPMOD
addr http://192.168.1.171:80
buf HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1573
Connection: close
Access-Control-Allow-Origin: *
<script language="javascript"><!--
function dept_onchange(frmselect) {frmselect.submit();}
//--></script><head><title>ESP8266_01</title><style>* {font-family:sans-serif; font-size:12pt;}h1 {font-size:16pt; color:black;}h6 {font-size:10pt; color:black; text-align:center;}.button-menu {background-color:#ffffff; color:blue; margin: 10px; text-decoration:none}.button-link {padding:5px 15px; background-color:#0077dd; color:#fff; border:solid 1px #fff; text-decoration:none}.button-menu:hover {background:#ddddff;}.button-link:hover {background:#369;}th {padding:10px; background-color:black; color:#ffffff;}td {padding:7px;}table {color:black;}.div_l {float: left;}.div_r {float: right; margin: 2px; padding: 1px 10px; border-radius: 7px; background-color:#080; color:white;}.div_br {clear: both;}</style></head><h1>Welcome to ESP Easy: ESP8266_01</h1><BR><a class="button-menu" href=".">Main</a><a class="button-menu" href="config">Config</a><a class="button-menu" href="hardware">Hardware</a><a class="button-menu" href="devices">Devices</a><a class="button-menu" href="tools">Tools</a><BR><BR><form><table><TH>System Info<TH><TH><TR><TD>Uptime:<TD>85 minutes<TR><TD>IP:<TD>192.168.1.171<TR><TD>GW:<TD>0.0.0.0<TR><TD>Build:<TD>78<TR><TD>Unit:<TD>1<TR><TD>STA MAC:<TD>18:fe:34:d4:82:40<TR><TD>AP MAC:<TD>1a:fe:34:d4:82:40<TR><TD>ESP Chip ID:<TD>13926976<TR><TD>Flash Chip ID:<TD>1458400<TR><TD>Flash Size:<TD>4194304<TR><TD>Free Mem:<TD>25536<TR><TD>Boot cause:<TD>Cold boot<TR><TH>Node List:<TH>IP<TH>Age<TR><TD><TD></table></form><h6>Powered by www.esp8266.nu</h6></body>
code 200
conn
data
displayurl http://192.168.1.171/
header
host 192.168.1.171
httpheader HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1573
Connection: close
Access-Control-Allow-Origin: *
httpversion 1.0
hu_blocking 0
hu_filecount 265
ignoreredirects 0
loglevel 4
path /
protocol http
redirects 0
timeout 2
url http://192.168.1.171/
value 0
QUEUE:
Readings:
Request:
data
header
ignoreredirects 0
retryCount 0
type update
url http://192.168.1.171/
value 0
Sslargs:
Attributes:
readings01Name Uptime
readings01Regex Uptime:<TD>([\d \w]+)
room Interfaces
userattr readings01Name readings01Regex
Was mache ich falsch ?
Gruss
Joe
vielleicht sind in der original antwort noch new-line character enthalten. erweitere deine regex mal zu:
(?s)Uptime:<TD>([\d \w]+)
oder
(?s).*?Uptime:<TD>([\d \w]+)
Zitat von: frank am 08 Mai 2016, 23:27:54
vielleicht sind in der original antwort noch new-line character enthalten. erweitere deine regex mal zu:
(?s)Uptime:<TD>([\d \w]+)
oder
(?s).*?Uptime:<TD>([\d \w]+)
Geht beides nicht !
Nicht mal das bringt eine Uptime :
([\d]+)
Das müsste ja wenigstens eine beliebige Nummer liefern und das reading erzeugen.
Hab ich vielleicht was grundlegendes falsch parametriert ?
Gruss
Joe
Hier das Logfile mit verbose 5.
2016.05.09 21:24:19 5: ESP8266_01: Read starts parsing response to update with defined readings:
2016.05.09 21:24:19 3: ESP8266_01: Read response to update didn't match any Reading
2016.05.09 21:24:19 5: ESP8266_01: HandleSendQueue called, qlen = 0
2016.05.09 21:24:29 4: ESP8266_01: GetUpdate called (update)
2016.05.09 21:24:29 5: ESP8266_01: internal interval timer set to call GetUpdate again in 10 seconds
2016.05.09 21:24:29 5: ESP8266_01: AddToQueue called, initial send queue length : 0
2016.05.09 21:24:29 5: ESP8266_01: AddToQueue adds type update to URL http://192.168.1.171/, no data, no headers, retry 0
2016.05.09 21:24:29 5: ESP8266_01: HandleSendQueue called, qlen = 1
2016.05.09 21:24:29 4: ESP8266_01: HandleSendQueue sends request type update to URL http://192.168.1.171/, No Data, No Header, timeout 2
2016.05.09 21:24:29 4: HttpUtils url=http://192.168.1.171/
2016.05.09 21:24:29 4: http://192.168.1.171/: HTTP response code 200
2016.05.09 21:24:29 4: HttpUtils http://192.168.1.171/: Got data, length: 1575
2016.05.09 21:24:29 5: ESP8266_01: Read callback: request type was update retry 0,
Header: HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1575
Connection: close
Access-Control-Allow-Origin: *,
Body: <script language="javascript"><!--
function dept_onchange(frmselect) {frmselect.submit();}
//--></script><head><title>ESP8266_01</title><style>* {font-family:sans-serif; font-size:12pt;}h1 {font-size:16pt; color:black;}h6 {font-size:10pt; color:black; text-align:center;}.button-menu {background-color:#ffffff; color:blue; margin: 10px; text-decoration:none}.button-link {padding:5px 15px; background-color:#0077dd; color:#fff; border:solid 1px #fff; text-decoration:none}.button-menu:hover {background:#ddddff;}.button-link:hover {background:#369;}th {padding:10px; background-color:black; color:#ffffff;}td {padding:7px;}table {color:black;}.div_l {float: left;}.div_r {float: right; margin: 2px; padding: 1px 10px; border-radius: 7px; background-color:#080; color:white;}.div_br {clear: both;}</style></head><h1>Welcome to ESP Easy: ESP8266_01</h1><BR><a class="button-menu" href=".">Main</a><a class="button-menu" href="config">Config</a><a class="button-menu" href="hardware">Hardware</a><a class="button-menu" href="devices">Devices</a><a class="button-menu" href="tools">Tools</a><BR><BR><form><table><TH>System Info<TH><TH><TR><TD>Uptime:<TD>1352 minutes<TR><TD>IP:<TD>192.168.1.171<TR><TD>GW:<TD>0.0.0.0<TR><TD>Build:<TD>78<TR><TD>Unit:<TD>1<TR><TD>STA MAC:<TD>18:fe:34:d4:82:40<TR><TD>AP MAC:<TD>1a:fe:34:d4:82:40<TR><TD>ESP Chip ID:<TD>13926976<TR><TD>Flash Chip ID:<TD>1458400<TR><TD>Flash Size:<TD>4194304<TR><TD>Free Mem:<TD>25568<TR><TD>Boot cause:<TD>Cold boot<TR><TH>Node List:<TH>IP<TH>Age<TR><TD><TD></table></form><h6>Powered by www.esp8266.nu</h6></body>no error
2016.05.09 21:24:29 5: ESP8266_01: Read starts parsing response to update with defined readings:
2016.05.09 21:24:29 3: ESP8266_01: Read response to update didn't match any Reading
2016.05.09 21:24:29 5: ESP8266_01: HandleSendQueue called, qlen = 0
wobei alles hinter //--></script>
in EINER Zeile im Logfile steht.
Jemand 'ne Idee ? Ich komm hier nicht weiter zumal regex101.com das richtige findet ...
Gruss
Joe
Hallo,
anstatt readings01Name habe ich nun readingsName1 und
anstatt readings01Regex readingsRegex1 verwendet und jetzt gehts !
Im Endeffekt war es aber das "s" zuviel ! readings01Name
reading01Name/readings01Regex geht somit auch.
Gruss
immer dieses "kleingedruckte". :)