core icon indicating copy to clipboard operation
core copied to clipboard

Scrape component not working after update to 2025.3.2

Open bong1991 opened this issue 9 months ago • 4 comments

The problem

After the upgrade to 2025.3.2, the scrape integration stopped working, due to bs4.Tag not known. After downgrading to 2025.3.1, it started working again.

  File "/usr/local/lib/python3.13/site-packages/soupsieve/css_match.py", line 98, in is_tag
    return isinstance(obj, bs4.Tag)
                           ^^^^^^^
AttributeError: module 'bs4' has no attribute 'Tag'

What version of Home Assistant Core has the issue?

2025.3.2

What was the last working version of Home Assistant Core?

2025.3.1

What type of installation are you running?

Home Assistant OS

Integration causing the issue

scrape

Link to integration documentation on our website

https://www.home-assistant.io/integrations/scrape/

Diagnostics information

No response

Example YAML snippet

- resource: "http://192.168.178.53/?s=1,1"
  sensor:
    - name: WP_Leistung
      select: "#content > div:nth-child(1) > table > tr:nth-child(22) > td.value.round-rightbottom"
      unit_of_measurement: "kW"
      value_template: '{{ value.replace("kW", "") | replace(",",".") | float }}'

Anything in the logs that might be useful for us?

2025-03-12 20:29:23.717 DEBUG (MainThread) [homeassistant.components.scrape.coordinator] Finished fetching Scrape Coordinator data in 6.592 seconds (success: True)
2025-03-12 20:29:23.718 ERROR (MainThread) [homeassistant.components.sensor] Error adding entity sensor.web_scrape for domain sensor with platform scrape
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 633, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 972, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1383, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/scrape/sensor.py", line 205, in async_added_to_hass
    self._async_update_from_rest_data()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/components/scrape/sensor.py", line 210, in _async_update_from_rest_data
    value = self._extract_value()
  File "/usr/src/homeassistant/homeassistant/components/scrape/sensor.py", line 184, in _extract_value
    tag = raw_data.select(self._select)[self._index]
          ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/bs4/element.py", line 2116, in select
    return self.css.select(selector, namespaces, limit, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/bs4/css.py", line 193, in select
    """
    
    return self.api.iselect(
    ^^^^^^^^^^^^^^^^^^^^^^^^
        select, self.tag, self._ns(namespaces, select), limit, flags, **kwargs
        ^
  File "/usr/local/lib/python3.13/site-packages/soupsieve/__init__.py", line 147, in select
    return compile(select, namespaces, flags, **kwargs).select(tag, limit)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/soupsieve/css_match.py", line 1564, in select
    return list(self.iselect(tag, limit))
  File "/usr/local/lib/python3.13/site-packages/soupsieve/css_match.py", line 1569, in iselect
    yield from CSSMatch(self.selectors, tag, self.namespaces, self.flags).select(limit)
               ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/soupsieve/css_match.py", line 493, in __init__
    self.assert_valid_input(scope)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/soupsieve/css_match.py", line 87, in assert_valid_input
    if not cls.is_tag(tag):
           ~~~~~~~~~~^^^^^
  File "/usr/local/lib/python3.13/site-packages/soupsieve/css_match.py", line 98, in is_tag
    return isinstance(obj, bs4.Tag)
                           ^^^^^^^
AttributeError: module 'bs4' has no attribute 'Tag'

Additional information

bong1991 avatar Mar 12 '25 20:03 bong1991