Simple High/Low Threshold Actions

I frequently find myself turning things on/off based on low and high thresholds, so I made this blueprint so I can be extra lazy in setting them up. (And hopefully making it so my end users can be a bit self sufficient if they want to tune their systems.)

Example use cases:

  • Turn the basement dehumidifier on when humidity is above 60, and off when it’s below 50
  • Turn the bathroom exhaust fan on/off based on humidity (there’s dedicated blueprints for this if you want fancier features like timers)
  • Turn on the AC in my office-cum-MDF when temp is high and off when it’s low
  • Turn on the air purifier when PM2.5 exceeds a threshold, then off when it’s safe
  • Do something when CO2 is too high
  • etc

This is consciously and explicitly a barebones and simple automation. Want something fancier, like averaged sensors or setpoints that can be updated via other automations? Use helpers.

TODO:

  • Expand beyond sensors as inputs and switches as outputs
  • Figure out the real reason why kids love cinnamon toast crunch

EXAMPLE SCREENSHOT:

THE THING:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Simple Threshold Actions
  description: |
    Do something when a value is high, and another something when it's low.
    https://community.home-assistant.io/t/simple-high-low-threshold-actions/906559
  domain: automation
  input:
    triggering_entity:
      name: Triggering Entity
      description: The thing that we're watching (temp, humidity, CO2, etc.)
      selector:
        entity:
          filter:
            - domain: sensor
            - domain: input_number
            - domain: number
    high_threshold:
      name: High Threshold
      description: The level above which we'll run the high threshold action
    low_threshold:
      name: Low Threshold
      description: The level below which we'll run the low threshold action
    additional_conditions:
      name: Additional Conditions (Optional)
      description: A list of extra conditions that must be true for either action to run
      selector:
        condition:
      default: []
    high_threshold_action:
      name: High Threshold Action (Optional)
      description: What to do at/above the high threshold
      selector:
        action:
      default: []
    low_threshold_action:
      name: Low Threshold Action (Optional)
      description: What to do at/below the low threshold
      selector:
        action:
      default: []

triggers:
  - trigger: numeric_state
    entity_id:
      - !input triggering_entity
    above: !input high_threshold
    id: trigger_high
  - trigger: numeric_state
    entity_id:
      - !input triggering_entity
    id: trigger_low
    below: !input low_threshold

condition: !input additional_conditions

actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - trigger_high
        sequence: !input high_threshold_action
      - conditions:
          - condition: trigger
            id:
              - trigger_low
        sequence: !input low_threshold_action
mode: single

Hi @Tol

Nice script :slight_smile: Would you mind to modify to make it possible to do this within in time span. So you can chose between what time of the day you want to do the treshold actions.

Thanks

I’ll do ya one better. I’ve added a spot to put in whatever condition/s you’d like! Time, place, BTC price… the sky is the limit.

Nice thank you :+1: