Closed StellaeAlis closed 1 year ago
Hi @KianaOtter Thanks for reporting, I'll check this.
Actually using multiple SHCs is not yet supported. When extending the entities unique_id this would make all existing entities invalid, which would be a breaking change for all users. I'll think on another solution.
Thanks!
Wouldn't it be possible to just catch the exception and add a UUID or something only when it occurs? That way it wouldn't break currently working deployments.
Same here with the HACS version of Bosch SHC (using HACS version due missing features like smoke, alarm, movenment sensor etc in official version). The Smart Plug (the big one) I have 3. Will create issue after vacation.
Logger: homeassistant
Source: custom_components/bosch_shc/switch.py:219
Integration: Bosch SHC ([documentation](https://github.com/tschamm/boschshc-hass/blob/master/README.md), [issues](https://github.com/tschamm/boschshc-hass/issues))
First occurred: 15:19:15 (2 occurrences)
Last logged: 15:20:43
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 520, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 970, in state
if (is_on := self.is_on) is None:
File "/config/custom_components/bosch_shc/switch.py", line 219, in is_on
return self._device.routing.name == "ENABLED"
File "/usr/local/lib/python3.10/site-packages/boschshcpy/models_impl.py", line 107, in routing
return self._routing_service.value
AttributeError: 'NoneType' object has no attribute 'value'
and
Logger: homeassistant.components.switch
Source: custom_components/bosch_shc/switch.py:219
Integration: Switch ([documentation](https://www.home-assistant.io/integrations/switch), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+switch%22))
First occurred: 15:16:19 (2 occurrences)
Last logged: 15:16:19
Error adding entities for domain switch with platform bosch_shc
Error while setting up bosch_shc platform for switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 691, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 777, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 970, in state
if (is_on := self.is_on) is None:
File "/config/custom_components/bosch_shc/switch.py", line 219, in is_on
return self._device.routing.name == "ENABLED"
File "/usr/local/lib/python3.10/site-packages/boschshcpy/models_impl.py", line 107, in routing
return self._routing_service.value
AttributeError: 'NoneType' object has no attribute 'value'
Oh sorry my bad, commented on the wrong tread.
@HAuser2019: Please create a new issue. Can you also provide which kind of device (SmartPlug / PSM, SmartPlugCompact / PLUG_COMPACT, ...) is failing to provide the routing service?
Thank you for the update!
The devices and entities show up in both controllers now. Unfortunately, the devices and entities seem to be the same. Clicking on them in either the lower or upper apartments controller brings up the one from the lower apartment only. Changing the entity IDs or the area manually changes the value for the device in both controllers.
Even the related tab of the entity has both integrations listed.
Maybe both entities had the duplicate entries in the registry before we applied the new uid format. If you delete both config entries and reconfigure them again, I assume it should work.
If this doesn’t work, please share the content of the core.entity_registry
, which is located in ha-config/.storage/
.
I don’t have another second SHC for testing at home, so debugging is tricky.
I already fully set up one of the controllers, so I tried to only delete the other one in the hopes it would work anyway. Unfortunately, this did not work, and the devices are still combined. The way I deleted the controller is through the UI, integrations, and delete. Is that what you meant by "delete both config entries"?
Since it didn't work with only deleting one configuration, I'll delete both again once you've confirmed that this is actually the way to entirely remove the configurations.
I also looked into the core.entity_registry
file, and every entity shows up correctly. Each with its own unique ID and everything. The problem seems to be with the devices themselves. I just took another look at the UI, and all entities show up correctly. It's just the devices that are combined for both controllers.
Yes exactly, delete both controllers via the UI. Then do a restart of HA and add the two SHCs again. What would help: please paste the two entity entries of the SmokeDetectionSystem here. They should not have the same unique id anymore.
@KianaOtter Maybe wait with deleting both controllers. I just found two links which may be related to your issue. https://community.home-assistant.io/t/one-device-multiple-integrations/358767/3 https://developers.home-assistant.io/docs/device_registry_index/#defining-devices I'll read through and give feedback after.
Maybe the reason is that I create the same device ID for multiple entities (all entites which does not provide a unique serial number).
Can you paste the entity entries of the SmokeDetectionSystem (should be two of them) from ha-config/.storage/core.entity_registry
. And please also paste the device entry of the SmokeDetectionSystem (one or two, I guess only one) from ha-config/.storage/core.device_registry
.
Here are the entries you wanted. As you guessed, there's only one device entry.
core.entity_registry
:
{
"area_id": null,
"capabilities": null,
"config_entry_id": "9451322b736815a851d364073f7457c3",
"device_class": null,
"device_id": "ddf823d9d8e88925866d01430b694951",
"disabled_by": null,
"entity_category": null,
"entity_id": "binary_sensor.loap_smokedetectionsystem",
"hidden_by": null,
"icon": null,
"id": "fa9a739525143ec202d82522d01ff404",
"has_entity_name": false,
"name": "Smoke Detection System",
"options": {},
"original_device_class": "smoke",
"original_icon": "mdi:smoke-detector",
"original_name": "-SmokeDetectionSystem-",
"platform": "bosch_shc",
"supported_features": 0,
"unique_id": "64-da-a0-10-fd-28_smokeDetectionSystem",
"unit_of_measurement": null
},
{
"area_id": null,
"capabilities": null,
"config_entry_id": "7c4a2e013ef332093bde4015a8e5cbac",
"device_class": null,
"device_id": "ddf823d9d8e88925866d01430b694951",
"disabled_by": null,
"entity_category": null,
"entity_id": "binary_sensor.smokedetectionsystem",
"hidden_by": null,
"icon": null,
"id": "4f61539c62ea83abd31dcd6b792d986e",
"has_entity_name": false,
"name": null,
"options": {},
"original_device_class": "smoke",
"original_icon": "mdi:smoke-detector",
"original_name": "-SmokeDetectionSystem-",
"platform": "bosch_shc",
"supported_features": 0,
"unique_id": "64-da-a0-11-21-25_smokeDetectionSystem",
"unit_of_measurement": null
},
core.device_registry
:
{
"config_entries": [
"9451322b736815a851d364073f7457c3",
"7c4a2e013ef332093bde4015a8e5cbac"
],
"connections": [],
"identifiers": [
[
"bosch_shc",
"smokeDetectionSystem"
]
],
"manufacturer": "BOSCH",
"model": "SMOKE_DETECTION_SYSTEM",
"name": "-SmokeDetectionSystem-",
"sw_version": null,
"hw_version": null,
"entry_type": null,
"id": "ddf823d9d8e88925866d01430b694951",
"via_device_id": "9b403fc3e78ac1006796139e8ceee4ad",
"area_id": "loap",
"name_by_user": "Smoke Detection System",
"disabled_by": null,
"configuration_url": null
}
Fixed in 88fa50c817d5d58b03cedfa6abb7d1a8a1a8f73e, shipped with version 0.4.42
Hello, I recently installed the latest update (0.4.74) and I noticed this error in the logs every time I restarted:
I have 55 devices - but it only affects these two devices.
Is there a workaround how I can fix this or is there actually a bug?
2023-12-15 08:04:43.478 ERROR (MainThread) [homeassistant.components.switch] Platform bosch_shc does not generate unique IDs. ID 64-da-a0-40-05-d8_hdm:ZigBee:c4988600000b9f79 already exists - ignoring switch.kellertuer 2023-12-15 08:04:43.479 ERROR (MainThread) [homeassistant.components.switch] Platform bosch_shc does not generate unique IDs. ID 64-da-a0-40-05-d8_hdm:ZigBee:c4988600000bdbb9 already exists - ignoring switch.terrassentuer
Interestingly, I have several door/window sensors - but these two are selected as "door sensors". Could this be the problem? Can I somehow temporarily remove them from HA so that they are read in again when I restart?
Greetings Matthias
Hi,
Since my house has two apartments and the walls are too thick for the signal to reach both of them, I'm using two separate Bosch Smart-Home-Controllers. Until recently, I've handled this by having the lower apartments controller on an old phone, but I wanted to change this with HA. I started by using the official HA plugin, but it doesn't support the "Room Climate" control, so I switched to this plugin.
Some of these rooms have/had the same name: Kitchen, Living room, Bedroom, ... and these rooms are not showing up on the second controller in HA. Everything else (radiator thermostat, window contacts, water alarm, smoke alarm), except the IDS, smoke detection system, and the few rooms, show up and work normally.
I already changed the room names in the Bosch smart home app and added a unique identifier to the entity IDs of the lower apartments entities. After that, I removed the upper apartments integration and readded it, but the devices mentioned above are still missing.
The logs of HA show the following entries:
Best regards, Kiana