Integrations

Threshold

Spook adds an action to the threshold helper that changes its lower limit, upper limit and hysteresis, so an automation can move the limits without a trip to the helper's options.

The threshold helper watches a sensor and turns on when its value crosses a limit: above an upper limit, below a lower limit, or between the two. Humidity in the bathroom above 70%, the freezer warmer than -15 °C, a battery below 20%.

The limits are set in the helper's options, and only there. An automation cannot move them: not a higher humidity limit at night when the shower runs anyway, not a limit you set with a slider on your dashboard. People have asked for that since 2017.

Spook adds an action for that: set the limits.

Actions

Spook adds one action to the threshold integration. You find it wherever you add an action, marked with a 👻.

Set limits

Changes the lower limit, the upper limit or the hysteresis of one or more threshold helpers, like the options of the helper do. What you leave out stays as it is, the sensor it watches too.

The change goes through the helper's own options, so Home Assistant checks it the same way it checks what you fill in there. Then Home Assistant reloads the helper, as it does after you save its options. The action returns once the helper is reloaded, so the next step of your automation already sees the new limits. A helper that already has the limits you give is left alone, without a reload.

A threshold can have only a lower limit, only an upper limit, or both. To take one away, give it null in YAML: lower: null leaves the helper with only its upper limit. Taking away the only limit a helper has is refused: a threshold without any limit has nothing to compare with.

Every entity is checked before the first helper changes. An entity that is not a threshold helper, or one set up in YAML, is refused with an error, and nothing changes. The helpers change one at a time, in the order you give them. When Home Assistant refuses the new limits of one, like taking away its only limit, the action stops with an error that names that helper. The helpers before it in the list did change; the ones after it did not.

Run by hand, the action takes an administrator, like the options of a helper do. Your automations can always run it. So can your scripts, unless a user who is not an administrator starts one.

How to use it

  1. Open the automation or script that should change the limits, and select Add action.
  2. Search for set limits, and select Threshold: Set limits 👻.
  3. Choose the threshold helpers.
  4. Turn on the limits you want to change, and fill in the new values.
  5. Select Save.

To take a limit away, switch the action to YAML with the three dots menu, and set that limit to null.

Missing something here?

An action, an entity or a repair this integration should have? Say so. Stuck, or found a bug? There is help.