diff --git a/immich_frame/CHANGELOG.md b/immich_frame/CHANGELOG.md index a060ae9f5..c8658b241 100644 --- a/immich_frame/CHANGELOG.md +++ b/immich_frame/CHANGELOG.md @@ -1,4 +1,9 @@ +## 1.0.32.0-2 (2026-03-16) +- Added multi-account support: configure multiple Immich accounts via the `Accounts` option in the addon configuration +- `ApiKey` and `ImmichServerUrl` are now optional when using the `Accounts` list +- Settings.yaml is now auto-generated from addon options for reliable multi-account configuration + ## 1.0.32.0 (2026-03-07) - Update to latest version from immichFrame/ImmichFrame (changelog : https://github.com/immichFrame/ImmichFrame/releases) diff --git a/immich_frame/README.md b/immich_frame/README.md index cdb78d3aa..7ef9ec464 100644 --- a/immich_frame/README.md +++ b/immich_frame/README.md @@ -41,11 +41,12 @@ Webui can be found at `:8171`. | Option | Type | Default | Description | |--------|------|---------|-------------| -| `ImmichServerUrl` | str | **Required** | URL of your Immich server (e.g., `http://homeassistant:3001`) | -| `ApiKey` | str | **Required** | Immich API key for authentication | +| `ImmichServerUrl` | str | | URL of your Immich server (e.g., `http://homeassistant:3001`). Used for single-account setup. | +| `ApiKey` | str | | Immich API key for authentication. Used for single-account setup. | +| `Accounts` | list | `[]` | List of Immich accounts for multi-account support. Each entry requires `ImmichServerUrl` and `ApiKey`. | | `TZ` | str | | Timezone (e.g., `Europe/London`) | -### Example Configuration +### Single Account Example ```yaml ImmichServerUrl: "http://homeassistant:3001" @@ -53,6 +54,23 @@ ApiKey: "your-immich-api-key-here" TZ: "Europe/London" ``` +### Multi-Account Example + +To display photos from multiple Immich accounts (e.g., you and your partner), use the `Accounts` list: + +```yaml +Accounts: + - ImmichServerUrl: "http://homeassistant:3001" + ApiKey: "api-key-for-user-1" + - ImmichServerUrl: "http://homeassistant:3001" + ApiKey: "api-key-for-user-2" +TZ: "Europe/London" +``` + +When using the `Accounts` list, the `ApiKey` and `ImmichServerUrl` top-level options are not needed. Images will be drawn from each account proportionally based on the total number of images present in each account. + +For more configuration options, see the [ImmichFrame documentation](https://immichframe.dev/docs/getting-started/configuration). + ### Getting Your Immich API Key 1. Open your Immich web interface diff --git a/immich_frame/config.yaml b/immich_frame/config.yaml index 9721d9ddd..8a392ed45 100644 --- a/immich_frame/config.yaml +++ b/immich_frame/config.yaml @@ -9,19 +9,23 @@ map: - addon_config:rw name: Immich Frame options: + Accounts: [] env_vars: [] ports: 8080/tcp: 8171 ports_description: 8080/tcp: Web UI port schema: + Accounts: + - ImmichServerUrl: str + ApiKey: str env_vars: - name: match(^[A-Za-z0-9_]+$) value: str? - ApiKey: str - ImmichServerUrl: str + ApiKey: str? + ImmichServerUrl: str? TZ: str? slug: immich_frame url: https://github.com/alexbelgium/hassio-addons -version: "1.0.32.0" +version: "1.0.32.0-2" webui: http://[HOST]:[PORT:8080] diff --git a/immich_frame/rootfs/etc/cont-init.d/99-run.sh b/immich_frame/rootfs/etc/cont-init.d/99-run.sh index 7abf0e780..1c58b40bd 100755 --- a/immich_frame/rootfs/etc/cont-init.d/99-run.sh +++ b/immich_frame/rootfs/etc/cont-init.d/99-run.sh @@ -3,9 +3,53 @@ bashio::log.info "Starting Immich Frame" mkdir -p /config/Config -if [ -f /app/Config ]; then - rm -r /app/Config +if [ -d /app/Config ] && [ ! -L /app/Config ]; then + cp -n /app/Config/* /config/Config/ 2>/dev/null || true + rm -rf /app/Config +fi +if [ ! -e /app/Config ]; then + ln -sf /config/Config /app/Config fi -ln -sf /app/Config /config/Config +# Generate Settings.yaml from addon options for multi-account support +SETTINGS_FILE="/config/Config/Settings.yaml" +ACCOUNT_COUNT=$(jq '.Accounts // [] | length' /data/options.json 2>/dev/null || echo 0) + +if [ "$ACCOUNT_COUNT" -gt 0 ]; then + bashio::log.info "Configuring ${ACCOUNT_COUNT} account(s) from Accounts list" + { + echo "Accounts:" + for i in $(seq 0 $((ACCOUNT_COUNT - 1))); do + SERVER_URL=$(jq -r ".Accounts[${i}].ImmichServerUrl" /data/options.json) + API_KEY=$(jq -r ".Accounts[${i}].ApiKey" /data/options.json) + # Escape single quotes for YAML single-quoted strings + SERVER_URL="${SERVER_URL//\'/\'\'}" + API_KEY="${API_KEY//\'/\'\'}" + echo " - ImmichServerUrl: '${SERVER_URL}'" + echo " ApiKey: '${API_KEY}'" + bashio::log.info " Account $((i + 1)): ${SERVER_URL}" + done + } > "${SETTINGS_FILE}" + chmod 600 "${SETTINGS_FILE}" + bashio::log.info "Settings.yaml generated at ${SETTINGS_FILE}" +elif bashio::config.has_value 'ApiKey' && bashio::config.has_value 'ImmichServerUrl'; then + bashio::log.info "Using single account configuration" + SERVER_URL=$(bashio::config 'ImmichServerUrl') + API_KEY=$(bashio::config 'ApiKey') + # Escape single quotes for YAML single-quoted strings + SERVER_URL="${SERVER_URL//\'/\'\'}" + API_KEY="${API_KEY//\'/\'\'}" + { + echo "Accounts:" + echo " - ImmichServerUrl: '${SERVER_URL}'" + echo " ApiKey: '${API_KEY}'" + } > "${SETTINGS_FILE}" + chmod 600 "${SETTINGS_FILE}" + bashio::log.info "Settings.yaml generated at ${SETTINGS_FILE}" +else + bashio::log.fatal "No accounts configured! Set either 'Accounts' list or both 'ApiKey' and 'ImmichServerUrl'" + exit 1 +fi + +export IMMICHFRAME_CONFIG_PATH=/config/Config exec dotnet ImmichFrame.WebApi.dll