HTTPMOD SEITE auslesen

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

Vorheriges Thema - Nächstes Thema

tobi01001

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

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?

tobi01001

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

Wie finde ich da den richtigen wert ?

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

tobi01001

Ich verstehe die Frage nicht. Da steht doch nur ein Wert, sofern du die Temperatur möchtest.
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

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


tobi01001

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

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>

tobi01001

https://www.w3schools.com/Xml/xpath_syntax.asp

attr Solardaten reading11Name TKeller_VL_Ist
attr Solardaten reading11XPath //div[@id='pos0']
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

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


tobi01001

ungetestet und ins blaue (da wieder ohne Kontext bzw die eigentlichen Attribute) als Beispiel:
attr Solardaten reading11XPath number(//div[@id='pos0'])
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.

betateilchen

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
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

ChrisA4

Danke nochmals
Für die Unterstützung, Ansporn  und Links

Ich hab meine readings zusammen