Change add_devices to add_entities (#2041)

This commit is contained in:
Jan-Philipp Benecke 2024-01-18 15:36:29 +01:00 committed by GitHub
parent f53bdd6cb9
commit 29cbd4f551
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -117,7 +117,7 @@ hass.async_create_task(
For a platform to support config entries, it will need to add a setup entry method ([example](https://github.com/home-assistant/core/blob/0.68.0/homeassistant/components/light/hue.py#L60)):
```python
async def async_setup_entry(hass, config_entry, async_add_devices):
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up entry."""
```

View File

@ -53,7 +53,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
### 3. Setup Platform
1. Verify that the passed in configuration (user/pass/host etc.) works.
2. Group your calls to `add_devices` if possible.
2. Group your calls to `add_entities if possible.
3. If the platform adds extra services, the format should be `<domain of your integration>.<service name>`. So if your integration's domain is "awesome_sauce" and you are making a light platform, you would register services under the `awesome_sauce` domain. Make sure that your services [verify permissions](auth_permissions.md#checking-permissions).
### 4. Entity

View File

@ -30,7 +30,7 @@ Depending on what you're writing, there are different ways the `hass` object is
Passed into `setup(hass, config)` or `async_setup(hass, config)`.
**Platform**
Passed into `setup_platform(hass, config, add_devices, discovery_info=None)` or `async_setup_platform(hass, config, async_add_devices, discovery_info=None)`.
Passed into `setup_platform(hass, config, add_entities, discovery_info=None)` or `async_setup_platform(hass, config, async_add_entities, discovery_info=None)`.
**Entity**
Available as `self.hass` once the entity has been added via the `add_devices` callback inside a platform.
Available as `self.hass` once the entity has been added via the `add_entities` callback inside a platform.