question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2.0.0: Error while setting up magic_areas platform for sensor

See original GitHub issue

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'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:24 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
jseidlcommented, Jan 31, 2021

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.

0reactions
Bodge-ITcommented, Jan 25, 2022

Hi @jseidl sorry to comment on a closed issue but should I be getting this error on the latest beta?

Logger: homeassistant.components.binary_sensor
Source: custom_components/magic_areas/binary_sensor.py:223
Integration: Binary Sensor (documentation, issues)
First occurred: 20:58:04 (6 occurrences)
Last logged: 20:58:04

    Error adding entities for domain binary_sensor with platform magic_areas
    Error while setting up magic_areas platform for binary_sensor

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 613, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 747, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/config/custom_components/magic_areas/binary_sensor.py", line 265, in async_added_to_hass
    await self._initialize()
  File "/config/custom_components/magic_areas/binary_sensor.py", line 290, in _initialize
    self.load_attributes()
  File "/config/custom_components/magic_areas/binary_sensor.py", line 223, in load_attributes
    for feature_name, opts in self.area.config.get(
AttributeError: 'list' object has no attribute 'items'

A slight correction to a point made above… a binary sensor does not need to have a device_class set. None: Generic on/off. This is the default and doesn’t need to be set. But maybe I haven’t understood the relevance of that here, all my area sensors are set to “occupancy”.

I wondered if it was because I had created an include to binarys.yaml in my config, instead of binary_sensors.yaml? Changing the name doesn’t seem to have fixed my issue.

I do have the binary_sensors for the areas but have no clue where they are created.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error while setting up netgear platform for sensor · Issue #59720
The problem Since about 2021.11.0 I started getting "Error while setting up netgear platform for sensor" in my log.
Read more >
Areas no longer suck! Magic Areas will bring your Areas to life ...
When I try setup magic areas in the integration page I get this message, when I search for area entities they are not...
Read more >
Composite sensor fails with "Illegal Message Section
Oracle SOA Suite - Version 12.2.1.3.0 and later: Composite sensor fails with "Illegal Message Section : in[[" error when expression is being ...
Read more >
Potential error in the RecFusion SDK 2.2.0 while closing many ...
Hi, I have encountered a potential error while closing many sensors (Orbbec Astra) with the Sensor::close() function: [Core.Platform] ...
Read more >
Troubleshooting the sensor - IBM
x installation. WebLogic 9.x JAR files work with WebLogic 10.x. WebLogic sensor fails to discover WebLogic Administration Server. Problem ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found