-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Description
After upgrading to Home Assistant 2025.11 (released November 5, 2025), the client.get_domains() method fails with a Pydantic validation error. This appears to be caused by changes in the Home Assistant REST API response format where some services are missing the required name field.
Environment
- homeassistant-api version: 5.0.2
- Home Assistant version: 2025.11.0
- Python version: 3.13
Steps to Reproduce
from homeassistant_api import Client
ip = "..."
token = "..."
client = Client(ip, token, cache_session=False)
# This now fails with ValidationError
domains = client.get_domains()Error Message
Traceback (most recent call last):
File "<python-input-18>", line 1, in <module>
client.get_domains()
File "lib/python3.13/site-packages/homeassistant_api/rawclient.py", line 281, in get_domains
return {domain.domain_id: domain for domain in domains}
File "lib/python3.13/site-packages/homeassistant_api/rawclient.py", line 278, in <lambda>
lambda json: Domain.from_json(json, client=cast(Client, self)),
File "lib/python3.13/site-packages/homeassistant_api/models/domains.py", line 68, in from_json
domain._add_service(service_id, **data)
File "ib/python3.13/site-packages/homeassistant_api/models/domains.py", line 76, in _add_service
service_id: Service(
service_id=service_id,
domain=self,
**data,
)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Service
name
Field required [type=missing, input_value={'service_id': 'save_pers...vices={}), 'fields': {}}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.12/v/missing
Expected Behavior
The get_domains() method should successfully return a dictionary of all available domains and their services, which I use to access available fields and functions of my devices.
Actual Behavior
The method raises a ValidationError because the Pydantic Service model requires a name field that is apparently missing from some services in the Home Assistant 2025.11 REST API response.
Analysis
It appears that Home Assistant 2025.11 has changed the format of service definitions returned by the REST API. Some services (like save_persistent_states based on the error context) no longer include the name field that the library's Pydantic model expects.
This is likely related to the extensive automation editor improvements and API changes mentioned in the [2025.11 release notes](https://www.home-assistant.io/blog/2025/11/05/release-202511/).
Proposed Solution
The Service model in homeassistant_api/models/domains.py should be updated to make the name field optional, or provide a default value when it's missing from the API response. This would maintain backward compatibility while handling the new API format.
Workaround
None currently available. The get_domains() method is completely broken after upgrading Home Assistant to 2025.11.
Additional Context
- The
trigger_service()method still works correctly for controlling devices - Only the
get_domains()method appears to be affected - Other methods like
get_entity()appear to work when called with theentity_idkeyword argument