Mit Webscraping Daten von Webseiten auslesen und in Home Assistant nutzen

Wenn du dein Smart Home mit Home Assistant betreibst, hast du vielleicht schon einmal darüber nachgedacht, wie du aktuelle Informationen von Webseiten automatisch abrufen und in dein System integrieren kannst – zum Beispiel Spritpreise, Wetterdaten oder Börsenkurse. Die Lösung: Webscraping.

In diesem Beitrag zeige ich dir Schritt für Schritt, wie du Webscraping nutzen kannst, um Daten von Webseiten auszulesen und sie in Home Assistant als Sensoren verfügbar zu machen. Keine Sorge, du brauchst dafür keine Programmierkenntnisse – ich erkläre dir alles verständlich und praxisnah.

Zu faul das hier zu lesen? Hier findest du den Beitrag auch als Video auf YouTube:

Sie sehen gerade einen Platzhalterinhalt von YouTube. Um auf den eigentlichen Inhalt zuzugreifen, klicken Sie auf die Schaltfläche unten. Bitte beachten Sie, dass dabei Daten an Drittanbieter weitergegeben werden.

Mehr Informationen
(fast) ALLE Daten von Webseiten in Home Assistant nutzen

Was ist Webscraping überhaupt?

Webscraping (auch „Scrapen“ genannt) bedeutet, dass ein Programm automatisch Informationen von Webseiten einsammelt – also das, was du sonst mühsam per Hand abschreiben würdest.

Das passiert nach bestimmten Regeln, indem das Programm gezielt Texte, Bilder oder andere Inhalte aus dem HTML-Code einer Webseite herausliest. Große Unternehmen nutzen Scraping sogar professionell, um massenhaft Daten zu sammeln und weiterzuverarbeiten.

Du magst Home Assistant? Dann abonniere kostenlos meine Beiträge mit Tipps, Tricks und Anleitungen rund um Home Assistant:

Follow Home Assistant
( 741 Followers )
X

Follow Home Assistant

E-mail : *
* Ich stimme der Datenschutzerklärung zu!

Garantiert kein Spam, keine Werbung und immer mit Abmelde-Link, solltest du es dir anders überlegen!

Aber auch für den privaten Gebrauch – etwa im Smart Home – ist Webscraping ein richtig praktisches Werkzeug, besonders wenn es um Informationen geht, für die es keine fertige Home Assistant Integration gibt.


Was solltest du beachten?

Nicht alle Webseiten mögen es, wenn ihre Inhalte automatisch ausgelesen werden. Einige blockieren gezielt sogenannte Scraper, um sich zu schützen – z. B. große Plattformen wie Amazon. Wenn dein Scraper also plötzlich keine Daten mehr bekommt, liegt das nicht an dir, sondern daran, dass die Webseite das Scraping aktiv verhindert.

Solange du aber Webseiten nutzt, die diese Technik nicht unterbinden, steht deinem Vorhaben nichts im Weg.


Webscraping mit Home Assistant – Beispiel: Spritpreise

Ein häufig genutztes Beispiel für Scraping ist die Seite clevertanken.de. Dort kannst du ganz einfach nach den aktuellen Spritpreisen in deiner Umgebung suchen.

Und genau diese Preise – etwa für Super E10 – kannst du mit Home Assistant automatisch auslesen lassen und in deinem Dashboard als Sensor anzeigen. Das ist nicht nur praktisch, sondern spart dir auch Zeit und Nerven.


Schritt-für-Schritt Anleitung: Scraping in Home Assistant einrichten

1. Entwicklerwerkzeuge im Browser nutzen

Öffne clevertanken.de in Chrome (oder einem anderen Browser) und such die gewünschte Tankstelle in deiner Nähe. Dann klickst du auf den Preis für Super E10, machst einen Rechtsklick und wählst „Untersuchen“. Der Browser zeigt dir dann den HTML-Code, in dem der Preis eingebettet ist.

Du kannst dann mit einem weiteren Rechtsklick den CSS-Selector kopieren, den Home Assistant später benötigt.

Unter https://webdataextraction.de/der-ultimative-css-selektor-spickzettel-fuer-web-scraping/ findest du eine ziemlich ausführliche Erklärung, wie du mittels HTML und CSS die gewünschten Daten eindeutig adressierst.

2. Scraping-Integration in Home Assistant aktivieren

  • Gehe in Home Assistant auf Einstellungen > Geräte & Dienste > Integration hinzufügen
  • Suche nach „Scrape“ und wähle diese Integration aus
  • Füge die URL der gewünschten Webseite (z. B. die Seite deiner Tankstelle auf clevertanken.de) als Ressource ein
  • Die Methode bleibt GET, weitere Einstellungen (Header, Authentifizierung etc.) brauchst du nicht
  • Füge den kopierten Selector im nächsten Schritt ein
  • Gib der Entität einen passenden Namen, z. B. spritpreis_scraper

3. Ergebnis prüfen

Nach dem Speichern solltest du sofort sehen, dass ein neuer Sensor in deinem System auftaucht – mit dem aktuellen Spritpreis. Du kannst diesen Sensor jetzt wie jede andere Entität verwenden, etwa im Dashboard anzeigen oder Automatisierungen damit verknüpfen.


Bonus: Preise auswerten mit Statistik-Helfern

Ein einzelner Preiswert ist nett – aber wie kannst du einschätzen, ob das ein guter oder schlechter Preis ist? Genau dafür bietet Home Assistant Statistik-Helfer.

  • Erstelle unter Einstellungen > Geräte & Dienste > Helfer > Statistik einen neuen Statistik-Helfer
  • Wähle deinen Scraping-Sensor als Quelle
  • Definiere z. B. einen 72-Stunden-Durchschnitt

So bekommst du eine Übersicht, wie sich der Preis entwickelt hat – und kannst Entscheidungen wie „Tanken oder noch warten?“ datenbasiert treffen.


Fazit: Webscraping bringt dir echte Mehrwerte im Smart Home

Mit Webscraping in Home Assistant kannst du dein Smart Home um unzählige Datenquellen erweitern – ganz ohne Zusatzkosten und ohne auf offizielle Integrationen angewiesen zu sein. Ob Spritpreise, Wetterdaten, Öffnungszeiten oder Börsenkurse – du bestimmst, was du brauchst.

Klar, der Einstieg kann etwas knifflig wirken – besonders, wenn du noch keine Erfahrung mit HTML oder CSS hast. Aber mit ein wenig Übung wirst du schnell merken: Das Ganze ist nicht schwer – und extrem hilfreich.

Produktempfehlungen

22 Gedanken zu „Mit Webscraping Daten von Webseiten auslesen und in Home Assistant nutzen“

  1. Jetzt habe ich ein neues Problem:
    In Srape habe ich als recource eine locale url vom Handy eingetragen die nicht akzeptiert wird. Hier die url:
    http://127.0.0.1:17580/pebble

    • @werner2000x Also auf dem Handy befindet sich eine Ressource, die du scrapen willst? 

      127.0.0.1 ist die Loopback-Adresse, auch bekannt als Localhost. Sie wird verwendet, um auf den eigenen Computer zu verweisen, wenn man eine Netzwerkverbindung herstellt. Anstatt eine Verbindung zu einem anderen Computer im Netzwerk oder im Internet herzustellen, wird die Verbindung auf dem eigenen Rechner selbst hergestellt und wieder zurückgeleitet. 

      Wenn du also von HA etwas auf deinem Handy scrapen willst, musst du die lokale IP-Adresse (in der Regel sowas wie 192.168.178.x bei Fritzbox bspw.) angeben. Also die IP-Adresse, unter der dein Handy lokal im Netzwerk erreichbar ist.

      Aber das wird dann natürlich nur funktionieren, wenn dein Handy im lokalen Netzwerk ist. Sobald du unterwegs bist, ist das Handy unter dieser IP ja nicht mehr erreichbar.

      Oder habe ich das komplett falsch verstanden, was du möchtest? 

      • @olli Danke, es ist so das es die lokale IP sein muss, das dort ein Webserver läuft der meine Blutzuckerwerte sendet.
        Scheinbar geht es nicht.

  2. Wenn ich im Google Browser auf  „untersuchen“ gehen zeigt er folgendes an:
    <html><head><style data-merge-styles=“true“></style><style data-merge-styles=“true“></style><style data-merge-styles=“true“></style><style data-merge-styles=“true“></style><style data-merge-styles=“true“></style><style data-merge-styles=“true“></style><title>ISm</title><style id=“monica-reading-highlight-style“>
    .monica-reading-highlight {
    animation: fadeInOut 1.5s ease-in-out;
    }

    @keyframes fadeInOut {
    0%, 100% { background-color: transparent; }
    30%, 70% { background-color: rgba(2, 118, 255, 0.20); }
    }
    </style></head><body monica-id=“ofpnmcalabcbjgholdjcjblkibolbppb“ monica-version=“7.9.6″><h2>IPswitch-S0m-WiFi: <hr><pre>S0 = 29.857.843Wh + 829W<font size=“-2″>, min= 0W, max. 2.400W</font><br>Limit Output = 1<br>MQTT connected= 1<font size=“-2″>, vor= 143s, connected= 6017, reconnected= 29</font><br><hr><br><a href=“http://192.168.198.38?ref=5″>start refresh</a> <a href=“http://192.168.198.38?inf=1″>?</a> <a href=“http://192.168.198.38?mmr=1″>reset min/max</a><br><hr> <img src=“/chart.cvg“></pre><br></h2><div id=“monica-content-root“ class=“monica-widget“ style=“pointer-events: auto;“></div></body><editor-card style=“position:absolute;top:0px;left:0px;z-index:auto;display: block !important“><div dir=“ltr“ style=“all: initial;“><div style=“color-scheme: initial; forced-color-adjust: initial; mask: initial; math-depth: initial; position: absolute; position-anchor: initial; text-size-adjust: initial; appearance: initial; color: initial; font: initial; font-palette: initial; font-synthesis: initial; position-area: initial; text-orientation: initial; text-rendering: initial; text-spacing-trim: initial; -webkit-font-smoothing: initial; -webkit-locale: initial; -webkit-text-orientation: initial; -webkit-writing-mode: initial; writing-mode: initial; zoom: initial; accent-color: initial; place-content: initial; place-items: initial; place-self: initial; alignment-baseline: initial; anchor-name: initial; anchor-scope: initial; animation-composition: initial; animation: initial; app-region: initial; aspect-ratio: initial; backdrop-filter: initial; backface-visibility: initial; background: initial; background-blend-mode: initial; baseline-shift: initial; baseline-source: initial; block-size: initial; border-block: initial; border: initial; border-radius: initial; border-collapse: initial; border-end-end-radius: initial; border-end-start-radius: initial; border-inline: initial; border-start-end-radius: initial; border-start-start-radius: initial; inset: initial; box-decoration-break: initial; box-shadow: initial; box-sizing: initial; break-after: initial; break-before: initial; break-inside: initial; buffered-rendering: initial; caption-side: initial; caret-color: initial; clear: initial; clip: initial; clip-path: initial; clip-rule: initial; color-interpolation: initial; color-interpolation-filters: initial; color-rendering: initial; columns: initial; column-fill: initial; gap: initial; column-rule: initial; column-span: initial; contain: initial; contain-intrinsic-block-size: initial; contain-intrinsic-size: initial; contain-intrinsic-inline-size: initial; container: initial; content: initial; content-visibility: initial; counter-increment: initial; counter-reset: initial; counter-set: initial; cursor: initial; cx: initial; cy: initial; d: initial; display: initial; dominant-baseline: initial; dynamic-range-limit: initial; empty-cells: initial; field-sizing: initial; fill: initial; fill-opacity: initial; fill-rule: initial; filter: initial; flex: initial; flex-flow: initial; float: initial; flood-color: initial; flood-opacity: initial; grid: initial; grid-area: initial; height: initial; hyphenate-character: initial; hyphenate-limit-chars: initial; hyphens: initial; image-orientation: initial; image-rendering: initial; initial-letter: initial; inline-size: initial; inset-block: initial; inset-inline: initial; interpolate-size: initial; isolation: initial; letter-spacing: initial; lighting-color: initial; line-break: initial; list-style: initial; margin-block: initial; margin: initial; margin-inline: initial; marker: initial; mask-type: initial; math-shift: initial; math-style: initial; max-block-size: initial; max-height: initial; max-inline-size: initial; max-width: initial; min-block-size: initial; min-height: initial; min-inline-size: initial; min-width: initial; mix-blend-mode: initial; object-fit: initial; object-position: initial; object-view-box: initial; offset: initial; opacity: initial; order: initial; orphans: initial; outline: initial; outline-offset: initial; overflow-anchor: initial; overflow-block: initial; overflow-clip-margin: initial; overflow-inline: initial; overflow-wrap: initial; overflow: initial; overlay: initial; overscroll-behavior-block: initial; overscroll-behavior-inline: initial; overscroll-behavior: initial; padding-block: initial; padding: initial; padding-inline: initial; page: initial; page-orientation: initial; paint-order: initial; perspective: initial; perspective-origin: initial; pointer-events: initial; position-try: initial; position-visibility: initial; print-color-adjust: initial; quotes: initial; r: initial; reading-flow: initial; reading-order: initial; resize: initial; rotate: initial; ruby-align: initial; ruby-position: initial; rx: initial; ry: initial; scale: initial; scroll-behavior: initial; scroll-initial-target: initial; scroll-margin-block: initial; scroll-margin: initial; scroll-margin-inline: initial; scroll-marker-group: initial; scroll-padding-block: initial; scroll-padding: initial; scroll-padding-inline: initial; scroll-snap-align: initial; scroll-snap-stop: initial; scroll-snap-type: initial; scroll-timeline: initial; scrollbar-color: initial; scrollbar-gutter: initial; scrollbar-width: initial; shape-image-threshold: initial; shape-margin: initial; shape-outside: initial; shape-rendering: initial; size: initial; speak: initial; stop-color: initial; stop-opacity: initial; stroke: initial; stroke-dasharray: initial; stroke-dashoffset: initial; stroke-linecap: initial; stroke-linejoin: initial; stroke-miterlimit: initial; stroke-opacity: initial; stroke-width: initial; tab-size: initial; table-layout: initial; text-align: initial; text-align-last: initial; text-anchor: initial; text-box: initial; text-combine-upright: initial; text-decoration: initial; text-decoration-skip-ink: initial; text-emphasis: initial; text-emphasis-position: initial; text-indent: initial; text-overflow: initial; text-shadow: initial; text-transform: initial; text-underline-offset: initial; text-underline-position: initial; text-wrap: initial; timeline-scope: initial; touch-action: initial; transform: initial; transform-box: initial; transform-origin: initial; transform-style: initial; transition: initial; translate: initial; user-select: initial; vector-effect: initial; vertical-align: initial; view-timeline: initial; view-transition-class: initial; view-transition-name: initial; visibility: initial; border-spacing: initial; -webkit-box-align: initial; -webkit-box-decoration-break: initial; -webkit-box-direction: initial; -webkit-box-flex: initial; -webkit-box-ordinal-group: initial; -webkit-box-orient: initial; -webkit-box-pack: initial; -webkit-box-reflect: initial; -webkit-line-break: initial; -webkit-line-clamp: initial; -webkit-mask-box-image: initial; -webkit-rtl-ordering: initial; -webkit-ruby-position: initial; -webkit-tap-highlight-color: initial; -webkit-text-combine: initial; -webkit-text-decorations-in-effect: initial; -webkit-text-fill-color: initial; -webkit-text-security: initial; -webkit-text-stroke: initial; -webkit-user-drag: initial; white-space-collapse: initial; widows: initial; width: initial; will-change: initial; word-break: initial; word-spacing: initial; x: initial; y: initial; z-index: 2147483647;“><link rel=“stylesheet“ href=“chrome-extension://gpaiobkfhnonedkhhfjpmhdalgeoebfa/fonts/fabric-icons.css“><div style=“all: initial;“></div></div><div style=“color-scheme: initial; forced-color-adjust: initial; mask: initial; math-depth: initial; position: absolute; position-anchor: initial; text-size-adjust: initial; appearance: initial; color: initial; font: initial; font-palette: initial; font-synthesis: initial; position-area: initial; text-orientation: initial; text-rendering: initial; text-spacing-trim: initial; -webkit-font-smoothing: initial; -webkit-locale: initial; -webkit-text-orientation: initial; -webkit-writing-mode: initial; writing-mode: initial; zoom: initial; accent-color: initial; place-content: initial; place-items: initial; place-self: initial; alignment-baseline: initial; anchor-name: initial; anchor-scope: initial; animation-composition: initial; animation: initial; app-region: initial; aspect-ratio: initial; backdrop-filter: initial; backface-visibility: initial; background: initial; background-blend-mode: initial; baseline-shift: initial; baseline-source: initial; block-size: initial; border-block: initial; border: initial; border-radius: initial; border-collapse: initial; border-end-end-radius: initial; border-end-start-radius: initial; border-inline: initial; border-start-end-radius: initial; border-start-start-radius: initial; inset: initial; box-decoration-break: initial; box-shadow: initial; box-sizing: initial; break-after: initial; break-before: initial; break-inside: initial; buffered-rendering: initial; caption-side: initial; caret-color: initial; clear: initial; clip: initial; clip-path: initial; clip-rule: initial; color-interpolation: initial; color-interpolation-filters: initial; color-rendering: initial; columns: initial; column-fill: initial; gap: initial; column-rule: initial; column-span: initial; contain: initial; contain-intrinsic-block-size: initial; contain-intrinsic-size: initial; contain-intrinsic-inline-size: initial; container: initial; content: initial; content-visibility: initial; counter-increment: initial; counter-reset: initial; counter-set: initial; cursor: initial; cx: initial; cy: initial; d: initial; display: initial; dominant-baseline: initial; dynamic-range-limit: initial; empty-cells: initial; field-sizing: initial; fill: initial; fill-opacity: initial; fill-rule: initial; filter: initial; flex: initial; flex-flow: initial; float: initial; flood-color: initial; flood-opacity: initial; grid: initial; grid-area: initial; height: initial; hyphenate-character: initial; hyphenate-limit-chars: initial; hyphens: initial; image-orientation: initial; image-rendering: initial; initial-letter: initial; inline-size: initial; inset-block: initial; inset-inline: initial; interpolate-size: initial; isolation: initial; letter-spacing: initial; lighting-color: initial; line-break: initial; list-style: initial; margin-block: initial; margin: initial; margin-inline: initial; marker: initial; mask-type: initial; math-shift: initial; math-style: initial; max-block-size: initial; max-height: initial; max-inline-size: initial; max-width: initial; min-block-size: initial; min-height: initial; min-inline-size: initial; min-width: initial; mix-blend-mode: initial; object-fit: initial; object-position: initial; object-view-box: initial; offset: initial; opacity: initial; order: initial; orphans: initial; outline: initial; outline-offset: initial; overflow-anchor: initial; overflow-block: initial; overflow-clip-margin: initial; overflow-inline: initial; overflow-wrap: initial; overflow: initial; overlay: initial; overscroll-behavior-block: initial; overscroll-behavior-inline: initial; overscroll-behavior: initial; padding-block: initial; padding: initial; padding-inline: initial; page: initial; page-orientation: initial; paint-order: initial; perspective: initial; perspective-origin: initial; pointer-events: initial; position-try: initial; position-visibility: initial; print-color-adjust: initial; quotes: initial; r: initial; reading-flow: initial; reading-order: initial; resize: initial; rotate: initial; ruby-align: initial; ruby-position: initial; rx: initial; ry: initial; scale: initial; scroll-behavior: initial; scroll-initial-target: initial; scroll-margin-block: initial; scroll-margin: initial; scroll-margin-inline: initial; scroll-marker-group: initial; scroll-padding-block: initial; scroll-padding: initial; scroll-padding-inline: initial; scroll-snap-align: initial; scroll-snap-stop: initial; scroll-snap-type: initial; scroll-timeline: initial; scrollbar-color: initial; scrollbar-gutter: initial; scrollbar-width: initial; shape-image-threshold: initial; shape-margin: initial; shape-outside: initial; shape-rendering: initial; size: initial; speak: initial; stop-color: initial; stop-opacity: initial; stroke: initial; stroke-dasharray: initial; stroke-dashoffset: initial; stroke-linecap: initial; stroke-linejoin: initial; stroke-miterlimit: initial; stroke-opacity: initial; stroke-width: initial; tab-size: initial; table-layout: initial; text-align: initial; text-align-last: initial; text-anchor: initial; text-box: initial; text-combine-upright: initial; text-decoration: initial; text-decoration-skip-ink: initial; text-emphasis: initial; text-emphasis-position: initial; text-indent: initial; text-overflow: initial; text-shadow: initial; text-transform: initial; text-underline-offset: initial; text-underline-position: initial; text-wrap: initial; timeline-scope: initial; touch-action: initial; transform: initial; transform-box: initial; transform-origin: initial; transform-style: initial; transition: initial; translate: initial; user-select: initial; vector-effect: initial; vertical-align: initial; view-timeline: initial; view-transition-class: initial; view-transition-name: initial; visibility: initial; border-spacing: initial; -webkit-box-align: initial; -webkit-box-decoration-break: initial; -webkit-box-direction: initial; -webkit-box-flex: initial; -webkit-box-ordinal-group: initial; -webkit-box-orient: initial; -webkit-box-pack: initial; -webkit-box-reflect: initial; -webkit-line-break: initial; -webkit-line-clamp: initial; -webkit-mask-box-image: initial; -webkit-rtl-ordering: initial; -webkit-ruby-position: initial; -webkit-tap-highlight-color: initial; -webkit-text-combine: initial; -webkit-text-decorations-in-effect: initial; -webkit-text-fill-color: initial; -webkit-text-security: initial; -webkit-text-stroke: initial; -webkit-user-drag: initial; white-space-collapse: initial; widows: initial; width: initial; will-change: initial; word-break: initial; word-spacing: initial; x: initial; y: initial; z-index: 2147483647;“><link rel=“stylesheet“ href=“chrome-extension://gpaiobkfhnonedkhhfjpmhdalgeoebfa/fonts/fabric-icons.css“></div><div id=“editorNotificationContainer“ style=“color-scheme: initial; forced-color-adjust: initial; mask: initial; math-depth: initial; position: fixed; position-anchor: initial; text-size-adjust: initial; appearance: initial; color: initial; font: initial; font-palette: initial; font-synthesis: initial; position-area: initial; text-orientation: initial; text-rendering: initial; text-spacing-trim: initial; -webkit-font-smoothing: initial; -webkit-locale: initial; -webkit-text-orientation: initial; -webkit-writing-mode: initial; writing-mode: initial; zoom: initial; accent-color: initial; place-content: initial; place-items: initial; place-self: initial; alignment-baseline: initial; anchor-name: initial; anchor-scope: initial; animation-composition: initial; animation: initial; app-region: initial; aspect-ratio: initial; backdrop-filter: initial; backface-visibility: initial; background: initial; background-blend-mode: initial; baseline-shift: initial; baseline-source: initial; block-size: initial; border-block: initial; border: initial; border-radius: initial; border-collapse: initial; border-end-end-radius: initial; border-end-start-radius: initial; border-inline: initial; border-start-end-radius: initial; border-start-start-radius: initial; bottom: 0px; box-decoration-break: initial; box-shadow: initial; box-sizing: initial; break-after: initial; break-before: initial; break-inside: initial; buffered-rendering: initial; caption-side: initial; caret-color: initial; clear: initial; clip: initial; clip-path: initial; clip-rule: initial; color-interpolation: initial; color-interpolation-filters: initial; color-rendering: initial; columns: initial; column-fill: initial; gap: initial; column-rule: initial; column-span: initial; contain: initial; contain-intrinsic-block-size: initial; contain-intrinsic-size: initial; contain-intrinsic-inline-size: initial; container: initial; content: initial; content-visibility: initial; counter-increment: initial; counter-reset: initial; counter-set: initial; cursor: initial; cx: initial; cy: initial; d: initial; display: flex; dominant-baseline: initial; dynamic-range-limit: initial; empty-cells: initial; field-sizing: initial; fill: initial; fill-opacity: initial; fill-rule: initial; filter: initial; flex: initial; flex-direction: column-reverse; flex-wrap: initial; float: initial; flood-color: initial; flood-opacity: initial; grid: initial; grid-area: initial; height: initial; hyphenate-character: initial; hyphenate-limit-chars: initial; hyphens: initial; image-orientation: initial; image-rendering: initial; initial-letter: initial; inline-size: initial; inset-block: initial; inset-inline: initial; interpolate-size: initial; isolation: initial; left: initial; letter-spacing: initial; lighting-color: initial; line-break: initial; list-style: initial; margin-block: initial; margin: 1em; margin-inline: initial; marker: initial; mask-type: initial; math-shift: initial; math-style: initial; max-block-size: initial; max-height: initial; max-inline-size: initial; max-width: initial; min-block-size: initial; min-height: initial; min-inline-size: initial; min-width: initial; mix-blend-mode: initial; object-fit: initial; object-position: initial; object-view-box: initial; offset: initial; opacity: initial; order: initial; orphans: initial; outline: initial; outline-offset: initial; overflow-anchor: initial; overflow-block: initial; overflow-clip-margin: initial; overflow-inline: initial; overflow-wrap: initial; overflow: initial; overlay: initial; overscroll-behavior-block: initial; overscroll-behavior-inline: initial; overscroll-behavior: initial; padding-block: initial; padding: initial; padding-inline: initial; page: initial; page-orientation: initial; paint-order: initial; perspective: initial; perspective-origin: initial; pointer-events: initial; position-try: initial; position-visibility: initial; print-color-adjust: initial; quotes: initial; r: initial; reading-flow: initial; reading-order: initial; resize: initial; right: 0px; rotate: initial; ruby-align: initial; ruby-position: initial; rx: initial; ry: initial; scale: initial; scroll-behavior: initial; scroll-initial-target: initial; scroll-margin-block: initial; scroll-margin: initial; scroll-margin-inline: initial; scroll-marker-group: initial; scroll-padding-block: initial; scroll-padding: initial; scroll-padding-inline: initial; scroll-snap-align: initial; scroll-snap-stop: initial; scroll-snap-type: initial; scroll-timeline: initial; scrollbar-color: initial; scrollbar-gutter: initial; scrollbar-width: initial; shape-image-threshold: initial; shape-margin: initial; shape-outside: initial; shape-rendering: initial; size: initial; speak: initial; stop-color: initial; stop-opacity: initial; stroke: initial; stroke-dasharray: initial; stroke-dashoffset: initial; stroke-linecap: initial; stroke-linejoin: initial; stroke-miterlimit: initial; stroke-opacity: initial; stroke-width: initial; tab-size: initial; table-layout: initial; text-align: initial; text-align-last: initial; text-anchor: initial; text-box: initial; text-combine-upright: initial; text-decoration: initial; text-decoration-skip-ink: initial; text-emphasis: initial; text-emphasis-position: initial; text-indent: initial; text-overflow: initial; text-shadow: initial; text-transform: initial; text-underline-offset: initial; text-underline-position: initial; text-wrap: initial; timeline-scope: initial; top: initial; touch-action: initial; transform: initial; transform-box: initial; transform-origin: initial; transform-style: initial; transition: initial; translate: initial; user-select: initial; vector-effect: initial; vertical-align: initial; view-timeline: initial; view-transition-class: initial; view-transition-name: initial; visibility: initial; border-spacing: initial; -webkit-box-align: initial; -webkit-box-decoration-break: initial; -webkit-box-direction: initial; -webkit-box-flex: initial; -webkit-box-ordinal-group: initial; -webkit-box-orient: initial; -webkit-box-pack: initial; -webkit-box-reflect: initial; -webkit-line-break: initial; -webkit-line-clamp: initial; -webkit-mask-box-image: initial; -webkit-rtl-ordering: initial; -webkit-ruby-position: initial; -webkit-tap-highlight-color: initial; -webkit-text-combine: initial; -webkit-text-decorations-in-effect: initial; -webkit-text-fill-color: initial; -webkit-text-security: initial; -webkit-text-stroke: initial; -webkit-user-drag: initial; white-space-collapse: initial; widows: initial; width: initial; will-change: initial; word-break: initial; word-spacing: initial; x: initial; y: initial; z-index: 2147483647;“></div></div></editor-card><editor-card style=“position:absolute;top:0px;left:0px;z-index:auto;display: block !important“><div dir=“ltr“ style=“all: initial;“><div style=“color-scheme: initial; forced-color-adjust: initial; mask: initial; math-depth: initial; position: absolute; position-anchor: initial; text-size-adjust: initial; appearance: initial; color: initial; font: initial; font-palette: initial; font-synthesis: initial; position-area: initial; text-orientation: initial; text-rendering: initial; text-spacing-trim: initial; -webkit-font-smoothing: initial; -webkit-locale: initial; -webkit-text-orientation: initial; -webkit-writing-mode: initial; writing-mode: initial; zoom: initial; accent-color: initial; place-content: initial; place-items: initial; place-self: initial; alignment-baseline: initial; anchor-name: initial; anchor-scope: initial; animation-composition: initial; animation: initial; app-region: initial; aspect-ratio: initial; backdrop-filter: initial; backface-visibility: initial; background: initial; background-blend-mode: initial; baseline-shift: initial; baseline-source: initial; block-size: initial; border-block: initial; border: initial; border-radius: initial; border-collapse: initial; border-end-end-radius: initial; border-end-start-radius: initial; border-inline: initial; border-start-end-radius: initial; border-start-start-radius: initial; inset: initial; box-decoration-break: initial; box-shadow: initial; box-sizing: initial; break-after: initial; break-before: initial; break-inside: initial; buffered-rendering: initial; caption-side: initial; caret-color: initial; clear: initial; clip: initial; clip-path: initial; clip-rule: initial; color-interpolation: initial; color-interpolation-filters: initial; color-rendering: initial; columns: initial; column-fill: initial; gap: initial; column-rule: initial; column-span: initial; contain: initial; contain-intrinsic-block-size: initial; contain-intrinsic-size: initial; contain-intrinsic-inline-size: initial; container: initial; content: initial; content-visibility: initial; counter-increment: initial; counter-reset: initial; counter-set: initial; cursor: initial; cx: initial; cy: initial; d: initial; display: initial; dominant-baseline: initial; dynamic-range-limit: initial; empty-cells: initial; field-sizing: initial; fill: initial; fill-opacity: initial; fill-rule: initial; filter: initial; flex: initial; flex-flow: initial; float: initial; flood-color: initial; flood-opacity: initial; grid: initial; grid-area: initial; height: initial; hyphenate-character: initial; hyphenate-limit-chars: initial; hyphens: initial; image-orientation: initial; image-rendering: initial; initial-letter: initial; inline-size: initial; inset-block: initial; inset-inline: initial; interpolate-size: initial; isolation: initial; letter-spacing: initial; lighting-color: initial; line-break: initial; list-style: initial; margin-block: initial; margin: initial; margin-inline: initial; marker: initial; mask-type: initial; math-shift: initial; math-style: initial; max-block-size: initial; max-height: initial; max-inline-size: initial; max-width: initial; min-block-size: initial; min-height: initial; min-inline-size: initial; min-width: initial; mix-blend-mode: initial; object-fit: initial; object-position: initial; object-view-box: initial; offset: initial; opacity: initial; order: initial; orphans: initial; outline: initial; outline-offset: initial; overflow-anchor: initial; overflow-block: initial; overflow-clip-margin: initial; overflow-inline: initial; overflow-wrap: initial; overflow: initial; overlay: initial; overscroll-behavior-block: initial; overscroll-behavior-inline: initial; overscroll-behavior: initial; padding-block: initial; padding: initial; padding-inline: initial; page: initial; page-orientation: initial; paint-order: initial; perspective: initial; perspective-origin: initial; pointer-events: initial; position-try: initial; position-visibility: initial; print-color-adjust: initial; quotes: initial; r: initial; reading-flow: initial; reading-order: initial; resize: initial; rotate: initial; ruby-align: initial; ruby-position: initial; rx: initial; ry: initial; scale: initial; scroll-behavior: initial; scroll-initial-target: initial; scroll-margin-block: initial; scroll-margin: initial; scroll-margin-inline: initial; scroll-marker-group: initial; scroll-padding-block: initial; scroll-padding: initial; scroll-padding-inline: initial; scroll-snap-align: initial; scroll-snap-stop: initial; scroll-snap-type: initial; scroll-timeline: initial; scrollbar-color: initial; scrollbar-gutter: initial; scrollbar-width: initial; shape-image-threshold: initial; shape-margin: initial; shape-outside: initial; shape-rendering: initial; size: initial; speak: initial; stop-color: initial; stop-opacity: initial; stroke: initial; stroke-dasharray: initial; stroke-dashoffset: initial; stroke-linecap: initial; stroke-linejoin: initial; stroke-miterlimit: initial; stroke-opacity: initial; stroke-width: initial; tab-size: initial; table-layout: initial; text-align: initial; text-align-last: initial; text-anchor: initial; text-box: initial; text-combine-upright: initial; text-decoration: initial; text-decoration-skip-ink: initial; text-emphasis: initial; text-emphasis-position: initial; text-indent: initial; text-overflow: initial; text-shadow: initial; text-transform: initial; text-underline-offset: initial; text-underline-position: initial; text-wrap: initial; timeline-scope: initial; touch-action: initial; transform: initial; transform-box: initial; transform-origin: initial; transform-style: initial; transition: initial; translate: initial; user-select: initial; vector-effect: initial; vertical-align: initial; view-timeline: initial; view-transition-class: initial; view-transition-name: initial; visibility: initial; border-spacing: initial; -webkit-box-align: initial; -webkit-box-decoration-break: initial; -webkit-box-direction: initial; -webkit-box-flex: initial; -webkit-box-ordinal-group: initial; -webkit-box-orient: initial; -webkit-box-pack: initial; -webkit-box-reflect: initial; -webkit-line-break: initial; -webkit-line-clamp: initial; -webkit-mask-box-image: initial; -webkit-rtl-ordering: initial; -webkit-ruby-position: initial; -webkit-tap-highlight-color: initial; -webkit-text-combine: initial; -webkit-text-decorations-in-effect: initial; -webkit-text-fill-color: initial; -webkit-text-security: initial; -webkit-text-stroke: initial; -webkit-user-drag: initial; white-space-collapse: initial; widows: initial; width: initial; will-change: initial; word-break: initial; word-spacing: initial; x: initial; y: initial; z-index: 2147483647;“><link rel=“stylesheet“ href=“chrome-extension://hokifickgkhplphjiodbggjmoafhignh/fonts/fabric-icons.css“><div style=“all: initial;“></div></div><div style=“color-scheme: initial; forced-color-adjust: initial; mask: initial; math-depth: initial; position: absolute; position-anchor: initial; text-size-adjust: initial; appearance: initial; color: initial; font: initial; font-palette: initial; font-synthesis: initial; position-area: initial; text-orientation: initial; text-rendering: initial; text-spacing-trim: initial; -webkit-font-smoothing: initial; -webkit-locale: initial; -webkit-text-orientation: initial; -webkit-writing-mode: initial; writing-mode: initial; zoom: initial; accent-color: initial; place-content: initial; place-items: initial; place-self: initial; alignment-baseline: initial; anchor-name: initial; anchor-scope: initial; animation-composition: initial; animation: initial; app-region: initial; aspect-ratio: initial; backdrop-filter: initial; backface-visibility: initial; background: initial; background-blend-mode: initial; baseline-shift: initial; baseline-source: initial; block-size: initial; border-block: initial; border: initial; border-radius: initial; border-collapse: initial; border-end-end-radius: initial; border-end-start-radius: initial; border-inline: initial; border-start-end-radius: initial; border-start-start-radius: initial; inset: initial; box-decoration-break: initial; box-shadow: initial; box-sizing: initial; break-after: initial; break-before: initial; break-inside: initial; buffered-rendering: initial; caption-side: initial; caret-color: initial; clear: initial; clip: initial; clip-path: initial; clip-rule: initial; color-interpolation: initial; color-interpolation-filters: initial; color-rendering: initial; columns: initial; column-fill: initial; gap: initial; column-rule: initial; column-span: initial; contain: initial; contain-intrinsic-block-size: initial; contain-intrinsic-size: initial; contain-intrinsic-inline-size: initial; container: initial; content: initial; content-visibility: initial; counter-increment: initial; counter-reset: initial; counter-set: initial; cursor: initial; cx: initial; cy: initial; d: initial; display: initial; dominant-baseline: initial; dynamic-range-limit: initial; empty-cells: initial; field-sizing: initial; fill: initial; fill-opacity: initial; fill-rule: initial; filter: initial; flex: initial; flex-flow: initial; float: initial; flood-color: initial; flood-opacity: initial; grid: initial; grid-area: initial; height: initial; hyphenate-character: initial; hyphenate-limit-chars: initial; hyphens: initial; image-orientation: initial; image-rendering: initial; initial-letter: initial; inline-size: initial; inset-block: initial; inset-inline: initial; interpolate-size: initial; isolation: initial; letter-spacing: initial; lighting-color: initial; line-break: initial; list-style: initial; margin-block: initial; margin: initial; margin-inline: initial; marker: initial; mask-type: initial; math-shift: initial; math-style: initial; max-block-size: initial; max-height: initial; max-inline-size: initial; max-width: initial; min-block-size: initial; min-height: initial; min-inline-size: initial; min-width: initial; mix-blend-mode: initial; object-fit: initial; object-position: initial; object-view-box: initial; offset: initial; opacity: initial; order: initial; orphans: initial; outline: initial; outline-offset: initial; overflow-anchor: initial; overflow-block: initial; overflow-clip-margin: initial; overflow-inline: initial; overflow-wrap: initial; overflow: initial; overlay: initial; overscroll-behavior-block: initial; overscroll-behavior-inline: initial; overscroll-behavior: initial; padding-block: initial; padding: initial; padding-inline: initial; page: initial; page-orientation: initial; paint-order: initial; perspective: initial; perspective-origin: initial; pointer-events: initial; position-try: initial; position-visibility: initial; print-color-adjust: initial; quotes: initial; r: initial; reading-flow: initial; reading-order: initial; resize: initial; rotate: initial; ruby-align: initial; ruby-position: initial; rx: initial; ry: initial; scale: initial; scroll-behavior: initial; scroll-initial-target: initial; scroll-margin-block: initial; scroll-margin: initial; scroll-margin-inline: initial; scroll-marker-group: initial; scroll-padding-block: initial; scroll-padding: initial; scroll-padding-inline: initial; scroll-snap-align: initial; scroll-snap-stop: initial; scroll-snap-type: initial; scroll-timeline: initial; scrollbar-color: initial; scrollbar-gutter: initial; scrollbar-width: initial; shape-image-threshold: initial; shape-margin: initial; shape-outside: initial; shape-rendering: initial; size: initial; speak: initial; stop-color: initial; stop-opacity: initial; stroke: initial; stroke-dasharray: initial; stroke-dashoffset: initial; stroke-linecap: initial; stroke-linejoin: initial; stroke-miterlimit: initial; stroke-opacity: initial; stroke-width: initial; tab-size: initial; table-layout: initial; text-align: initial; text-align-last: initial; text-anchor: initial; text-box: initial; text-combine-upright: initial; text-decoration: initial; text-decoration-skip-ink: initial; text-emphasis: initial; text-emphasis-position: initial; text-indent: initial; text-overflow: initial; text-shadow: initial; text-transform: initial; text-underline-offset: initial; text-underline-position: initial; text-wrap: initial; timeline-scope: initial; touch-action: initial; transform: initial; transform-box: initial; transform-origin: initial; transform-style: initial; transition: initial; translate: initial; user-select: initial; vector-effect: initial; vertical-align: initial; view-timeline: initial; view-transition-class: initial; view-transition-name: initial; visibility: initial; border-spacing: initial; -webkit-box-align: initial; -webkit-box-decoration-break: initial; -webkit-box-direction: initial; -webkit-box-flex: initial; -webkit-box-ordinal-group: initial; -webkit-box-orient: initial; -webkit-box-pack: initial; -webkit-box-reflect: initial; -webkit-line-break: initial; -webkit-line-clamp: initial; -webkit-mask-box-image: initial; -webkit-rtl-ordering: initial; -webkit-ruby-position: initial; -webkit-tap-highlight-color: initial; -webkit-text-combine: initial; -webkit-text-decorations-in-effect: initial; -webkit-text-fill-color: initial; -webkit-text-security: initial; -webkit-text-stroke: initial; -webkit-user-drag: initial; white-space-collapse: initial; widows: initial; width: initial; will-change: initial; word-break: initial; word-spacing: initial; x: initial; y: initial; z-index: 2147483647;“><link rel=“stylesheet“ href=“chrome-extension://hokifickgkhplphjiodbggjmoafhignh/fonts/fabric-icons.css“></div></div></editor-card></html>

    • Hi @werner2000x !

      Also ich habe es für deinen HTML-Code wie folgt hinbekommen:

      Als zu suchenden Tag folgendes nehmen:

      body > h2 > pre

      und dann als Wert-Template folgender Code:

      {{ value.split(',')[0].split('+')[1][:-1] }}

      Das liefert bei mir für deinen statischen Code die 829 als Zustand des Sensors:

      [attach]125[/attach]

      Ich hoffe das klappt bei dir so auch! 

      VG Olli

       

      • [quote data-userid=“1″ data-postid=“1622″]
        Hi @werner2000x !
        Also ich habe es für deinen HTML-Code wie folgt hinbekommen:
        Als zu suchenden Tag folgendes nehmen:
        body > h2 > pre
        und dann als Wert-Template folgender Code:
        {{ value.split(‚,‘)[0].split(‚+‘)[1][:-1] }}
        Das liefert bei mir für deinen statischen Code die 829 als Zustand des Sensors:
        — attachment is not available —
        Ich hoffe das klappt bei dir so auch! 
        VG Olli
         
        [/quote]Danke 🙂
         

      • @olli Ich habe noch eine Frage. Was muss ich eintragen unter Optionen bei „auswählen“ (Definiert, nach welchem Tag gesucht werden soll. Weitere Informationen findest du in den Beautifulsoup CSS-Selektoren)?

        • Sorry, es hat geklappt mit „auswählen“ auf: body > h2 > pre
          Jetzt kommt die Solarleistung richtig an. Danke 🙂

          • @olli Hallo, nachdem ich jetzt die Solarleistung einige Tage verfolgen stelle ich fest, das der Wert ab 1000 W nur noch 1 W angezeigt wird. Es könnte daran liegen, dass der Wert mit Punkt hinter der 1 dargestellt wird also z.B. 1.250 W.
            Kann man das auch mit Scape filtern?

          • Hallo @werner2000x !

            Sorry für die späte Antwort! 

            Passe den Code bei Wert-Template wie folgt an und es sollte auch für Tausender-Werte mit . klappen:

            {{ value.split(',')[0].split('+')[1][:-1].replace('.','') }}

            Sonst gerne wieder melden 🙂

            VG Olli

  3. Ich versuche aus meiner lokalen Webseite vom ESP32 meine Solarleistung mit Scrap in HA herauszufiltern.
    Der Inhalt in HTML ist hier:

    html><head><title>ISm</title></head><h2>IPswitch-S0m-WiFi: <hr><pre>S0 = 29.836.769Wh + 419W<FONT SIZE='-2'>, min= 0W, max. 2.400W</FONT><br>Limit Output = 1<br>MQTT connected= 1<FONT SIZE='-2'>, vor= 64s, connected= 5147, reconnected= 25</FONT><br><hr><br><a href="http://192.168.198.38?ref=5">start refresh</a> <a href="http://192.168.198.38?inf=1">?</a> <a href="http://192.168.198.38?mmr=1">reset min/max</a><br><hr> <img src="/chart.cvg"/></FONT></pre><br>

    Den Wert der Solarleistung (hier: 419W) bekomme ich über den RegEx
    "..\d\d*(?=W<FONT SIZE='-2'>)"


    Gibt es eine Möglichkeit das in Scrape umzusetzten oder ist eine andere Methode besser?Blockzitat

    IPswitchS0mWiFi
    by HarryP:

    S0 = 29.836.769Wh + 419W, min= 0W, max. 2.400WLimit Output = 1MQTT connected= 1, vor= 64s, connected= 5147, reconnected= 25

    start refresh ? reset minCode-/max



    BlockzitatDen Wert der Solarleistung Logzeilen formatiert (hier:bitte immer in </> 419W) bekomme ich über den RegEx\d\d*(?=Weinbinden)Gibt es eine Möglichkeit das in Scrape umzusetzten oder ist eine andere Methode besser?

    ​​

    1  2 / 5

    ​Wii bekomme ich die Solarleistung von 419W in HA mit Scrap herausgefiltert?
    Die Leistung wird immer in W also Watt angezeigt. 

    • @matthiasl Ja, das klappt anscheinend in dem Fall nicht so einfach. Was willst du denn haben? Man muss in diesem Fall wohl „td“ als Selector nehmen und dann mit dem Index hochzählen, bis zum gewünschten Wert. td und Index 5 bspw. liefert die „Gefühlte Temperatur“ in °C.

      • @olli Hallo Olli, vielen Dank für deine Hilfe. Durch deinen Tip kann ich alle meine gewünschten Daten auslesen. Hast du eine Erklärung warum es hier nicht so funktioniert, wie du es im Youtube-Video vorgestellt hast. Und wie bist du dann vorgegangen, um den Selektor zu bestimmen?

        • @matthiasl Super, das freut mich zu hören!

          Ich habe zunächst geschaut, ob man etwas einfacheres, wie eine Überschrift scrapen kann. Da das ging, wusste ich, dass die Seite technisch nichts gegen Scraper unternimmt. Und dann war es letztlich auf meiner Erfahrung mit Scraping basierend, wie man an Daten kommen kann. Es gibt (wie bei Home Assistant) nie nur eine Lösung. Und die mit dem „td“ und dem Index schien die einfachste zu sein.

          Das Scraping über/mit HA kommt schneller an Grenzen, als dies mit anderen (professionelleren) Tools der Fall ist. Letztlich war der Selector vermutlich für das HA-Scraping zu komplex. Hauptsache, wir haben nun die Daten. Und solltest du mal Hilfe bei noch anderen Daten brauchen, weißt du ja, wo du dich melden kannst 😉

  4. Hi Olli,
    ich habe durch Zufall dein Video auf Youtube gefunden und mich (trotz fortgeschrittener Uhrzeit)  an die Arbeit gemacht, doch:
    Ich versuche auf meine Enpal-Seite zu zugreifen, doch das Problem ist, das die Seite wo es eigentlich immer wieder aktuelle Daten geben sollte, die Information vom Web-Server sofort die Meldung kommt, die Daten könnten veraltet sein.
    [attach]108[/attach]
    Die bieten aber auch einen „Datacollector an:
    Hier kommen die Daten (nach dem man open einen Button gedrückt hat) in das Fenster als XML-Datei
    [attach]109[/attach]
    Hast du hier zu eine Idee?
    Ich könnte die Seite auch mal ins Netz stellen, aber natürlich nur über PN.
    Danke 
    Dirk

    • @dho1925 Hi Dirk! Wenn du Enpal-Seite sagst, meinst du dann eine lokale von/über Enpal bereitgestellt Seite oder www.irgendwas-mit-enpal.de?

      Das XML ist generell auch eine Möglichkeit die Daten auszulesen, das geht mit HA sicherlich in dem Fall auch. Kannst du die eigentliche XML auch direkt aufrufen über eine URL und bekommst dann die Daten aus dem letzten Screenshot angezeigt?

    • @dho1925 Generell scheint es aber für Enpal auch „fertige“ HACS-Integrationen zu geben – hast du dich damit schon beschäftigt?

      • @olli 
        1. Bein ich muss erst den Button drücken. Dann wird das Fenster gefüllt.
        2. Für Enpal Integration benötigst du eine Freigabe von Enpal. Die bekommt man nur dann wenn man die Anlage gekauft hat. Man könnte ja bei lesenden Zugriff auf die Datenbank die Einstellungen verstellen. Kopf schütteln meinerseits.
        Also suche ich nach einer anderen Lösung…

        • @dho1925 Also den Button-Klick müsste man eigentlich auch „fingieren“ können. Letztlich werden da ja nur Requests an die lokale Seite geschickt woraufhin diese mit dem XML reagiert. Kennst du dich ein klein wenig mit dem Chrome-Webmastertools bspw. aus, um die Requests zu ermitteln?

Die Kommentare sind geschlossen.