Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add services docs for image entity #31327

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions source/_integrations/image.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,37 @@ In addition, the entity can have the following states:

- **Unavailable**: The entity is currently unavailable.
- **Unknown**: The state is not yet known.

### Actions

Once loaded, the `image` platform will expose services that can be called to perform various actions.

Available services: `snapshot`.

#### Action `snapshot`

Take a snapshot from an image.

| Data attribute | Optional | Description |
| -------------- | -------- | ------------------------------------------------------------------------------ |
| `entity_id` | no | Name(s) of entities to create a snapshot from, e.g., `image.my_image`. |
| `filename` | no | Snapshot file name |

The path part of `filename` must be an entry in the `allowlist_external_dirs` in your [`homeassistant:`](/docs/configuration/basic/) section of your `configuration.yaml` file.

For example, the following action in an automation would take a snapshot from "yourimage" and save it to /tmp with a timestamped filename.

{% raw %}

```yaml
actions:
- variables:
entity_id: image.yourimage # Store the camera entity_id in a variable for reuse
- action: image.snapshot
target:
entity_id: '{{ entity_id }}'
data:
filename: '/tmp/{{ entity_id }}_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg'
```

{% endraw %}