I previously had a few scrape sensors configured in my configuration.yaml that grabbed strings for my guest WiFi network. However, those sensor configs seem to have been deprecated and no longer work. I tried the new Scrape integration method, but it doesn’t seem to want to work since the values are strings and I have no idea what I’m doing wrong.
ValueError: Sensor sensor.guest_network has device class None, state class None unit n and suggested precision None thus indicating it has a numeric value; however, it has the non-numeric value: UniFi-Guest (<class 'str'>)
2023-05-17 22:47:04.573 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 581, in state
numerical_value = float(value) # type:ignore[arg-type]
ValueError: could not convert string to float: 'UniFi-Guest'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 961, in _async_registry_updated
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 583, in state
raise ValueError(
ValueError: Sensor sensor.guest_network has device class None, state class None unit n and suggested precision None thus indicating it has a numeric value; however, it has the non-numeric value: UniFi-Guest (<class 'str'>)
2023-05-17 22:47:04.574 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up scrape platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 581, in state
numerical_value = float(value) # type:ignore[arg-type]
ValueError: could not convert string to float: 'UniFi-Guest'