Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No entities captured on devices #10

Open
spinza opened this issue Aug 7, 2023 · 5 comments
Open

No entities captured on devices #10

spinza opened this issue Aug 7, 2023 · 5 comments

Comments

@spinza
Copy link

spinza commented Aug 7, 2023

Have a working setup with Homie MQTT to OpenHab.

When activating this plugin on Home Assistant only the devices are captured and no entitiies. Log below. You can see four homie devices captured and then as it starts with nodes/properties it falls over.

2023-08-07 21:47:38.352 DEBUG (MainThread) [custom_components.homie] async_discovery_message_received ( mqttmsg = ReceiveMessage(topic='homie/powerclamp/$homie', payload='4.0.0', qos=1, retain=1, subscribed_topic='homie/+/$homie', timestamp=datetime.datetime(2023, 8, 7, 19, 47, 38, 352078, tzinfo=datetime.timezone.utc)) )
2023-08-07 21:47:44.739 DEBUG (MainThread) [custom_components.homie] async_device_on_ready ( homie_device = <custom_components.homie.homie.component.HomieDevice object at 0x7f7b35bae690> )
2023-08-07 21:47:44.740 DEBUG (MainThread) [custom_components.homie.mixins] async_create_ha_device ( hass = <homeassistant.core.HomeAssistant object at 0x7f7b54ff7150>, device = <custom_components.homie.homie.component.HomieDevice object at 0x7f7b35bae690>, entry = <homeassistant.config_entries.ConfigEntry object at 0x7f7b54fcf440> )
2023-08-07 21:47:44.740 DEBUG (MainThread) [custom_components.homie.mixins] Adding new device: eskomsepush (id) on homie/eskomsepush (topic)
2023-08-07 21:47:44.740 DEBUG (MainThread) [custom_components.homie.mixins] async_discover_properties ( hass = <homeassistant.core.HomeAssistant object at 0x7f7b54ff7150>, device = <custom_components.homie.homie.component.HomieDevice object at 0x7f7b35bae690> )
2023-08-07 21:47:44.741 DEBUG (MainThread) [custom_components.homie.mixins] For node: area
2023-08-07 21:47:44.741 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: areaid
2023-08-07 21:47:44.741 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'sensor', unique_id = 'homie/eskomsepush/area/areaid', payload = {'property': {'device': 'eskomsepush', 'node': 'area', 'name': 'areaid'}} )
2023-08-07 21:47:44.741 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: areaname
2023-08-07 21:47:44.742 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'sensor', unique_id = 'homie/eskomsepush/area/areaname', payload = {'property': {'device': 'eskomsepush', 'node': 'area', 'name': 'areaname'}} )
2023-08-07 21:47:44.742 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: regionname
2023-08-07 21:47:44.742 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'sensor', unique_id = 'homie/eskomsepush/area/regionname', payload = {'property': {'device': 'eskomsepush', 'node': 'area', 'name': 'regionname'}} )
2023-08-07 21:47:44.742 DEBUG (MainThread) [custom_components.homie.mixins] For node: api
2023-08-07 21:47:44.743 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: lastapiupdate
2023-08-07 21:47:44.743 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'sensor', unique_id = 'homie/eskomsepush/api/lastapiupdate', payload = {'property': {'device': 'eskomsepush', 'node': 'api', 'name': 'lastapiupdate'}} )
2023-08-07 21:47:44.743 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: apicount
2023-08-07 21:47:44.743 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'sensor', unique_id = 'homie/eskomsepush/api/apicount', payload = {'property': {'device': 'eskomsepush', 'node': 'api', 'name': 'apicount'}} )
2023-08-07 21:47:44.744 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: apilimit
2023-08-07 21:47:44.744 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'sensor', unique_id = 'homie/eskomsepush/api/apilimit', payload = {'property': {'device': 'eskomsepush', 'node': 'api', 'name': 'apilimit'}} )
2023-08-07 21:47:44.744 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: apilimittype
2023-08-07 21:47:44.755 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'sensor', unique_id = 'homie/eskomsepush/api/apilimittype', payload = {'property': {'device': 'eskomsepush', 'node': 'api', 'name': 'apilimittype'}} )
2023-08-07 21:47:44.756 DEBUG (MainThread) [custom_components.homie.mixins] For node: status
2023-08-07 21:47:44.756 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: loadshedding
2023-08-07 21:47:44.756 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'binary_sensor', unique_id = 'homie/eskomsepush/status/loadshedding', payload = {'property': {'device': 'eskomsepush', 'node': 'status', 'name': 'loadshedding'}} )
2023-08-07 21:47:44.756 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: warning15min
2023-08-07 21:47:44.757 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'binary_sensor', unique_id = 'homie/eskomsepush/status/warning15min', payload = {'property': {'device': 'eskomsepush', 'node': 'status', 'name': 'warning15min'}} )
2023-08-07 21:47:44.757 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: warning5min
2023-08-07 21:47:44.757 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'binary_sensor', unique_id = 'homie/eskomsepush/status/warning5min', payload = {'property': {'device': 'eskomsepush', 'node': 'status', 'name': 'warning5min'}} )
2023-08-07 21:47:44.758 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: loadsheddingnextstart
2023-08-07 21:47:44.758 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'sensor', unique_id = 'homie/eskomsepush/status/loadsheddingnextstart', payload = {'property': {'device': 'eskomsepush', 'node': 'status', 'name': 'loadsheddingnextstart'}} )
2023-08-07 21:47:44.758 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: loadsheddingnextend
2023-08-07 21:47:44.759 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'sensor', unique_id = 'homie/eskomsepush/status/loadsheddingnextend', payload = {'property': {'device': 'eskomsepush', 'node': 'status', 'name': 'loadsheddingnextend'}} )
2023-08-07 21:47:44.759 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: loadsheddingend
2023-08-07 21:47:44.759 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'sensor', unique_id = 'homie/eskomsepush/status/loadsheddingend', payload = {'property': {'device': 'eskomsepush', 'node': 'status', 'name': 'loadsheddingend'}} )
2023-08-07 21:47:44.759 DEBUG (MainThread) [custom_components.homie.mixins] Try to match property: note
2023-08-07 21:47:44.760 DEBUG (MainThread) [custom_components.homie.mixins] fire_homie_discovery_new ( platform = 'sensor', unique_id = 'homie/eskomsepush/status/note', payload = {'property': {'device': 'eskomsepush', 'node': 'status', 'name': 'note'}} )
2023-08-07 21:47:44.968 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform homie
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: homeassistant.helpers.device_registry.DeviceRegistry.async_get_or_create() got multiple values for keyword argument 'config_entry_id'
2023-08-07 21:47:44.972 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform homie
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: homeassistant.helpers.device_registry.DeviceRegistry.async_get_or_create() got multiple values for keyword argument 'config_entry_id'
2023-08-07 21:47:44.976 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform homie
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: homeassistant.helpers.device_registry.DeviceRegistry.async_get_or_create() got multiple values for keyword argument 'config_entry_id'
2023-08-07 21:47:44.979 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform homie
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: homeassistant.helpers.device_registry.DeviceRegistry.async_get_or_create() got multiple values for keyword argument 'config_entry_id'
2023-08-07 21:47:44.982 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform homie
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: homeassistant.helpers.device_registry.DeviceRegistry.async_get_or_create() got multiple values for keyword argument 'config_entry_id'
2023-08-07 21:47:44.985 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform homie
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: homeassistant.helpers.device_registry.DeviceRegistry.async_get_or_create() got multiple values for keyword argument 'config_entry_id'

Dump from the device eskomsepush:

homie/eskomsepush/area/areaid capetown-7-gardens
homie/eskomsepush/area/areaid/$name Area ID
homie/eskomsepush/area/areaid/$datatype string
homie/eskomsepush/area/areaid/$settable false
homie/eskomsepush/area/areaid/$retained true
homie/eskomsepush/area/areaname Gardens (7)
homie/eskomsepush/area/areaname/$name Area Name
homie/eskomsepush/area/areaname/$datatype string
homie/eskomsepush/area/areaname/$settable false
homie/eskomsepush/area/areaname/$retained true
homie/eskomsepush/area/regionname City of Cape Town
homie/eskomsepush/area/regionname/$name Region Name
homie/eskomsepush/area/regionname/$datatype string
homie/eskomsepush/area/regionname/$settable false
homie/eskomsepush/area/regionname/$retained true
homie/eskomsepush/area/$name Area
homie/eskomsepush/area/$properties areaid,areaname,regionname
homie/eskomsepush/api/lastapiupdate 2023-08-07T21:59:36.137165+02:00
homie/eskomsepush/api/lastapiupdate/$name Last Update
homie/eskomsepush/api/lastapiupdate/$datatype string
homie/eskomsepush/api/lastapiupdate/$settable false
homie/eskomsepush/api/lastapiupdate/$retained true
homie/eskomsepush/api/apicount 46
homie/eskomsepush/api/apicount/$name API Count
homie/eskomsepush/api/apicount/$datatype integer
homie/eskomsepush/api/apicount/$settable false
homie/eskomsepush/api/apicount/$retained true
homie/eskomsepush/api/apilimit 50
homie/eskomsepush/api/apilimit/$name API Limit
homie/eskomsepush/api/apilimit/$datatype integer
homie/eskomsepush/api/apilimit/$settable false
homie/eskomsepush/api/apilimit/$retained true
homie/eskomsepush/api/apilimittype daily
homie/eskomsepush/api/apilimittype/$name API Limit Type
homie/eskomsepush/api/apilimittype/$datatype string
homie/eskomsepush/api/apilimittype/$settable false
homie/eskomsepush/api/apilimittype/$retained true
homie/eskomsepush/api/$name API
homie/eskomsepush/api/$properties lastapiupdate,apicount,apilimit,apilimittype
homie/eskomsepush/status/loadshedding false
homie/eskomsepush/status/loadshedding/$name Current Loadshedding
homie/eskomsepush/status/loadshedding/$datatype boolean
homie/eskomsepush/status/loadshedding/$settable false
homie/eskomsepush/status/loadshedding/$retained true
homie/eskomsepush/status/warning5min false
homie/eskomsepush/status/warning5min/$name Loadshedding 5 minute Warning
homie/eskomsepush/status/warning5min/$datatype boolean
homie/eskomsepush/status/warning5min/$settable false
homie/eskomsepush/status/warning5min/$retained true
homie/eskomsepush/status/warning15min false
homie/eskomsepush/status/warning15min/$name Loadshedding 15 minute Warning
homie/eskomsepush/status/warning15min/$datatype boolean
homie/eskomsepush/status/warning15min/$settable false
homie/eskomsepush/status/warning15min/$retained true
homie/eskomsepush/status/loadsheddingnextstart 2023-08-08T02:00:00+02:00
homie/eskomsepush/status/loadsheddingnextstart/$name Loadshedding Start Time
homie/eskomsepush/status/loadsheddingnextstart/$datatype string
homie/eskomsepush/status/loadsheddingnextstart/$settable false
homie/eskomsepush/status/loadsheddingnextstart/$retained true
homie/eskomsepush/status/loadsheddingnextend 2023-08-08T04:30:00+02:00
homie/eskomsepush/status/loadsheddingnextend/$name Loadshedding End Time
homie/eskomsepush/status/loadsheddingnextend/$datatype string
homie/eskomsepush/status/loadsheddingnextend/$settable false
homie/eskomsepush/status/loadsheddingnextend/$retained true
homie/eskomsepush/status/loadsheddingend 2099-01-01T01:01:01.000001+01:52
homie/eskomsepush/status/loadsheddingend/$name Loadshedding End Time
homie/eskomsepush/status/loadsheddingend/$datatype string
homie/eskomsepush/status/loadsheddingend/$settable false
homie/eskomsepush/status/loadsheddingend/$retained true
homie/eskomsepush/status/note Not loadshedding
homie/eskomsepush/status/note/$name Status Note
homie/eskomsepush/status/note/$datatype string
homie/eskomsepush/status/note/$settable false
homie/eskomsepush/status/note/$retained true
homie/eskomsepush/status/$name Loadshedding status
homie/eskomsepush/status/$properties loadshedding,warning15min,warning5min,loadsheddingnextstart,loadsheddingnextend,loadsheddingend,note
homie/eskomsepush/$homie 4.0.0
homie/eskomsepush/$name Eskom Loadshedding Schedule
homie/eskomsepush/$state ready
homie/eskomsepush/$nodes area,api,status
homie/eskomsepush/$implementation esp_mqtt
@c64emulator
Copy link

I have the same issue with an BME680 sending its values to HomeAssistant via MQTT-homie_v4.0.
I can see the same errors starting with message "Error adding entities for domain sensor with platform homie"
This configuration is not new, it worked for a long time before. It seems to be related to the latest release of Home Assistant (v2023.8.2) linked to mosquitto v2.0.15
Just an idea: may be related to https://developers.home-assistant.io/blog/2023-057-21-change-naming-mqtt-entities/ ?

@spinza
Copy link
Author

spinza commented Aug 15, 2023

Might be we can fix by adding entity names? Will have a poke.

@elbowz
Copy link
Owner

elbowz commented Aug 16, 2023

I don't have time along these days to fix the issue...of course, any PR is always welcome.

Sorry

@spinza
Copy link
Author

spinza commented Aug 16, 2023

I am not sure where the setup of the entity is done. I lose the code here:
https://github.com/elbowz/ha-homie/blob/67aea1f079fb4013991bd33664f3e31582e9cc0d/homie/binary_sensor.py#L58C1-L60C6

Where is this picked up and actually converted to an entity?

It may well be this bit which needs to be reconfigured for this?

class HomieBinarySensor(entity_base.HomieEntity, binary_sensor.BinarySensorEntity):

@spinza
Copy link
Author

spinza commented Aug 18, 2023

Think I've figured it out. A recent update has occurred here. This update separately passes the config_entity_id and the device_info which was not previously done.

The device_info property for this integration however includes the config_entity_id here:

"config_entry_id": self._config_entry.entry_id,

This leads to the error we observe as essentially send multiple values config_entity_id to the function as it's passed directly as well as via device_info.

So presumably the device_info should not contain the config_entity_id going forward. So I plan to test this by removing the config_entitiy_id from being returned in the device_info property.

Will try it out once I setup a dev environment. Probably will reveal more errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants