mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-31 05:06:57 +00:00
Add upload file action to immich integration (#39668)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
This commit is contained in:
parent
be62c0f5f7
commit
966445c01f
@ -28,7 +28,7 @@ You need to [obtain the API key](https://immich.app/docs/features/command-line-i
|
||||
|
||||
### API key permissions
|
||||
|
||||
For full functionality, enable the `album.read` permission when creating your API key. Without this permission, the media source integration will not work, but all monitoring sensors will continue to function normally.
|
||||
For full functionality, enable the `album.read` and the `asset.upload` permission when creating your API key. Without this permission, the media source integration will not work, but all monitoring sensors will continue to function normally.
|
||||
|
||||
{% include integrations/config_flow.md %}
|
||||
|
||||
@ -68,6 +68,52 @@ The following {% term sensors %} are created. For some of those the API key need
|
||||
|
||||
An {% term update %} entity is created to inform about a new available Immich server version (_requires Immich server v1.134.0_).
|
||||
|
||||
## Actions
|
||||
|
||||
### Upload file
|
||||
|
||||
This action allows you to upload a media file to your Immich instance. It takes the following arguments:
|
||||
|
||||
{% configuration_basic %}
|
||||
Immich instance:
|
||||
description: The config entry of the Immich instance where to upload the file.
|
||||
File:
|
||||
description: Use the [MediaSelector](/docs/blueprint/selectors/#media-selector) to define the file to be uploaded.
|
||||
keys:
|
||||
media_content_id:
|
||||
description: The [media source](/integrations/media_source) URL.
|
||||
media_content_type:
|
||||
description: The MIME type of the file to be uploaded.
|
||||
Album ID:
|
||||
description: The album in which the file should be placed after uploading. To get the album ID, open the Immich instance web UI in a browser and navigate to the corresponding album, the album ID can now be found in the URL `https://your-immich-instance/albums/<ALBUM-ID>`
|
||||
{% endconfiguration_basic %}
|
||||
|
||||
#### Example script
|
||||
|
||||
Take a snapshot of a camera entity via the [`camera.snapshot`](/integrations/camera/#action-snapshot) action, use the [local media](/integrations/media_source/#local-media) path to store the snapshot and upload it to the Immich instance in a specific album.
|
||||
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
sequence:
|
||||
- variables:
|
||||
file_name: camera.yourcamera_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg
|
||||
- action: camera.snapshot
|
||||
data:
|
||||
filename: "/media/{{ file_name }}"
|
||||
target:
|
||||
entity_id: camera.yourcamera
|
||||
- action: immich.upload_file
|
||||
data:
|
||||
config_entry_id: 01JVJ0RA387MWA938VE8HGXBMJ
|
||||
file:
|
||||
media_content_id: "media-source://media_source/local/{{ file_name }}",
|
||||
media_content_type: "image/jpeg",
|
||||
album_id: f2de0ede-d7d4-4db3-afe3-7288f4e65bb1
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
In any case, when reporting an issue, please enable [debug logging](/docs/configuration/troubleshooting/#debug-logs-and-diagnostics), restart the integration, and as soon as the issue re-occurs, stop the debug logging again (_download of debug log file will start automatically_). Further, if still possible, please also download the [diagnostics](/integrations/diagnostics/) data. If you have collected the debug log and the diagnostics data, provide them with the issue report.
|
||||
|
Loading…
x
Reference in New Issue
Block a user