hass-magic_areas: 2.0.0: Error while setting up magic_areas platform for sensor

I have updated magic_areas to 2.0.0.

In the configuration i deleted everything related to magic_areas and only added magic_areas:

After a restart Magic Areas appears in the Integrations page with the right areas but no specific sensor has been created (Area temperature and so on, even if i edit the config through UI). Only the general area binary sensors and presence hold switches are there.

2 bad log entries are appearing:

Logger: homeassistant.components.sensor
Source: custom_components/magic_areas/sensor.py:54
Integration: Sensor (documentation, issues)
First occurred: 16:22:35 (1 occurrences)
Last logged: 16:22:35

Error while setting up magic_areas platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 199, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/magic_areas/sensor.py", line 32, in async_setup_entry
    await load_sensors(hass, async_add_entities, area)
  File "/config/custom_components/magic_areas/sensor.py", line 54, in load_sensors
    map_key = f"{entity['device_class']}/{entity['unit_of_measurement']}"
KeyError: 'unit_of_measurement'
Logger: homeassistant
Source: custom_components/magic_areas/base.py:377
First occurred: 16:22:35 (2 occurrences)
Last logged: 16:22:35

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/magic_areas/base.py", line 496, in initialize
    await self.load_entities()
  File "/config/custom_components/magic_areas/base.py", line 532, in load_entities
    self.load_entity_list(entity_list)
  File "/config/custom_components/magic_areas/base.py", line 377, in load_entity_list
    unique_entities = set(entity_list)
TypeError: unhashable type: 'list'

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (22 by maintainers)

Most upvoted comments

I think because of this error MagicAreas stopped working and won’t create new entities for areas.

Can you please update to 2.0.2? Added some code that should deal gracefully with this error and throw warnings instead of crashing.