INNER CODE UNIT · Python

handle_record_stop

3dg1luk43/ha_washdata · custom_components/ha_washdata/__init__.py:1213

        async def handle_record_stop(call: ServiceCall) -> None:
            device_id = _require_str(call.data.get("device_id"), "device_id")
            registry = dr.async_get(hass)
            device = registry.async_get(device_id)
            if not device:
                raise ValueError("Device not found")
            entry_id = next(iter(device.config_entries), None)
            if not entry_id or entry_id not in hass.data[DOMAIN]:
                raise ValueError("Integration not loaded")

            manager = hass.data[DOMAIN][entry_id]
            await manager.async_stop_recording()

        hass.services.async_register(DOMAIN, "record_stop", handle_record_stop)

    # Register on-device ML training trigger (Stage 4, gated by ENABLE_ML_TRAINING)
    from .const import ENABLE_ML_TRAINING, SERVICE_TRIGGER_ML_TRAINING

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…