---
title: "Generic hygrostat"
description: "Spook adds an action to the generic hygrostat helper that changes its dry and wet tolerance, so an automation can widen or narrow them without a trip to the helper's options."
canonical_url: "https://spook.boo/generic-hygrostat"
---
# Generic hygrostat

> Spook adds an action to the generic hygrostat helper that changes its dry and wet tolerance, so an automation can widen or narrow them without a trip to the helper's options.

The generic hygrostat helper turns a humidifier or a dehumidifier on and off, by a humidity sensor and a target humidity. Any switch can be the device: a smart plug on a humidifier in the bedroom, a relay on the dehumidifier in the basement.

Two tolerances keep it from switching all the time. The dry tolerance is how far the humidity may drop below the target, the wet tolerance how far it may rise above it, before the hygrostat switches. Those are set in the helper's options, and only there. An automation cannot change them: not more slack at night, when every click of the plug wakes somebody up.

Spook adds an action for that: set tolerances.

## Actions

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

### Set tolerances

Changes the dry tolerance, the wet tolerance or both of one or more generic hygrostats, like the options of the helper do. What you leave out stays as it is, the sensor and the switch 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 hygrostat, as it does after you save its options. The action returns once the hygrostat is reloaded, so the next step of your automation already works with the new tolerances. A hygrostat that already has the tolerances you give is left alone, without a reload.

For a humidifier, the dry tolerance is how far the humidity drops below the target before it turns on, and the wet tolerance how far it rises above the target before it turns off. For a dehumidifier, it is the other way around.

Every entity is checked before the first hygrostat changes. An entity that is not a generic hygrostat, or one set up in YAML, is refused with an error, and nothing changes. The hygrostats change one at a time, in the order you give them.

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 tolerances, and select **Add action**.
2. Search for **set tolerances**, and select **Generic hygrostat: Set tolerances 👻**.
3. Choose the generic hygrostats.
4. Turn on the tolerances you want to change, and fill in the new values.
5. Select **Save**.

**Technical details**

| Action properties |
| --- |
| Action | Generic hygrostat: Set tolerances 👻 |
| Action name | `generic_hygrostat.set_tolerances` |
| Action targets | No targets |
| Action response | No |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=generic_hygrostat.set_tolerances) [![Open your Home Assistant instance and show the Actions tool with a specific action selected.](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=generic_hygrostat.set_tolerances) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `entity_id` | string or list | Yes | `humidifier.bedroom` |
| `dry_tolerance` | float | No | `3` |
| `wet_tolerance` | float | No | `3` |

Give at least one of `dry_tolerance` and `wet_tolerance`. Both are percentages, from 0 to 100. Neither can be taken away; set it to `0` for none.

**Example actions in YAML**

Give the humidifier more slack on the dry side:

```yaml
action: generic_hygrostat.set_tolerances
data:
  entity_id: humidifier.bedroom
  dry_tolerance: 5
```

Change both:

```yaml
action: generic_hygrostat.set_tolerances
data:
  entity_id: humidifier.bedroom
  dry_tolerance: 2
  wet_tolerance: 4
```

The humidifier in the bedroom keeps the humidity close to the target during the day, within 2%. At night, every time its plug clicks on, somebody wakes up. From 23:00 until 07:00 it gets 5% on either side, so it switches a lot less:

```yaml
alias: Bedroom humidifier quieter at night
triggers:
  - trigger: time
    at: "23:00:00"
    id: night
  - trigger: time
    at: "07:00:00"
    id: day
actions:
  - action: generic_hygrostat.set_tolerances
    data:
      entity_id: humidifier.bedroom
      dry_tolerance: "{{ 5 if trigger.id == 'night' else 2 }}"
      wet_tolerance: "{{ 5 if trigger.id == 'night' else 2 }}"
```

**Known limitations**

- Every change reloads the hygrostat. While it reloads, its state is `unavailable` for a moment. Do not drive the tolerances from something that changes every few seconds.
- Right after the reload, the hygrostat compares the humidity with the target without its tolerances, as Home Assistant does whenever a generic hygrostat starts. So it can switch the device on or off once, even with the humidity within the new tolerances. From the next reading of the sensor, the tolerances count.
- Generic hygrostats set up in YAML are refused. Their tolerances are in your configuration: change them there.


## Sitemap

See the full [sitemap](https://spook.boo/sitemap.md) for all pages.
