Enbridge Gas can't load due to unexpected data type.
Opened this issue · 0 comments
nromyn commented
Gas sensors simply return no_peak
for their value.
This causes an error as shown below, as a string is not an accepted value for a device class of type "monetary".
Logger: homeassistant.helpers.entity
Source: helpers/entity.py:951
First occurred: 09:12:03 (1 occurrences)
Last logged: 09:12:03
Update for sensor.enbridge_gas_all_natural_gas_rate fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 668, in state
numerical_value = float(value) # type:ignore[arg-type]
^^^^^^^^^^^^
ValueError: could not convert string to float: 'no_peak'
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 951, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update
await self.async_update()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 532, in async_update
await self.coordinator.async_request_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in async_request_refresh
await self._debounced_refresh.async_call()
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in async_call
await task
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 291, in async_refresh
await self._async_refresh(log_failures=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 494, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 670, in state
raise ValueError(
ValueError: Sensor sensor.enbridge_gas_all_natural_gas_rate has device class 'monetary', state class 'None' unit 'CA ¢/m³' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'no_peak' (<class 'str'>)