FHEM Forum

FHEM => Sonstiges => Thema gestartet von: ChrisA4 am 17 Februar 2025, 21:54:55

Titel: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 17 Februar 2025, 21:54:55
Würde gerne die Daten der folgenden Seite mit HTTPMOD auslesen

schaffe es aber überhaupt nicht mit REGEX

Könnte jemand helfen?

Screenshot.png

Danke im Vorraus
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: passibe am 18 Februar 2025, 00:14:05
Wie kommen die Werte denn auf diese Seite? Vielleicht ist es einfacher dort "anzuzapfen".

Ansonsten können wir ohne den Quelltext der Seite nicht helfen. Zeig uns doch mal, was für regexes du mit den relevanten Stellen am Quelltext schon ausprobiert hast.

Ansonsten sind für das häufig mühsame Erstellen von Regexes Tools wie regex101.com sehr sehr sehr hilfreich, teilweise auch ChatGPT.
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 18 Februar 2025, 23:16:43
Die Seite kommt von einem Bootloader der Technischen Alternative mit dem ich in verbindung mit einer uvr1611 bin

Kann über den BL-Net sogar den regler steuern

Druck(.*)bar
bekomme ich

 1,69
Mehr schaffe ich nicht


Habe eine zweite 1611er die mit einer cmi der ta verbunden ist da kann ich die Daten mit dem Modul CanOverEthernet abfangen
Aber für den Bootloader hab ich nichts gefunden als das Modul HttpNod aber dabei steh ich auf der leitung

Vieleicht gibt es ja ein anderes Modul dafür
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: passibe am 19 Februar 2025, 03:35:52
Ok. Kenne mich mit der Hardware überhaupt nicht aus.

Aber wenn du die Website öffnest, schau dir mal den Quellcode der Seite an. Dann musst du nur die relevanten Stellen finden und dir die entsprechenden Regexes basteln (bzw. z.B. von ChatGPT basteln lassen).

Wenn du da nicht mehr weiter kommst, poste wie gesagt mal die jeweiligen relevanten Stellen des Quelltexts und dann können wir weiter schauen.
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: MadMax-FHEM am 19 Februar 2025, 09:44:40
Zitat von: passibe am 19 Februar 2025, 03:35:52Aber wenn du die Website öffnest, schau dir mal den Quellcode der Seite an. Dann musst du nur die relevanten Stellen finden und dir die entsprechenden Regexes basteln (bzw. z.B. von ChatGPT basteln lassen).
Oder einfach mal ein HTTPMOD-Device anlegen, einfach die url der Seite angeben und irgendein (hohes) Intervall <- es geht erst mal nur drum zu sehen was kommt...

Dann beim HTTPMOD das Attribut showBody setzen. Dann warten bis ein Abruf kommt oder "reread" auslösen und hier posten, was dann eben in den INTERNALS steht <- kann lang sein ;)

Oder wie von passibe geschrieben selbst versuchen die passenden RegEx zu finden, für den Zugriff auf das was du wissen/haben willst.

Vorteil (gegenüber Abruf mit Browser und dann "show Source" oder so): du siehst gleich, ob HTTPMOD die Seite auch einfach so aufrufen kann...
Ein Browser macht oft viele Dinge automatisch: Cookies, Redirects, Java-Script usw.

Gruß, Joachim
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: tobi01001 am 19 Februar 2025, 11:26:18
Es gibt neben HTTPMOD auch CanOE (was du schon im Einsatz hast) und TA_CMI_JSON - was ich nutze um über die API des CMI Werte abzufragen.

Aber dein UVR1611 hängt nicht am CMI? Wie kommst du denn an die genannte und gezeigte Webseite?
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 20 Februar 2025, 17:23:41
Zitat von: tobi01001 am 19 Februar 2025, 11:26:18Es gibt neben HTTPMOD auch CanOE (was du schon im Einsatz hast) und TA_CMI_JSON - was ich nutze um über die API des CMI Werte abzufragen.

Aber dein UVR1611 hängt nicht am CMI? Wie kommst du denn an die genannte und gezeigte Webseite?

Bekomme ich über einen BOOTLoader BL-Net von der Technischen Alternative das ist der vorgänger der cmi
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 20 Februar 2025, 17:24:55
Hier mal der Quellcode ????

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html><head><meta http-equiv="content-type" content="text/html;charset=utf-8" /><meta http-equiv="expires" content="0"><style type="text/css">body {font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; background-repeat: no-repeat;} #g {position: relative;}#pa {top: 0px; left: 0px; position: absolute;}#p {top: 0px; left: 0px; position: absolute;} </style><script type="text/javascript">function sd (){document.title = this.data.Title; document.getElementById("g").style.width = this.data.Width; document.getElementById("g").style.height = this.data.Height; document.getElementById("pa").style.width = this.data.Width;document.getElementById("pa").style.height = this.data.Height;document.getElementById("p").src = this.data.GraphicFile; var rT = this.data.AutoRefreshTime; if(rT>29)window.setInterval("javascript:this.data.location.reload()", rT*1000); var rlt = this.data.RefreshLink;if(rlt!="") {var rL = document.createElement('a');rL.href="javascript:this.data.location.reload()"; rL.appendChild(document.createTextNode(rlt)); document.getElementById("rld").appendChild(rL);}} </script></head><body onload="sd ()"> <div align="center"><div id="g"> <img src="" border="0" id="p"> <iframe id="pa" src="GRAFIK1.htm" name="data" frameborder="0" scrolling="no" allowtransparency="yes"></iframe></div></div><div align="center" id="rld"></div></body></html>

Ich sehe hier aber keine Werte raus

Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 20 Februar 2025, 17:30:47
Zitat von: MadMax-FHEM am 19 Februar 2025, 09:44:40
Zitat von: passibe am 19 Februar 2025, 03:35:52Aber wenn du die Website öffnest, schau dir mal den Quellcode der Seite an. Dann musst du nur die relevanten Stellen finden und dir die entsprechenden Regexes basteln (bzw. z.B. von ChatGPT basteln lassen).
Oder einfach mal ein HTTPMOD-Device anlegen, einfach die url der Seite angeben und irgendein (hohes) Intervall <- es geht erst mal nur drum zu sehen was kommt...

Dann beim HTTPMOD das Attribut showBody setzen. Dann warten bis ein Abruf kommt oder "reread" auslösen und hier posten, was dann eben in den INTERNALS steht <- kann lang sein ;)

Oder wie von passibe geschrieben selbst versuchen die passenden RegEx zu finden, für den Zugriff auf das was du wissen/haben willst.

Vorteil (gegenüber Abruf mit Browser und dann "show Source" oder so): du siehst gleich, ob HTTPMOD die Seite auch einfach so aufrufen kann...
Ein Browser macht oft viele Dinge automatisch: Cookies, Redirects, Java-Script usw.

Gruß, Joachim

Hab ich gemacht und dabei kommt das gleiche wir der Quellcode oder?

httpbody
   
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html><head><meta http-equiv="content-type" content="text/html;charset=utf-8" /><meta http-equiv="expires" content="0"><style type="text/css">body {font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; background-repeat: no-repeat;} #g {position: relative;}#pa {top: 0px; left: 0px; position: absolute;}#p {top: 0px; left: 0px; position: absolute;} </style><script type="text/javascript">function sd (){document.title = this.data.Title; document.getElementById("g").style.width = this.data.Width; document.getElementById("g").style.height = this.data.Height; document.getElementById("pa").style.width = this.data.Width;document.getElementById("pa").style.height = this.data.Height;document.getElementById("p").src = this.data.GraphicFile; var rT = this.data.AutoRefreshTime; if(rT>29)window.setInterval("javascript:this.data.location.reload()", rT*1000); var rlt = this.data.RefreshLink;if(rlt!="") {var rL = document.createElement('a');rL.href="javascript:this.data.location.reload()"; rL.appendChild(document.createTextNode(rlt)); document.getElementById("rld").appendChild(rL);}} </script></head><body onload="sd ()"> <div align="center"><div id="g"> <img src="" border="0" id="p"> <iframe id="pa" src="GRAFIK1.htm" name="data" frameborder="0" scrolling="no" allowtransparency="yes"></iframe></div></div><div align="center" id="rld"></div></body></html>
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: MadMax-FHEM am 20 Februar 2025, 17:35:21
Ist auf dem Handy schwer zu lesen aber es sieht so aus als würde auf die Seite ein fertiges Bild geladen?

Bzw. falls doch Daten kommen, dann per Javascript...

Daher wird es mit httpmod erst mal nix/schwierig...

Gruß, Joachim
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 20 Februar 2025, 18:56:04
Hab etwas gefunden

vieleicht hilft das um etwas zu basteln

Wenn ich im Browser

http://192.xxx.xxx.xxx:xx/c_index.htm?C=8D200101
eingebe bekomme ich
36,8 °C
Das wäre der TempVorlauf in meiner UVR1611
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 20 Februar 2025, 19:21:42
Hab ein Modul für iobroker gefunden

https://github.com/weberk/ioBroker.ta-blnet
das laut beschreibung alles auslesen kann

Gibt es sowas auch für fhem??

Oder könnte mann das in fhem einbauen??

Danke schon mal
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 20 Februar 2025, 22:06:00
Das hab ich auch noch

screen.jpg
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: passibe am 20 Februar 2025, 22:14:53
Hier mal formatiert.
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta http-equiv="expires" content="0">
<style type="text/css">
[...]
</style>
<script
type="text/javascript">function sd() { document.title = this.data.Title; document.getElementById("g").style.width = this.data.Width; document.getElementById("g").style.height = this.data.Height; document.getElementById("pa").style.width = this.data.Width; document.getElementById("pa").style.height = this.data.Height; document.getElementById("p").src = this.data.GraphicFile; var rT = this.data.AutoRefreshTime; if (rT > 29) window.setInterval("javascript:this.data.location.reload()", rT * 1000); var rlt = this.data.RefreshLink; if (rlt != "") { var rL = document.createElement('a'); rL.href = "javascript:this.data.location.reload()"; rL.appendChild(document.createTextNode(rlt)); document.getElementById("rld").appendChild(rL); } } </script>
</head>

<body onload="sd ()">
<div align="center">
<div id="g"> <img src="" border="0" id="p"> <iframe id="pa" src="GRAFIK1.htm" name="data" frameborder="0"
scrolling="no" allowtransparency="yes"></iframe></div>
</div>
<div align="center" id="rld"></div>
</body>

</html>
Scheint so als würde da ein iframe geladen werden von GRAFIK1.htm? Was ist denn der Quellcode von http://192.xxx.xxx.xxx:xx/GRAFIK1.htm ? Vermutlich ist http://192.xxx.xxx.xxx:xx/GRAFIK1.htm das bessere Ziel einer HTTPMOD-Abfrage, sofern da tatsächlich nicht nur ein Bild geladen wird ...
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 21 Februar 2025, 05:57:28
Das sollte doch der Qeulltext sein oder?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style type="text/css">
  body {font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; background-repeat: no-repeat; background-color: transparent; background: transparent; margin: 0px; padding: 0px;}
  #frame {text-align: left; vertical-align: top; position: relative; margin-left: 0;}

/*########## CSS-ID: Positionen und Darstellung der Anzeigeparameter ##########*/
#pos0{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:210px; left:504px; }
#pos1{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:192px; left:268px; }
#pos2{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:117px; left:274px; }
#pos3{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:224px; left:685px; }
#pos4{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:32px; left:57px; }
#pos5{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:52px; left:57px; }
#pos6{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:511px; left:367px; }
#pos7{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:412px; left:367px; }
#pos8{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:459px; left:366px; }
#pos9{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:436px; left:509px; }
#pos10{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:27px; left:219px; }
#pos11{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:45px; left:219px; }
#pos12{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:266px; left:423px; }
#pos13{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:256px; left:579px; }
#pos14{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:277px; left:219px; }
#pos15{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:226px; left:17px; }
#pos16{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:246px; left:17px; }
#pos17{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:260px; left:205px; }
#pos18{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:495px; left:354px; }
#pos19{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:395px; left:356px; }
#pos20{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:442px; left:354px; }
#pos21{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:209px; left:685px; }
#pos22{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:194px; left:504px; }
#pos23{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:249px; left:404px; }
#pos24{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:239px; left:555px; }
#pos25{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:175px; left:264px; }
#pos26{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:102px; left:252px; }
#pos27{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:382px; left:194px; }
#pos28{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:227px; left:503px; }
#pos29{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:242px; left:685px; }
#pos30{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:135px; left:274px; }
#pos31{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:210px; left:268px; }
#pos32{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:318px; left:218px; }
#pos33{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:302px; left:219px; }
#pos34{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:305px; left:666px; }
#pos35{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:306px; left:512px; }
</style>
<script type="text/javascript">
<!--
 var Title ="Onlineschema";  // Titeltext im Browserfenster
 var GraphicFile = "GRAFIK.gif";  // Pfad der Grafikdatei
 var Width = "770px";
 var Height = "550px";
 
//### Intervallzeit [in Sekunden] fr eine automatische Aktualisierung der Messwerte: ###
//### < "30" = keine automatische Aktualisierung ###
//--------------------------------------------------
 var AutoRefreshTime = "0";

//### Linktext für manuelle Aktualisierung der Messwerte: ###
//### "" = kein Link für manuelle Aktualisierung ###
//--------------------------------------------------
 var RefreshLink ="";
 
 function set_dimenson_para (){
 document.getElementById("frame").style.width = Width;
 document.getElementById("frame").style.hight = Height;
 }
 -->
</script>
 
 </head>
 <body onload="set_dimenson_para ()">
 <div id="frame">
 <!--########## Definitionen der Anzeigeparameter ##########-->
<div id="pos0">&nbsp;33,1 &deg;C </div>
<div id="pos1">&nbsp;21,0 &deg;C </div>
<div id="pos2">&nbsp;22,1 &deg;C </div>
<div id="pos3">&nbsp;33,0 &deg;C </div>
<div id="pos4">TKollektor</div>
<div id="pos5">-&nbsp;5,1 &deg;C </div>
<div id="pos6">&nbsp;37,2 &deg;C </div>
<div id="pos7">&nbsp;60,4 &deg;C </div>
<div id="pos8">&nbsp;37,7 &deg;C </div>
<div id="pos9">AnlagenVL   &nbsp;62,4 &deg;C </div>
<div id="pos10">Temp.Aussen</div>
<div id="pos11">-&nbsp;5,7 &deg;C </div>
<div id="pos12">EIN</div>
<div id="pos13">EIN</div>
<div id="pos14">EIN</div>
<div id="pos15">Pumpe-Solar</div>
<div id="pos16">AUS</div>
<div id="pos17">Frost&nbsp;Wasser</div>
<div id="pos18">TPuffer.u</div>
<div id="pos19">TPuffer.o</div>
<div id="pos20">TPuffer.m</div>
<div id="pos21">T&nbsp;VL&nbsp;Wohnr</div>
<div id="pos22">T&nbsp;VL&nbsp;Keller</div>
<div id="pos23">P&nbsp;Keller</div>
<div id="pos24">P&nbsp;Wohnraum</div>
<div id="pos25">T&nbsp;Keller</div>
<div id="pos26">T&nbsp;Wohnraum</div>
<div id="pos27">HZ Druck  &nbsp;1,37 bar</div>
<div id="pos28">&nbsp;33,4 &deg;C </div>
<div id="pos29">&nbsp;33,4 &deg;C </div>
<div id="pos30">&nbsp;19,0 &deg;C </div>
<div id="pos31">&nbsp;19,0 &deg;C </div>
<div id="pos32">AUS</div>
<div id="pos33">UeberTemp</div>
<div id="pos34">aus</div>
<div id="pos35">aus</div>
</div>
</body>
</html>
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: tobi01001 am 21 Februar 2025, 10:08:30
Zitat von: ChrisA4 am 21 Februar 2025, 05:57:28Das sollte doch der Qeulltext sein oder?
Wenn du das sagst... :-)

Also doch eine ganz normale URL die du aufrufst und das zurück bekommst....

Weiter kommst du z.B. mit XPath (https://wiki.fhem.de/wiki/HTTPMOD#Parsing_http_/_XML_using_xpath)
attr dein_httpmod reading01Name meineTemperatur1
attr dein_httpmod reading01XPath //div[2]/text()

dann schaust was im Reading steht.

attr dein_httpmod showBody 1
attr dein_httpmod showError 1
attr dein_httpmod showMatched 1
hilft beim ausgestalten...
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 22 Februar 2025, 21:34:32
Danke das is es

Noch frage dazu

bei

attr Solardaten reading11Name TKeller_VL_Ist
attr Solardaten reading11XPath //div[1]/text()

bekomme ich einen zweiten wert dazu

  READINGS:
     2025-02-22 21:33:14   Kolektor        - 2,6 °C
     2025-02-22 21:33:14   Solarpumpe      AUS
     2025-02-22 21:33:14   TAussen         - 1,8 °C
     2025-02-22 21:33:14   TKeller_Ist      21,2 °C
     2025-02-22 21:33:14   TKeller_Soll     22,0 °C
     2025-02-22 21:33:14   TKeller_VL_Ist-1  37,9 °C
     2025-02-22 21:33:14   TKeller_VL_Ist-2 
     2025-02-22 21:33:14   TKeller_VL_Sol   38,1 °C
     2025-02-22 21:33:14   TPuffer_Mitte    58,4 °C
     2025-02-22 21:33:14   TPuffer_Oben     74,9 °C
     2025-02-22 21:33:14   TPuffer_Unten    38,7 °C
     2025-02-22 21:33:14   TWohnraum_Ist    22,4 °C
     2025-02-22 21:33:14   TWohnraum_Soll   23,0 °C
     2025-02-22 21:33:14   TWohnraum_VL_Ist  39,5 °C
     2025-02-22 21:33:14   TWohnraum_VL_Soll  39,6 °C

und der hat auch keinen wert?
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: tobi01001 am 24 Februar 2025, 10:50:28
Zitat von: ChrisA4 am 22 Februar 2025, 21:34:32bekomme ich einen zweiten wert dazu
Das kann glaube passieren wenn innerhalb des gesuchten (bzw. gefundenen) tags (Pfad) nicht nur der Wert, sondern wiederum mehrere Tags sind.
Falls das bei dir so ist, müsstest du für dieses Reading das innere Tag mit der Temperatur nehmen.
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 25 Februar 2025, 05:48:48
Wie finde ich da den richtigen wert ?

<div id="pos0">&nbsp;32,7 &deg;C </div>
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: tobi01001 am 25 Februar 2025, 17:36:57
Ich verstehe die Frage nicht. Da steht doch nur ein Wert, sofern du die Temperatur möchtest.
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 25 Februar 2025, 20:41:41
Also ich geb für diese Zeile

<div id="pos0">&nbsp;32,7 &deg;C </div>
das ein

reading11Name

TKeller_VL_Ist

deleteattr
reading11XPath

//div[1]/text()

und dabei bekomme ich eben die zwei werte

     2025-02-22 21:33:14   TKeller_VL_Ist-1  32,7 °C
     2025-02-22 21:33:14   TKeller_VL_Ist-2 

Ich wüsste nicht was da falsch wäre

Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: tobi01001 am 26 Februar 2025, 15:11:22
Zitat von: ChrisA4 am 25 Februar 2025, 20:41:41Ich wüsste nicht was da falsch wäre
Ich auch nicht, weil der Kontext fehlt.

Ein List vom Device mit
attr dein_httpmod showBody 1 kann helfen. ;-)

Dann sieht man die XPath Attribute und zusätzlich den zugehörigen Quelltext.
Zur Not holt man sich den einen Wert per RegEx...
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 26 Februar 2025, 15:34:16
Zitat von: tobi01001 am 26 Februar 2025, 15:11:22
Zitat von: ChrisA4 am 25 Februar 2025, 20:41:41Ich wüsste nicht was da falsch wäre
Ich auch nicht, weil der Kontext fehlt.

Ein List vom Device mit
attr dein_httpmod showBody 1 kann helfen. ;-)

Dann sieht man die XPath Attribute und zusätzlich den zugehörigen Quelltext.
Zur Not holt man sich den einen Wert per RegEx...




<!--2.0-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style type="text/css">
  body {font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; background-repeat: no-repeat; background-color: transparent; background: transparent; margin: 0px; padding: 0px;}
  #frame {text-align: left; vertical-align: top; position: relative; margin-left: 0;}

/*########## CSS-ID: Positionen und Darstellung der Anzeigeparameter ##########*/
#pos0{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:210px; left:504px; }
#pos1{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:192px; left:268px; }
#pos2{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:117px; left:274px; }
#pos3{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:224px; left:685px; }
#pos4{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:32px; left:57px; }
#pos5{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:52px; left:57px; }
#pos6{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:511px; left:367px; }
#pos7{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:412px; left:367px; }
#pos8{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:459px; left:366px; }
#pos9{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:436px; left:509px; }
#pos10{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:27px; left:219px; }
#pos11{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:45px; left:219px; }
#pos12{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:266px; left:423px; }
#pos13{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:256px; left:579px; }
#pos14{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:277px; left:219px; }
#pos15{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:226px; left:17px; }
#pos16{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:246px; left:17px; }
#pos17{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:260px; left:205px; }
#pos18{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:495px; left:354px; }
#pos19{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:395px; left:356px; }
#pos20{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:442px; left:354px; }
#pos21{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:209px; left:685px; }
#pos22{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:194px; left:504px; }
#pos23{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:249px; left:404px; }
#pos24{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:239px; left:555px; }
#pos25{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:175px; left:264px; }
#pos26{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:102px; left:252px; }
#pos27{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:382px; left:194px; }
#pos28{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:227px; left:503px; }
#pos29{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:242px; left:685px; }
#pos30{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:135px; left:274px; }
#pos31{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:210px; left:268px; }
#pos32{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:318px; left:218px; }
#pos33{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:302px; left:219px; }
#pos34{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:305px; left:666px; }
#pos35{position:absolute; font-family: Calibri; font-size: 12pt; color: rgb(0,0,0); font-style: normal; font-weight: bold; text-align: left; top:306px; left:512px; }
</style>
<script type="text/javascript">
<!--
 var Title ="Onlineschema";  // Titeltext im Browserfenster
 var GraphicFile = "GRAFIK.gif";  // Pfad der Grafikdatei
 var Width = "770px";
 var Height = "550px";
 
//### Intervallzeit [in Sekunden] fr eine automatische Aktualisierung der Messwerte: ###
//### < "30" = keine automatische Aktualisierung ###
//--------------------------------------------------
 var AutoRefreshTime = "0";

//### Linktext für manuelle Aktualisierung der Messwerte: ###
//### "" = kein Link für manuelle Aktualisierung ###
//--------------------------------------------------
 var RefreshLink ="";
 
 function set_dimenson_para (){
 document.getElementById("frame").style.width = Width;
 document.getElementById("frame").style.hight = Height;
 }
 -->
</script>
 
 </head>
 <body onload="set_dimenson_para ()">
 <div id="frame">
 <!--########## Definitionen der Anzeigeparameter ##########-->
<div id="pos0">&nbsp;32,6 &deg;C </div>
<div id="pos1">&nbsp;21,7 &deg;C </div>
<div id="pos2">&nbsp;22,6 &deg;C </div>
<div id="pos3">&nbsp;33,2 &deg;C </div>
<div id="pos4">TKollektor</div>
<div id="pos5">&nbsp;29,3 &deg;C </div>
<div id="pos6">&nbsp;40,5 &deg;C </div>
<div id="pos7">&nbsp;76,5 &deg;C </div>
<div id="pos8">&nbsp;58,1 &deg;C </div>
<div id="pos9">AnlagenVL   &nbsp;73,1 &deg;C </div>
<div id="pos10">Temp.Aussen</div>
<div id="pos11">&nbsp;&nbsp;8,6 &deg;C </div>
<div id="pos12">EIN</div>
<div id="pos13">EIN</div>
<div id="pos14">AUS</div>
<div id="pos15">Pumpe-Solar</div>
<div id="pos16">AUS</div>
<div id="pos17">Frost&nbsp;Wasser</div>
<div id="pos18">TPuffer.u</div>
<div id="pos19">TPuffer.o</div>
<div id="pos20">TPuffer.m</div>
<div id="pos21">T&nbsp;VL&nbsp;Wohnr</div>
<div id="pos22">T&nbsp;VL&nbsp;Keller</div>
<div id="pos23">P&nbsp;Keller</div>
<div id="pos24">P&nbsp;Wohnraum</div>
<div id="pos25">T&nbsp;Keller</div>
<div id="pos26">T&nbsp;Wohnraum</div>
<div id="pos27">HZ Druck  &nbsp;1,61 bar</div>
<div id="pos28">&nbsp;32,0 &deg;C </div>
<div id="pos29">&nbsp;33,6 &deg;C </div>
<div id="pos30">&nbsp;23,0 &deg;C </div>
<div id="pos31">&nbsp;22,0 &deg;C </div>
<div id="pos32">AUS</div>
<div id="pos33">UeberTemp</div>
<div id="pos34">aus</div>
<div id="pos35">aus</div>
</div>
</body>
</html>
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: tobi01001 am 26 Februar 2025, 16:54:45
https://www.w3schools.com/Xml/xpath_syntax.asp (https://www.w3schools.com/Xml/xpath_syntax.asp)

attr Solardaten reading11Name TKeller_VL_Ist
attr Solardaten reading11XPath //div[@id='pos0']
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 27 Februar 2025, 06:05:02
Eine Frage hätte ich noch

Wie schaffe ich es ?

Aus
<div id="pos27">HZ Druck  &nbsp;2,10 bar</div>
nur den Wert "2,10" zu bekommen

Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: tobi01001 am 27 Februar 2025, 08:34:01
ungetestet und ins blaue (da wieder ohne Kontext bzw die eigentlichen Attribute) als Beispiel:
attr Solardaten reading11XPath number(//div[@id='pos0'])
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: betateilchen am 27 Februar 2025, 09:22:11
Vermutlich wird das mit number() nicht funktionieren, da number m.W. nur mit Dezimalpunkten arbeitet, nicht mit Dezimalkomma.

Zitat von: tobi01001 am 27 Februar 2025, 08:34:01ins blaue (da wieder ohne Kontext bzw die eigentlichen Attribute)

Dem kann ich nur zustimmen, es macht wirklich keinen Spaß, in diesem Thread helfen zu wollen, da man als Helfender viel zu viel raten muss.

Hier noch zwei Links, die dem Fragesteller bei seinen Experimenten vielleicht weiterhelfen können.

http://xpather.com

https://wiki.selfhtml.org/wiki/XML/XSL/XPath
Titel: Aw: HTTPMOD SEITE auslesen
Beitrag von: ChrisA4 am 06 März 2025, 19:28:05
Danke nochmals
Für die Unterstützung, Ansporn  und Links

Ich hab meine readings zusammen