Source: https://spooly.eu/en/docs/home-assistant/actions

# Actions

All 9 actions need the permission to change. If it is missing, you get a message and Home Assistant offers to sign in again. After every action the integration fetches fresh data right away.

You pick the spool through its device, the slot and the maintenance task through their sensor. In the actions editor you choose from a list, in YAML the ID of the device goes in. [Examples](https://spooly.eu/en/docs/home-assistant/examples)

## `spooly.set_weight`

In the UI: Set weight

Sets the remaining weight. Give exactly one of the two weights.

| Field | Type | Meaning |
| --- | --- | --- |
| `device_id` | Device | The device of the spool. In the actions editor you pick it from a list. |
| `grams` | Number, optional | Filament without the spool, 0 to 20,000 g |
| `gross_grams` | Number, optional | Spool on the scale, 0 to 40,000 g. Needs a known tare. |

YAML:

```
action: spooly.set_weight
data:
  device_id: 9f2c4e7a1b3d5f60718293a4b5c6d7e8
  gross_grams: 742
```

## `spooly.refill`

In the UI: Refill

Adds grams to the remaining weight.

| Field | Type | Meaning |
| --- | --- | --- |
| `device_id` | Device | The device of the spool. In the actions editor you pick it from a list. |
| `grams` | Number | 1 to 20,000 g |

YAML:

```
action: spooly.refill
data:
  device_id: 9f2c4e7a1b3d5f60718293a4b5c6d7e8
  grams: 250
```

## `spooly.assign_slot`

In the UI: Assign to slot

Puts a spool into a slot. Works only with the slot autopilot active.

| Field | Type | Meaning |
| --- | --- | --- |
| `device_id` | Device | The device of the spool. In the actions editor you pick it from a list. |
| `slot` | Entity | The sensor of the slot |
| `confirm_color` | Yes/No, optional | Assign even if the printer reports a different color. Off by default. |

YAML:

```
action: spooly.assign_slot
data:
  device_id: 9f2c4e7a1b3d5f60718293a4b5c6d7e8
  slot: sensor.x1_carbon_von_tobi_1_2
  confirm_color: false
```

## `spooly.clear_slot`

In the UI: Empty slot

Removes the spool from a slot, it stays in Spooly. Works only with the slot autopilot active.

| Field | Type | Meaning |
| --- | --- | --- |
| `slot` | Entity | The sensor of the slot |

YAML:

```
action: spooly.clear_slot
data:
  slot: sensor.x1_carbon_von_tobi_1_2
```

## `spooly.move`

In the UI: Move

Moves a spool to a storage location, onto a place if you name one. Without a place it sits in the location without a place.

| Field | Type | Meaning |
| --- | --- | --- |
| `device_id` | Device | The device of the spool. In the actions editor you pick it from a list. |
| `location` | Text | Name of the storage location including the path, as `GET /locations` returns it, or its ID. For a place, add it as Spooly shows it: “Werkstatt · Trockenbox · Platz 1”. That way you can also reuse the `location` attribute of a spool. If two locations share a name, use the ID from `location_id`, also with “· Platz 1” after it. |

YAML:

```
action: spooly.move
data:
  device_id: 9f2c4e7a1b3d5f60718293a4b5c6d7e8
  location: "Schrank 01 · Fach vorne"
```

## `spooly.archive`

In the UI: Archive

Archives a spool. It leaves the active stock and is not deleted.

| Field | Type | Meaning |
| --- | --- | --- |
| `device_id` | Device | The device of the spool. In the actions editor you pick it from a list. |

YAML:

```
action: spooly.archive
data:
  device_id: 9f2c4e7a1b3d5f60718293a4b5c6d7e8
```

## `spooly.restore`

In the UI: Restore

Brings an archived spool back into the active stock. This only works while the device of the spool still exists in Home Assistant. If you deleted it after archiving (as the [data updates](https://spooly.eu/en/docs/home-assistant/data-updates#home-assistant-data-updates-neu) page suggests), restore the spool in the app.

| Field | Type | Meaning |
| --- | --- | --- |
| `device_id` | Device | The device of the archived spool |

YAML:

```
action: spooly.restore
data:
  device_id: 9f2c4e7a1b3d5f60718293a4b5c6d7e8
```

## `spooly.complete_maintenance`

In the UI: Maintenance done

Marks a maintenance task as done.

| Field | Type | Meaning |
| --- | --- | --- |
| `task` | Entity | The sensor of the task |
| `action` | Choice, optional | `replace` replaced, `clean` cleaned or `check` checked. Without a value Spooly uses the usual action of the task. |
| `notes` | Text, optional | Free text, Spooly saves it with the entry |

YAML:

```
action: spooly.complete_maintenance
data:
  task: sensor.x1_carbon_von_tobi_nozzle_0_4_mm
  action: replace
  notes: Neue Düse 0,4 mm
```

## `spooly.snooze_maintenance`

In the UI: Snooze maintenance

Postpones a maintenance task.

| Field | Type | Meaning |
| --- | --- | --- |
| `task` | Entity | The sensor of the task |
| `days` | Choice | 7, 14 or 30 |
| `reason` | Text, optional | Free text, Spooly saves it |

YAML:

```
action: spooly.snooze_maintenance
data:
  task: sensor.x1_carbon_von_tobi_nozzle_0_4_mm
  days: 14
  reason: Teil ist bestellt
```
