Hello,
I am creating a custom component that builds a set of simulated sensors. Im trying to represent each sensor as a device that consists of two entities, the sensor itself and a battery.
Now im able to use my custom component to create a series of binary sensors… no problem there. They show up in the UI under entities in the configuration tab.
I also added code to build devices using the function device_registry.async_get_or_create().
Here’s the code im using:
device_registry.async_get_or_create(
config_entry_id=unique_id,
identifiers={(unique_id)},
manufacturer="Company",
name=str(device_name),
model="Simulated",
sw_version="0.1",
)
This code is in fact creating a device. I can see it in the .storage/core.device_registry file. However for some reason, these devices get created and they seem to be immediately deleted. In the core.device_registry file it shows as a deleted device:
{
"data": {
"deleted_devices": [
{
"config_entries": [
"binary_sensor.lvrm_door"
],
"connections": [],
"id": "5fd4c8109e8643b799fa79fab49e22d2",
"identifiers": [
"binary_sensor.lvrm_door"
]
},
TRUNCATED
My only wild guess is that there is some call that maybe updates the device and realizes there is no matching config_entry for these devices and they get deleted.
I may be in over my head here but does anyone have any idea why this is happening?
Thanks
Tom