HTTPMOD SEITE auslesen

Begonnen von ChrisA4, 17 Februar 2025, 21:54:55

Vorheriges Thema - Nächstes Thema

ChrisA4

Würde gerne die Daten der folgenden Seite mit HTTPMOD auslesen

schaffe es aber überhaupt nicht mit REGEX

Könnte jemand helfen?

Du darfst diesen Dateianhang nicht ansehen.

Danke im Vorraus

passibe

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.

ChrisA4

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

passibe

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.

MadMax-FHEM

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
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

tobi01001

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?
FHEM@UbuntuServer on Lenovo ThinkCentre M900 [i5-6500T / 8GB RAM] MySQL-DbLog, Grafana, FTUI3 / HmIP incl. CCU3 / LGESS / Wärempumpe über TA CMI und CANoE / Shellies u.v.m.

ChrisA4

#6
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

ChrisA4

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


ChrisA4

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>

MadMax-FHEM

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
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

ChrisA4

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

ChrisA4

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

ChrisA4

Das hab ich auch noch

Du darfst diesen Dateianhang nicht ansehen.

passibe

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

ChrisA4

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>