diff --git a/services.py b/services.py
index 8ce4c42..0786283 100644
--- a/services.py
+++ b/services.py
@@ -677,7 +677,7 @@ async def async_setup_services(  # noqa: C901
 
 async def async_cleanup_services( hass: HomeAssistant):
     """Cleanup all Huawei Solar service (if all config entries unloaded)"""
-    if len(hass.data[DOMAIN] == 1):
+    if len(hass.data[DOMAIN]) == 1:
         for service in ALL_SERVICES:
             if hass.services.has_service(DOMAIN, service):
-                hass.services.async_remove(DOMAIN, service)
\ No newline at end of file
+                hass.services.async_remove(DOMAIN, service)