# Home Assistant MQTT Dashboard for slide

This guide adds a Home Assistant dashboard to control `slide` via MQTT (play/pause/next, plus Immich filters).

Default MQTT topics used by `slide`:

- Control: `slide/control`
- Immich control: `slide/immich`

If you changed topics in your `slide` config, update the YAML below to match.

---

## 1) Helpers

Add these helpers in `configuration.yaml` (or your helpers include file):

```yaml
input_text:
  slide_album_id:
    name: Slide Album ID
  slide_person_id:
    name: Slide Person ID
  slide_user_id:
    name: Slide User ID
  slide_extensions:
    name: Slide Extensions (csv)
    initial: "jpg,jpeg,png"
  slide_refresh_seconds:
    name: Slide Refresh Seconds
    initial: "300"

input_select:
  slide_size:
    name: Slide Size
    options:
      - fullsize
      - preview
      - thumbnail
      - original
    initial: fullsize
  slide_order:
    name: Slide Order
    options:
      - desc
      - asc
    initial: desc
```

---

## 2) Scripts

Add these scripts in `scripts.yaml`:

```yaml
slide_mqtt_play:
  alias: Slide Play
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/control
        payload: "play"

slide_mqtt_pause:
  alias: Slide Pause
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/control
        payload: "pause"

slide_mqtt_next:
  alias: Slide Next Image
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/control
        payload: "next"

slide_mqtt_next_folder:
  alias: Slide Next Folder
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/control
        payload: "next-folder"

slide_mqtt_restart:
  alias: Slide Restart
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/control
        payload: "restart"

slide_mqtt_reset_filters:
  alias: Slide Reset Filters
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/immich
        payload: "reset"

slide_mqtt_set_album:
  alias: Slide Set Album
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/immich
        payload: "album:{{ states('input_text.slide_album_id') }}"

slide_mqtt_set_person:
  alias: Slide Set Person
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/immich
        payload: "person:{{ states('input_text.slide_person_id') }}"

slide_mqtt_set_user:
  alias: Slide Set User
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/immich
        payload: "user:{{ states('input_text.slide_user_id') }}"

slide_mqtt_set_extensions:
  alias: Slide Set Extensions
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/immich
        payload: "extensions:{{ states('input_text.slide_extensions') }}"

slide_mqtt_set_refresh:
  alias: Slide Set Refresh Seconds
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/immich
        payload: "refreshSeconds:{{ states('input_text.slide_refresh_seconds') }}"

slide_mqtt_set_size:
  alias: Slide Set Size
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/immich
        payload: "size:{{ states('input_select.slide_size') }}"

slide_mqtt_set_order:
  alias: Slide Set Order
  sequence:
    - service: mqtt.publish
      data:
        topic: slide/immich
        payload: "order:{{ states('input_select.slide_order') }}"
```

---

## 3) Lovelace Dashboard

Add this view in `ui-lovelace.yaml` (or a raw YAML dashboard):

```yaml
title: Slide
views:
  - title: Slide Control
    path: slide
    icon: mdi:image-frame
    cards:
      - type: grid
        columns: 3
        cards:
          - type: button
            name: Play
            icon: mdi:play
            tap_action:
              action: call-service
              service: script.slide_mqtt_play
          - type: button
            name: Pause
            icon: mdi:pause
            tap_action:
              action: call-service
              service: script.slide_mqtt_pause
          - type: button
            name: Next
            icon: mdi:skip-next
            tap_action:
              action: call-service
              service: script.slide_mqtt_next
          - type: button
            name: Next Folder
            icon: mdi:folder-arrow-right
            tap_action:
              action: call-service
              service: script.slide_mqtt_next_folder
          - type: button
            name: Restart
            icon: mdi:restart
            tap_action:
              action: call-service
              service: script.slide_mqtt_restart
          - type: button
            name: Reset Filters
            icon: mdi:filter-remove
            tap_action:
              action: call-service
              service: script.slide_mqtt_reset_filters

      - type: entities
        title: Immich Filters
        entities:
          - entity: input_text.slide_album_id
          - entity: input_text.slide_person_id
          - entity: input_text.slide_user_id
          - entity: input_text.slide_extensions
          - entity: input_text.slide_refresh_seconds
          - entity: input_select.slide_size
          - entity: input_select.slide_order

      - type: grid
        columns: 3
        cards:
          - type: button
            name: Set Album
            icon: mdi:album
            tap_action:
              action: call-service
              service: script.slide_mqtt_set_album
          - type: button
            name: Set Person
            icon: mdi:account
            tap_action:
              action: call-service
              service: script.slide_mqtt_set_person
          - type: button
            name: Set User
            icon: mdi:account-cog
            tap_action:
              action: call-service
              service: script.slide_mqtt_set_user
          - type: button
            name: Set Extensions
            icon: mdi:file-image
            tap_action:
              action: call-service
              service: script.slide_mqtt_set_extensions
          - type: button
            name: Set Refresh
            icon: mdi:clock-sync
            tap_action:
              action: call-service
              service: script.slide_mqtt_set_refresh
          - type: button
            name: Set Size/Order
            icon: mdi:image-size-select-large
            tap_action:
              action: call-service
              service: script.slide_mqtt_set_size
```

---

## Notes

- If you changed the MQTT topics in `slide`’s config, update all `topic:` entries to match.
- `extensions` filters by file extension (e.g., `jpg,jpeg,png`) to avoid RAW/HEIC if your display environment can’t decode them.
- `refreshSeconds` controls how often `slide` refreshes the Immich asset list.
