Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Adding Entities for Low Voltage Transformer #132

Open
bluecrystaldex opened this issue Jan 27, 2025 · 2 comments
Open

Error Adding Entities for Low Voltage Transformer #132

bluecrystaldex opened this issue Jan 27, 2025 · 2 comments

Comments

@bluecrystaldex
Copy link

This should be a pretty easy fix - looks like the sensor was expecting a numerical value for voltage (in this case, 12), but the value returned was the string "12V"

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:608
integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: January 26, 2025 at 11:46:13 PM (4 occurrences)
Last logged: 10:23:38 AM

Error adding entity sensor.backyard_landscape_lighting_output_voltage_switch_2 for domain sensor with platform hubspace
Error adding entity sensor.front_yard_landscape_lighting_output_voltage_switch_2 for domain sensor with platform hubspace

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 635, in state
    numerical_value = int(value)
ValueError: invalid literal for int() with base 10: '12V'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 638, in state
    numerical_value = float(value)
ValueError: could not convert string to float: '12V'

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 608, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 927, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1384, in add_to_platform_finish
    self.async_write_ha_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1023, in async_write_ha_state
    self._async_write_ha_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1148, in _async_write_ha_state
    self.__async_calculate_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1085, in __async_calculate_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1029, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 642, in state
    raise ValueError(
    ...<5 lines>...
    ) from err
ValueError: Sensor sensor.backyard_landscape_lighting_output_voltage_switch_2 has device class 'voltage', state class 'measurement' unit 'V' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '12V' (<class 'str'>)
@Marsupilami23
Copy link

I, too, am receiving this error. I rolled back to 4.1.1, 4.1.0, and 4.0.1 with same results.

@400HPMustang
Copy link

I am also having this error on Home Assistant 2025.1.4, and integration version 4.2.0

Logger: homeassistant
Source: components/sensor/__init__.py:642
First occurred: January 30, 2025 at 9:51:58 PM (15 occurrences)
Last logged: 7:32:04 AM

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 635, in state
    numerical_value = int(value)
ValueError: invalid literal for int() with base 10: '12V'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 638, in state
    numerical_value = float(value)
ValueError: could not convert string to float: '12V'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohubspace/v1/controllers/base.py", line 106, in _handle_event
    callback(evt_type, cur_item)
    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hubspace/entity.py", line 92, in _handle_event
    self.async_write_ha_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1023, in async_write_ha_state
    self._async_write_ha_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1148, in _async_write_ha_state
    self.__async_calculate_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1085, in __async_calculate_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1029, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 642, in state
    raise ValueError(
    ...<5 lines>...
    ) from err
ValueError: Sensor sensor.transformer_output_voltage_switch_2 has device class 'voltage', state class 'measurement' unit 'V' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '12V' (<class 'str'>)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants