I’m scraping a value that sometimes exists. When it exists no problem. When the tag no longer exists the sensor returns Unknown, and I get an error in my logs Unable to extract data from HTML, 11:23 AM components/sensor/scrape.py (ERROR)
The unknown return doesn’t seem to rewrite the existing value of the sensor from when the value did exist.
Is there a way to return a default when the tag I’m looking for doesn’t exist? I.e. tag not found so find this tag instead. Getting “unknown” wouldn’t be a big deal, but logging the error and not updating the sensor value makes it unworkable.
Hi,
I have the same problem. I scrape weather information from a mobile-alert website which works well. Unfortunately I added a rain sensor and if there was no rain, there is no data on the site.
So I get unknown as state for the sensor. The problem is, I´d like to use it with gauge card and for unknown I get an error from the gauge card.
Is there any way to convert the state unknown to 0 or using 0 as default value for scrape?