Hallo zusammen,
ich habe ein Problem, ich möchte aus einen Web Aufruf die Inhalte vom Body in ein Reding verwandeln.
:-[ Ich weiß dafür gibt es RegEX , bekomme es aber einfach nicht hin.
Vielleicht kann mir eine einen Tipp geben.
Der Inhalt im Body Beispiel: <0;18;30;30;22;0;0;0;0;0;0;0;1;0;0>
mich interessieren die Werte der 3 letzten Ziffern als separate Readings.
Internals:
BUSY 1
DEF http://192.168.0.**/get/***/all/ 10
FD 31
FUUID 5d7bd589-f33f-a9cb-5302-8443f9b227eb1241
FVERSION 98_HTTPMOD.pm:0.199780/2019-08-10
Interval 10
LASTSEND 1568472523.27588
MainURL http://192.168.0.**/get/***/all/
ModuleVersion 3.5.9 - 13.2.2019
NAME FuchsOutputs
NOTIFYDEV global
NR 555
NTFY_ORDER 50-FuchsOutputs
STATE ???
TRIGGERTIME 1568472533.27388
TRIGGERTIME_FMT 2019-09-14 16:48:53
TYPE HTTPMOD
addr http://192.168.0.**:80
auth 0
buf
code 200
compress 1
data
displayurl http://192.168.0.**/get/***/all/
errno 113
header
host 192.168.0.**
httpbody <0;3;2;0;0;0;0;0;0;0;0;0;1;0;0>
httpversion 1.0
hu_blocking 0
hu_filecount 307
hu_port 80
hu_portSfx
ignoreredirects 0
loglevel 4
path /get/***/all/
protocol http
redirects 0
timeout 30
url http://192.168.0.**/get/***/all/
value 0
QUEUE:
READINGS:
2019-09-14 16:48:34 All 1
2019-09-13 20:42:01 all 1
REQUEST:
data
header
ignoreredirects 0
retryCount 0
type update
url http://192.168.0.**/get/***/all/
value 0
defptr:
readingBase:
All reading
readingNum:
All 01
readingOutdated:
requestReadings:
update:
All reading 01
sslargs:
Attributes:
DbLogExclude .*
enableControlSet 1
reading01Name All
reading01Regex <.*?>
room Fuchs
showBody 1
timeout 30
userattr reading01Name reading01Regex
HTML Quell Code von Firefox gespeichert.
<html wtx-context="87CDD41F-66D1-417F-89A1-AAD2FA61B12D"><link type="text/css" id="dark-mode" rel="stylesheet" href=""><style type="text/css" id="dark-mode-custom-style"></style><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body><0;18;30;30;22;0;0;0;0;0;0;0;1;0;0></body></html>
Du brauchst ein "capturing group" (zwischen runden Klammern) in deiner Regex, damit er weisst, was er "fangen" muss.
Wenn wirklich der Quellcode so aussieht (ich habe ein Zweifel wegen < und >), hättest Du mit
(\d+)>
z.B. die letzte Zahl
Auf https://regex101.com/ deine Regex testen
Hallo amenomade,
danke für den Tipp. Das war die Lösung.
(\d+);(\d+);(\d+)>
Damit bekomme ich die letzten 3 Werte als Reading.
Fhem HTTPMOD wandelt aber < > in < > um.
Daher die Anpassung.
Danke noch mal.