Home Assistant Automation Not Triggering? Fixing the “Numeric State” Trap

If you have ever set up a heating or cooling automation in Home Assistant only to find it ignoring your temperature sensors, you aren’t alone.

A common scenario involves using a numeric_state trigger to turn a device (like a Shelly Pro 4PM) on or off based on temperature readings. You set it to turn off above 25°C and on below 23°C. You see your sensor reporting 28°C, but your heating stays on.

Why does this happen, and how do you fix it? Here is the explanation and the solution.

The Problem: It’s All About “Crossing the Line”

The root cause usually lies in how the numeric_state trigger works.

In Home Assistant, a numeric_state trigger with an above: 25 setting only fires when the value crosses from below 25 to above 25.

  • Scenario: You write the automation when the room is already 27°C.
  • Result: Because the temperature was already above the threshold, the “crossing” event never happens. The automation sits waiting for the temperature to drop below 25 and rise again before it will ever trigger.

The Solution: Add Startup Triggers and Conditions

To ensure your automation evaluates the temperature immediately upon restarting Home Assistant or reloading your automations, you need to add two things:

  1. Extra Triggers: To force the automation to check the state when Home Assistant starts or when you edit automations.
  2. Conditions: To confirm the temperature is actually in the range you care about (since the startup trigger doesn’t check the temperature itself).

Step 1: Update Your YAML

You don’t need to delete your existing work. You just need to add to it. Here is how the corrected automation looks for turning the heating OFF.

Before: The automation only listened for the temperature change.

After: We add triggers for homeassistant.start and automation_reloaded, and we mirror the trigger logic in the conditions section.

alias: Street bedroom heating off
description: Turn off the heating if the temperature is above 25 celsius
triggers:
  # The original trigger: works when temp crosses the line
  - trigger: numeric_state
    entity_id:
      - sensor.shellyhtg3_84fce639d0d8_temperature
    above: 25

  # New triggers: ensure it checks when HA starts or reloads
  - trigger: homeassistant
    event: start
  - trigger: event
    event_type: automation_reloaded

conditions:
  # The condition ensures we only run the action if it really is above 25
  - condition: numeric_state
    entity_id: sensor.shellyhtg3_84fce639d0d8_temperature
    above: 25

actions:
  - action: switch.turn_off
    target:
      entity_id: switch.f_utcai
mode: single

You should apply the same logic to your “Heating On” automation, changing the above values to below: 23.

Alternative: The Generic Thermostat

If you are building a climate control system, you might want to move away from raw automations entirely. Home Assistant has a built-in Generic Thermostat integration.

This creates a climate entity (like a real thermostat on your dashboard) that manages the heater switch and temperature sensor logic for you automatically, handling the state checks without complex YAML.

Summary

  • numeric_state triggers need to cross the threshold to fire.
  • If your value is already past the threshold, nothing happens.
  • Fix: Add homeassistant start triggers and use conditions to check the current value immediately.

Hopefully, this saves you some debugging time!

URL: https://community.home-assistant.io/t/homeassistant-automation-not-triggering/815956

Залишити коментар