Skip to content

2 sensors problem #303

@edkazic

Description

@edkazic

Version of the custom_component

just updated new version 0.2.8 but still having problems

Configuration

Add your logs here.

Describe the bug

I have 2 plugs and 2 sensors
I have removed old installation and reinstalled fresh copy of 0.2.8.

The installation only detected one plug and one sensor.
Interesting part is that one sensor that was detected actually picking information for both sensors. I can tell as every 15-30 seconds the sensor attributes change and I can see 2 different MAC addresses alternating with corresponding values for the power.
I made a configuration where I can read this one sensor but I filter info into 2 entities belonging to 2 sensors so I have actual power values for the solar as well as power for the grid.
I can use this as is but it would be much cleaner if I can read 2 sensors independently.
And I can not avoid errors in the log but still everything works?

Also interesting thing I have noticed when I made "reload" (three dots on the top right corner) on the DiUS_Powersensor integration page. Then i have noticed second sensor showed up but with no entities and with the same name as the first one. So I had to rename one sensor so that I have unique names and after that new reload is not creating more sensors and my workaround to read solar and grid power works. It is just error log that is annoying.

Debug log

2023-12-02 17:38:25.579 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform dius
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 563, in _async_add_entity
entity.add_to_platform_start(
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 218, in add_to_platform_start
if self.unique_id is None or self.device_class is None:
^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 356, in unique_id
return self._attr_unique_id
^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/dius/entity.py", line 22, in _attr_unique_id
return data.get(Msg_keys.mac.value)
^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
2023-12-02 17:38:25.582 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up dius platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 563, in _async_add_entity
entity.add_to_platform_start(
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 218, in add_to_platform_start
if self.unique_id is None or self.device_class is None:
^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 356, in unique_id
return self._attr_unique_id
^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/dius/entity.py", line 22, in _attr_unique_id
return data.get(Msg_keys.mac.value)
^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions