Hyundai-Kia-Connect / kia_uvo

A Home Assistant HACS integration that supports Kia Connect(Uvo) and Hyundai Bluelink. The integration supports the EU, Canada and the USA.
MIT License
413 stars 85 forks source link

Error: "invalid literal for int() with base 10: '0FH'" - set_temperature entity #710

Open SteffeyDev opened 1 year ago

SteffeyDev commented 1 year ago

Region and Brand of car Hyundai USA

Version of the integration 2.12.1

Describe the bug

Seeing the below errors, seems to be preventing updates

ValueError: invalid literal for int() with base 10: '0FH'
ValueError: Sensor sensor.2022_tucson_hybrid_set_temperature has device class 'temperature', state class 'None' unit '°F' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '0FH' (<class 'str'>)

Debug logs if an error occurred

Logger: homeassistant.components.websocket_api.http.connection
Source: components/sensor/__init__.py:594
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 6:35:40 PM (1 occurrences)
Last logged: 6:35:40 PM
[547176241232] Sensor sensor.2022_tucson_hybrid_set_temperature has device class 'temperature', state class 'None' unit '°F' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '0FH' (<class 'str'>)

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

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 205, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1957, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1997, in _execute_service
    return await cast(
           ^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 845, in entity_service_call
    response_data = task.result()  # pop exception if have
                    ^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1192, in async_request_call
    return await coro
           ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 889, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/lock/__init__.py", line 99, in _async_lock
    await entity.async_lock(**remove_entity_service_fields(service_call))
  File "/config/custom_components/kia_uvo/lock.py", line 51, in async_lock
    await self.coordinator.async_lock_vehicle(self.vehicle.id)
  File "/config/custom_components/kia_uvo/coordinator.py", line 173, in async_lock_vehicle
    await self.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 236, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 95, in async_call
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 262, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 374, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 431, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 742, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in _async_write_ha_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 594, in state
    raise ValueError(
ValueError: Sensor sensor.2022_tucson_hybrid_set_temperature has device class 'temperature', state class 'None' unit '°F' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '0FH' (<class 'str'>)

To Reproduce

Add the integration with USA Hyundai vehicle

cdnninja commented 1 year ago

A change went in about an hour ago that may fix this. Can you go into HACS click redownload and select the version as "master"?

cdnninja commented 1 year ago

Actually that was Kia. Could you enable debug logging and provide those logs?

cdnninja commented 1 year ago

Did this work for you before?

kalaws commented 11 months ago

I've got the same issue with Ioniq 5 EUR Data sensor: airTemp.value: 02H Similarly: evStatus.reservChargeInfos.reservChargeInfo.reservChargeInfoDetail.reservFatcSet.airTemp.value: 0FH Bluelink app Planned AC set to 21.5 Celsius.

blaxer commented 11 months ago

Same issue as of just a few hours ago, it was working fine yesterday. I can post debug logs if that would help.

fuatakgun commented 11 months ago

It always helps to have debug logs, please do share

blaxer commented 11 months ago

Hopefully this helps, I redacted some info with XXXX

2023-09-25 11:41:57.579 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [XXXX] Sensor sensor.XXXX_XXXX_plugin_hybrid_set_temperature has device class 'temperature', state class 'None' unit '°F' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '01H' (<class 'str'>) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 586, in state numerical_value = int(value) ^^^^^^^^^^ ValueError: invalid literal for int() with base 10: '01H' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 589, in state numerical_value = float(value) ^^^^^^^^^^^^ ValueError: could not convert string to float: '01H' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 227, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1969, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2006, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/kia_uvo/services.py", line 49, in async_handle_force_update await coordinator.async_force_update_all() File "/config/custom_components/kia_uvo/coordinator.py", line 162, in async_force_update_all await self.async_refresh() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 269, in async_refresh await self._async_refresh(log_failures=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 392, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 173, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 473, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 730, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in _async_write_ha_state state, attr = self._async_generate_attributes() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 771, in _async_generate_attributes state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 593, in state raise ValueError(

or: Sensor sensor.XXXX_XXXX_plugin_hybrid_set_temperature has device class 'temperature', state class 'None' unit '°F' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '01H' (<class 'str'>)