Scrape sensor - help please

Hi all
suddenly the below sensor stopped working

  - resource: https://penteli.meteo.gr/stations/chalandri/
#    verify_ssl: false
    sensor:
      - name: Wind speed meteo penteli
        select: ".realtime div:nth-of-type(5) .lright span"
        value_template: '{{value[0:4]}}'
        unit_of_measurement: 'km/h'
  - resource: https://penteli.meteo.gr/stations/chalandri/
#      verify_ssl: false
    sensor:
      - name: Vrilissia Live Temperature
        select: ".realtime div:nth-of-type(2) .lright span"
        value_template: '{{value[0:4]}}'
        unit_of_measurement: "°C"
  - resource: https://penteli.meteo.gr/stations/chalandri/
#      verify_ssl: false

in the logs I see this but I don’t understand what is the problem

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:600
integration: Sensor (documentation, issues)
First occurred: 13:13:55 (3 occurrences)
Last logged: 13:13:55

Error adding entity sensor.wind_speed_meteo_penteli for domain sensor with platform scrape
Error adding entity sensor.vrilissia_live_humidity for domain sensor with platform scrape
Error adding entity sensor.vrilissia_live_temperature for domain sensor with platform scrape
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 600, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 914, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1354, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/scrape/sensor.py", line 202, 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 = template.async_render_with_possible_json_value(value, None)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 771, in async_render_with_possible_json_value
    render_result = _render_with_context(
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2616, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
TypeError: 'NoneType' object is not subscriptable

Can someone help please?

Likely, the website changed its layout and the select’s are no more valid, returning an empty value. That leads to the {{value[0:4]}} template throwing the exception you see.

1 Like

You are trying to scrape data off of someone elses source data. First make sure they didn’t shut the data off. If you can verify the data is still there, make sure it is in the same format as it was when the sensor wad working.
This is the nature of using other’s data, they are under no obligation to let you and your access the info does cost them money. they may have simply added an auth password and you will never get that again. Who knows…

This might help finding another weather source. Definitive guide to Weather integrations 🌦.