ha_realtime_trains_api
ha_realtime_trains_api copied to clipboard
ValueError: could not convert string to float: 'No Departures' in HA 2023.5
After upgrading Home Assistant to 2023.5 I now get a ValueError: could not convert string to float: 'No Departures'
Complete output from log is below:
Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:583
Integration: Sensor (documentation, issues)
First occurred: 18:55:38 (2 occurrences)
Last logged: 18:55:38
Error adding entities for domain sensor with platform realtime_trains_api
Error while setting up realtime_trains_api 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: 'No Departures'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 455, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 731, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 846, in add_to_platform_finish
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.next_train_from_ips_to_lst has device class None, state class None unit min and suggested precision None thus indicating it has a numeric value; however, it has the non-numeric value: No Departures (<class 'str'>)