thanks! I do not have a log entry for not finding the form so I guess this works? but searching the website I found a different approach, without the login, which I prefer:
therefore I need to scrape the id of the first article in the left-area (there will be ne articles on top with new ids and that is the new information I am looking for):
Hi,
Thank s for the code! I’m getting the information in the sensor but I can’t manage to add the information as Grid consumption in the Energy section of Home Assistant. The sensor is not displayed. Have you tried to add it there?
Can anyone help me set an icon that depends on the new value of a sensor compared to its previous value? I’ve tried many versions of the following, none working:
The way you access state values are completely wrong. Read the templating docs and use the states function.
The next problem is: While your sensor is updating what would the current value of the sensor be at the time the template for the icon is evaluated? It could be old or new. Regardless, the devs discourage self-references in templates (because it can lead to processing loops).
Another option is to make another kind of second sensor that tracks the change of the main sensor. This can be done using the derivative integration or just your own calculation in a template sensor. You can then use that sensor in the icon template.
Note: None of this has much to do with the scraping sensor config (not directly) but everything with templating. It’s often best to start a new topic or find a related post on the topic.
Ok, I’ve read and I’ve read and can’t seem to get past this, so I must be missing something.
scrape sensor appears to login fine, but will NOT find my “select”
2022-11-29 10:58:55.355 DEBUG (MainThread) [custom_components.multiscrape.scraper] Scraper_noname_0 # page_soup written to file: page_soup.txt
2022-11-29 10:58:55.356 DEBUG (MainThread) [custom_components.multiscrape.coordinator] Scraper_noname_0 # Data succesfully refreshed. Sensors will now start scraping to update.
2022-11-29 10:58:55.356 DEBUG (MainThread) [custom_components.multiscrape.coordinator] Finished fetching multiscrape data in 18.814 seconds (success: True)
2022-11-29 10:58:55.603 DEBUG (MainThread) [custom_components.multiscrape.sensor] Scraper_noname_0 # Daily Water Consumption # Setting up sensor
2022-11-29 10:58:55.735 DEBUG (MainThread) [custom_components.multiscrape.sensor] Scraper_noname_0 # Daily Water Consumption # Start scraping to update sensor
2022-11-29 10:58:55.738 DEBUG (MainThread) [custom_components.multiscrape.scraper] Scraper_noname_0 # Daily Water Consumption # Tag selected: None
2022-11-29 10:58:55.738 DEBUG (MainThread) [custom_components.multiscrape.form] Scraper_noname_0 # Exception occurred while scraping, will try to resubmit the form next interval.
2022-11-29 10:58:55.738 WARNING (MainThread) [custom_components.multiscrape.sensor] Scraper_noname_0 # Daily Water Consumption # Unable to scrape data: Could not find a tag for given selector
Consider using debug logging and log_response for further investigation.
2022-11-29 10:58:55.746 DEBUG (MainThread) [custom_components.multiscrape.sensor] Scraper_noname_0 # Daily Water Consumption # On-error, keep old value: None
2022-11-29 10:58:55.746 DEBUG (MainThread) [custom_components.multiscrape.entity] Scraper_noname_0 # Daily Water Consumption # Updated sensor and attributes, now adding to HA
I have tried 2 different options in my select, both give the same result.
#your-barnacle > div > dl > dd:nth-child(4) > div.compound-read-low > ul > li:nth-child(3)
I am getting these selects from either Chrome, or Firefox respectively.
The inspection looks as follows… the 335.16 is what I would expect to be returned.
<div id="your-barnacle" class="pod">
<h4 class="pod-header">Your Meter</h4>
<div class="pod-body">
<figure>
<div class="media">
<img id="barnacle-big" src="/html5/images/barnacle-residential-big.png">
</div>
<figcaption>
Your meter measures the quantity of water used in your household. Flow is measured electronically at hourly intervals, and updated every 24 hours for billing and leak detection.
</figcaption>
</figure>
<dl class="meter-stat">
<dt class="update"><i class="icon-drop-clock"></i>Read Frequency</dt>
<dd class="update">Daily</dd>
<dt class="update"><i class="icon-drop-reads"></i>Meter Read</dt>
<dd class="update">
<div class="compound-read-low">
<ul>
<li></li>
<li>6:44 AM on Nov 29</li>
**<li>335.16 CM</li>**
</ul>
</div>
The problem is, that the value “1.684” of the span ‘preisd-a’ is a composition of 4 images, where the value of the 4 digits could be obtained by concatenation of a part of the .PNG file names.
I see you are using the same “Aton” system as me.
I ask you if you were able to access with multiscrape and then obtain the energy production data etc.
This error originated from a custom integration.
Logger: custom_components.multiscrape.sensor
Source: custom_components/multiscrape/sensor.py:175
Integration: Multiscrape scraping component (documentation, issues)
First occurred: 11:00:09 (1 occurrences)
Last logged: 11:00:09
Scraper_noname_0 # PowerNI Unit Price - Energy Online # Unable to scrape data: Could not find a tag for given selector Consider using debug logging and log_response for further investigation.
Interesting
You can scrape the src attribute of the img element.
You will probably need to add 4 different selectors and then concatenate them with a template sensor.
Thanks to Daniel I use the great multiscrape integration for Home Assisant to pull the movies playing out of my local theater, the local gas price around me…
I am trying to get the href att of an anchor tag or other attributes like the url att of a picture without any success.
I need to extract the parameter: “card=189203” from the href below
Is there an option to replace the “,” separator by ‘|’
Catching strings when using select_list: is very tricky and also a problem with numbers, because stupid French people (like me) use ‘,’ instead of ‘.’ in numbers