core icon indicating copy to clipboard operation
core copied to clipboard

Work Area Sensor can not be added during Setup

Open Gloomyeye opened this issue 4 months ago • 16 comments

The problem

Hello,

the system tries to add the new work area sensor with every HASS system start and fails with an error message. The sensor is not available.

What version of Home Assistant Core has the issue?

core-2024.10.1

What was the last working version of Home Assistant Core?

core-2024.9.2

What type of installation are you running?

Home Assistant OS

Integration causing the issue

husqvarna_automower

Link to integration documentation on our website

https://www.home-assistant.io/integrations/husqvarna_automower/

Diagnostics information

config_entry-husqvarna_automower-1f915e4ed0a2572bed4d7335902630bb.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.sensor
Quelle: helpers/entity_platform.py:595
Integration: Sensor (Dokumentation, Probleme)
Erstmals aufgetreten: 00:10:46 (2 Vorkommnisse)
Zuletzt protokolliert: 00:11:33

Error adding entity sensor.husky_arbeitsbereich for domain sensor with platform husqvarna_automower
Error adding entity sensor.husqvarna_mower_husky_work_area for domain sensor with platform husqvarna_automower
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 595, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 909, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1366, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1005, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1011, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 542, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/husqvarna_automower/sensor.py", line 412, in native_value
    return self.entity_description.value_fn(self.mower_attributes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/husqvarna_automower/sensor.py", line 216, in _get_current_work_area_name
    return data.work_areas[data.mower.work_area_id].name
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 4294967295

Additional information

No response

Gloomyeye avatar Oct 04 '24 22:10 Gloomyeye