caiosweet / Home-Assistant-custom-components-NASA

Home Assistant custum integration for the Nasa APIs
MIT License
10 stars 0 forks source link

Error while setting up nasa platform for sensor #3

Closed desosav closed 1 year ago

desosav commented 1 year ago

Describe the bug Log Details (ERROR) Logger: homeassistant.components.sensor Source: components/sensor/init.py:583 Integration: Sensor (documentation, issues) First occurred: 23:23:11 (4 occurrences) Last logged: 23:32:52

Error adding entities for domain sensor with platform nasa Error while setting up nasa 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: 'Centaurus A: A Peculiar Island of Stars'

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.nasa_apod has device class None, state class measurement unit Apod and suggested precision None thus indicating it has a numeric value; however, it has the non-numeric value: Centaurus A: A Peculiar Island of Stars (<class 'str'>)

To Reproduce Steps to reproduce the behavior:

I think that this started happening after installing homeassistant 2023.5.0

Expected behavior Nasa entities to be available

Additional context Sensors fail to be created and related enrities are unavailable

caiosweet commented 1 year ago

Yes, i have to remove a couple of lines about the sensor state class.

caiosweet commented 1 year ago

I think it works now. I'm sorry I can't continue the project for now. :0( 🤕

desosav commented 1 year ago

Thank you for fixing it and for bringing nasa apod/epic in lovelace. Hopefully this project won't be abandonded :)