Add Tuya debug logging for new devices (#150091)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
epenet
2025-08-06 11:23:34 +02:00
committed by GitHub
parent 863e2074b6
commit 0db23b0da6

View File

@@ -153,6 +153,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: TuyaConfigEntry) -> bool
# Register known device IDs
device_registry = dr.async_get(hass)
for device in manager.device_map.values():
LOGGER.debug(
"Register device %s: %s (function: %s, status range: %s)",
device.id,
device.status,
device.function,
device.status_range,
)
device_registry.async_get_or_create(
config_entry_id=entry.entry_id,
identifiers={(DOMAIN, device.id)},
@@ -237,6 +244,14 @@ class DeviceListener(SharingDeviceListener):
# Ensure the device isn't present stale
self.hass.add_job(self.async_remove_device, device.id)
LOGGER.debug(
"Add device %s: %s (function: %s, status range: %s)",
device.id,
device.status,
device.function,
device.status_range,
)
dispatcher_send(self.hass, TUYA_DISCOVERY_NEW, [device.id])
def remove_device(self, device_id: str) -> None: