Hallo zusammen,
ich scheitere am auslesen eines "einzelnen" Wertes.
D.h. bei Abfrage im Browser steht NUR der Wert.
Die Abfrage ist erfolgreich, nur das Zuordnen, schreiben ins Reading funktioniert nicht.
Raw:
defmod CO2 HTTPMOD http://user:passwort@ip/co2 300
attr CO2 enableControlSet 1
attr CO2 reading01Encode utf8
attr CO2 reading01Name CO2
attr CO2 reading01Regex [.*]
attr CO2 room Haus->Wohnbereich
attr CO2 verbose 5
setstate CO2 2021-04-21 12:19:29 CO2 1
Log Verbose5:
Zitat
2021.04.21 09:45:04 5: CO2: set called with reread
2021.04.21 09:45:04 4: CO2: GetUpdate called (reread)
2021.04.21 09:45:04 5: CO2: AddToQueue adds type update to URL http://user:passwort@ip/co2, no data, no headers, retry 0, initial queue len: 0
2021.04.21 09:45:04 5: CO2: HandleSendQueue called from AddToSendQueue, qlen = 1
2021.04.21 09:45:04 4: CO2: HandleSendQueue sends update with timeout 2 to http://user:passwort@ip/co2, No Data, No Header
2021.04.21 09:45:04 5: CO2: ReadCallback called from __ANON__
2021.04.21 09:45:04 4: CO2: Read callback: request type was update retry 0,
header: HTTP/1.0 200 OK
Content-Length: 3
Content-Type: text/plain
Connection: close, body length 3
2021.04.21 09:45:04 5: CO2: Read callback: body
617
2021.04.21 09:45:04 4: CO2: BodyDecode is not decoding the response body (charset not found, bodyDecode defaults to none)
2021.04.21 09:45:04 5: CO2: GetCookies is looking for Cookies
2021.04.21 09:45:04 5: CO2: ExtractSid called, context reading, num 0
2021.04.21 09:45:04 4: CO2: checking for redirects, code=200, ignore=0
2021.04.21 09:45:04 4: CO2: no redirects to handle
2021.04.21 09:45:04 5: CO2: Read callback sets LAST_REQUEST to update
2021.04.21 09:45:04 5: CO2: CheckAuth decided no authentication required
2021.04.21 09:45:04 5: CO2: UpdateReadingList created list of reading.* nums to parse during getUpdate as 01
2021.04.21 09:45:04 5: CO2: Read starts parsing response to update with defined readings: 01
2021.04.21 09:45:04 5: CO2: ExtractReading CO2 with regex /(?^:[.*])/...
2021.04.21 09:45:04 5: CO2: ExtractReading for reading01-1 sets CO2 to 1
2021.04.21 09:45:04 5: CO2: ExtractReading value as hex is 31
2021.04.21 09:45:04 4: CO2: Read response matched 1, unmatch 0 Reading(s)
2021.04.21 09:45:04 5: CO2: Read response to update matched CO2
2021.04.21 09:45:04 5: CO2: HandleSendQueue called from ReadCallback, qlen = 0
2021.04.21 09:45:04 5: CO2: HandleSendQueue found no usable entry in queue
Der Wert wird gelesen (grün), aber was bedeutet die Fehlermeldung (rot), wie kann ich das beheben?
Danke und Grüße
Bernd
attr CO2 reading01Regex (.*)
Zitat von: frank am 21 April 2021, 12:36:44
attr CO2 reading01Regex (.*)
Damit bekomme ich folgendes Reading:
setstate CO2 2021-04-21 12:54:29 CO2 HTTP/1.0 200 OK
Das Problem liegt mEn hier:
2021.04.21 12:55:37 5: CO2: Read callback: body
681
2021.04.21 12:55:37 4: CO2: BodyDecode is not decoding the response body (charset not found, bodyDecode defaults to none)
Der "body", also der Wert kommt gar nicht bis zum regex. Irgend was fehlt hier "charset not found, bodyDecode defaults to none".
welche werte können denn existieren?
probiere:
attr CO2 reading01Regex (?s)([^\s]+)$
Zitat von: frank am 21 April 2021, 13:22:36
welche werte können denn existieren?
probiere:
attr CO2 reading01Regex (?s)([^\s]+)$
OK, danke das funktioniert.
Existieren kann ein 3-4stelliger Wert.