Scrape sensor improved - scraping multiple values

Heres the HTML. If I input this into a HTML editor, I can see that the Battery percentage actually says “No Battery”, but on the live page it does have a percentage.

div.container-fluid > div.row-fluid > div.span12 > div.row-fluid.dash-statistics > div:nth-child(3) > div:nth-child(1) > h4

gives me this:

Screen Shot 2021-12-04 at 10.05.50 AM

If I change h4 for title.text-success, I get Unknown.

try this

div > div > div > div.row-fluid.dash-statistics > div:nth-child(3) > div:nth-child(2) > h4

That outputs the Lifetime Energy Value

Screen Shot 2021-12-04 at 10.16.41 AM

i think i have it

#content > div > div > div > div.row-fluid.dash-statistics > div:nth-child(3) > div:nth-child(1) h4#battery-charge

That outputs “No Battery”. I added a “>” before the h4 and also get “No Battery”. This seems to be a tricky selector.

but no battery is if there is no battery status…

for me it says no battery, but if i had the device it would of give me the battery lvl with that selector


Yeah, the weird thing is I do have a Battery Level.

try this, its indeed tricky

div > div > div > div.row-fluid.dash-statistics > div:nth-child(3) > div:nth-child(1) > h4

That gives me “No Battery”

I have basically a toddler level understanding of CSS, but in the HTML “No Battery” is in h4 class title text primary, and in the Elements tab the Percentage is in title text-success, so if I used title.text-success it should give me the percentage right? It’s weird that it is coming up unknown whenever I use title.text-success

i think you have an weird problem, the data u sended me contains everything except the battery lvl in the html file.

Yeah that’s what I noticed, for some strange reason in the HTML the Battery Level shows as No Battery.

look here, when i manually put the percentage of the battery, the last selector i sended you should work

maybe try restarting that device that provides the data, as here i can scrape that 96%

Yeah I’ve never actually reset the Generac system, I’ll restart it and see if that helps. Thank you so much for bearing with me.

no problems at all, just let me know, i’m glad to help :smile:

2 Likes

Can someone help determine why I get an “unknown” for this tankpercentage". Here is my yaml config…Tank percentage is in the form of “62%”

multiscrape:

  • resource: AmeriGas Login
    scan_interval: 3600
    headers:
    User-Agent: Mozilla/5.0
    form_submit:
    submit_once: True
    select: “form-control-valid”
    input:
    email: myusername
    password: mypassword
    sensor:
    - select: “#layoutDiv > main > div.container.pl-0.pr-0.pl-xl-3.pr-xl-3.pl-lg-3.pr-lg-3.pl-md-3.pr-md-3.pl-sm-0.pr-sm-0 > div:nth-child(2) > div.col-12.col-xl-6.col-lg-6.col-md-12.col-sm-12.pl-0.pr-0.pr-xl-3.pr-lg-3.pr-md-0.pr-sm-0 > div.col-12.bg-white.tankanddeliveries-padding.top-margin > div:nth-child(3) > div.col-12.col-xl-4.col-lg-4.col-md-12.col-sm-12.p-0.mt-3.EstimatedTankDiv > div > div.col-12.p-0.lblvalue-Estimatedtank”
    name: Tankpercentage
    - unique_id: Tank_percentage

Here is the error from Log:

ogger: custom_components.multiscrape.sensor
Source: custom_components/multiscrape/sensor.py:139
Integration: Multiscrape scraping component (documentation, issues)
First occurred: December 15, 2021, 10:20:05 PM (19 occurrences)
Last logged: 4:20:05 PM

Sensor Tankpercentage was unable to extract data from HTML

Thanks in advance

1 Like

:partying_face: :partying_face: :partying_face:

As of release v5.7.0, Multiscrape could also be used as an improved REST component. It now supports JSON in the value_templates, enabling you with the same syntax as the RESTful sensors but added to all the extras of Multiscrape. E.g. form-submit, entity pictures, icon templates, etc.!

:partying_face: :partying_face: :partying_face:

2 Likes

how it works? I don’t understand… can u tell some exemples?

Check out this: Issue with Multiscrape / Scrape - #34 by Robi07

1 Like