Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › automations

What Do `unknown` and `unavailable` Mean in Home Assistant?

By Freedom251 Team · · 7 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In Home Assistant, unknown means no usable state value is known for an entity. unavailable means the entity cannot provide its state at that moment. The labels describe the entity’s current state, not the precise cause. A device may be offline, a service may be unreachable, an integration may not be configured, or a referenced entity may not exist.

The distinction matters in dashboards, templates and automations. A missing entity requested with states('entity_id') also produces the text unknown, while an unavailable entity generally exists but cannot report a value. Check the raw state in Home Assistant before changing hardware, rewriting an automation or applying a numeric fallback.

As an Amazon Associate I earn from qualifying purchases.

How Home Assistant represents an entity state

Every Home Assistant entity has one current state value. Ordinary values include on and off for a switch, a number such as 21.5 for a temperature sensor, or home for a person. Attributes such as a battery percentage, friendly name or unit are additional data; they do not replace the entity’s main state.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

unknown and unavailable are special state strings. They are not interchangeable with a numerical zero, an empty string or an off state. An automation that expects a real measurement must handle these values deliberately.

#1 Best Overall
Home Assistant | Smart Home hub with Advanced Automation | Official HomeAssistant ((4G+64G)+Hub)
  • Home Assistant provides a professional and reliable platform for home automation, designed to run continuously 24/7.
  • Powered by a 64-bit Quad-Core Cortex-A53 processor, delivering smooth and efficient performance for smart home automations.
  • Includes 4GB SDRAM for reliable multitasking and 64GB eMMC
  • Features a Mali-450 MP2 GPU for responsive visual interfaces, housed in a compact 85 × 85 × 15mm (3.35" × 3.35" × 0.59") design that fits easily in any space.
  • Typical power consumption is under 10W, with fanless operation for quiet performance suitable for any room in your home.
State or case What it tells you First check
unknown No state value is known. A nonexistent ID requested through states() also returns this text. Confirm that the entity exists and that its ID is spelled correctly.
unavailable The entity cannot provide a state right now. Check device or service connectivity, power, integration setup and logs.
has_value('entity_id') is false The entity is missing, unknown or unavailable. Branch to an intentional fallback or a user-facing message.

Home Assistant’s state-object documentation defines unavailable this way: “The entity cannot provide its state right now. For example, Home Assistant cannot reach the device or service, or the integration of the entity has not been set up.” That wording is intentionally broad; the state alone is not a diagnosis.

What unknown means

An entity is unknown when Home Assistant has no value it can use for the entity’s state. This can happen when an integration has not supplied an initial reading, when a device has not produced a valid value, or when a template or automation references an entity ID that does not exist.

A missing entity can look like an unknown sensor

The template function states('entity_id') is designed to fail safely. If the ID is absent, the function returns the text unknown instead of raising an exception. Therefore, seeing unknown does not prove that a physical sensor reported an unknown measurement. First check spelling, domain and entity existence.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For example, this request returns unknown if the entity is missing:

Rank #2
Wall Mount Compatible with Home Assistant Green Smart Home Hub Holder (White)
  • Custom fit design provides a snug and secure hold for your compatible with Home Assistant Green, ensuring stability and easy access at eye level.
  • Space-saving wall installation helps declutter surfaces by moving your smart home hub off counters and onto the wall for a cleaner setup.
  • Durable construction crafted for reliable long-term use with quick and straightforward mounting on various wall surfaces.
  • Sleek minimalist style complements modern home aesthetics while keeping ports and displays accessible.
  • This product is a third-party accessory designed to be compatible with Home Assistant. Our products are not affiliated with, authorized, or endorsed by it and are mentioned for compatibility purposes only.
{{ states('sensor.outdoor_temperature') }}

By contrast, dotted access such as states.sensor.outdoor_temperature.state can raise an error when the entity is missing. Prefer the function form whenever an entity could have been renamed, removed or conditionally created.

Unknown is not the same as zero or off

Do not treat unknown as a measurement of zero, and do not interpret it as an intentional off state. A power sensor that is unknown has not supplied a usable reading; a light that is off has supplied a definite state. This difference affects both display logic and safety decisions.

What unavailable means

unavailable means the entity cannot provide its state now, even though Home Assistant recognizes the entity. The documented examples include an unreachable device, an unreachable service and an integration that has not been set up. A network outage, a powered-down device, expired credentials, a service interruption or a failed integration initialization can all lead to the same label.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Unavailable may be temporary

An entity can become available again after a device reconnects or an integration finishes loading. Treat the label as a current condition, not proof of permanent failure. Conversely, repeated or long-lasting unavailability warrants checking power, network access, credentials, integration configuration and logs.

Rank #3
Aqara Smart Hub M200, Matter Controller, Featuring Aqara Zigbee, Wi-Fi, IR
  • [Multi-Protocol Hub with Matter Bridge] The Aqara Hub M200 is a versatile smart hub that supports multiple advanced features, acting as a Matter Controller, Thread Border Router, and Matter Bridge. It integrates third-party devices into the Aqara Home app. With advanced Matter bridging functionality, it syncs Aqara-exclusive features with ecosystems like Home Assistant, Apple HomeKit, Alexa, and Google Home for seamless integration. Supports up to 40 Aqara Zigbee devices and 40 Thread devices.
  • [Smart IR Blaster with Feedback and Learning] The 360°IR blaster not only sends commands but also provides accurate status updates by detecting traditional remote use. It connects IR air conditioning units to Matter, functioning as an AC thermostat when paired with an Aqara Temperature and Humidity Sensor. (Note: Only one AC device can be exposed to Matter. Functionality may vary based on the Matter integration app. For Apple Home exposure, use Matter integration instead of HomeKit.)
  • [Wired & Wireless Connectivity with PoE Support] Enjoy flexible setup with dual-band Wi-Fi (2.4/5 GHz) using advanced WPA3 security, and Power over Ethernet (PoE), making the M200 a versatile PoE Ethernet Smart Home Hub. The USB-C port supports mini-UPS or power bank connections for uninterrupted operation, ensuring your energy-saving and security automations stay online. (*2A USB power adapter is not included. )
  • [Home Automation and Alarm System] Works with all Aqara devices to create a comprehensive, smart home automation system. The Aqara Hub M200 is equipped with a built-in speaker that can be used in a variety of ways: security alerts, doorbell, alarm clock, and custom audio messages. (** 𝐍𝐨𝐭 𝐭𝐡𝐢𝐫𝐝-𝐩𝐚𝐫𝐭𝐲 𝐙𝐢𝐠𝐛𝐞𝐞 𝐝𝐞𝐯𝐢𝐜𝐞𝐬)
  • [Local Automation for Reliable Performance] Supports local execution of automations for Zigbee and Matter devices, ensuring smooth operation even without Wi-Fi or cloud access. Enjoy millisecond response times for a more stable and reliable smart home experience. (Some automation, such as cloud push notifications, will still require the cloud connection to be executed.)

Restored entities during startup

Home Assistant can restore registered entities as unavailable so other parts of the system can use the entity record while an integration loads. This is a documented startup and setup case, not a rule that applies to every unavailable entity. Inspect the entity’s restored attribute when you suspect this situation. A restored entity can indicate that setup is delayed or has failed, especially after a restart; the integration still has to initialize before a live value appears.

How to diagnose either state

Use the raw entity state rather than relying only on a dashboard card’s friendly label. Follow this sequence:

  1. Open the state inspector. Go to Settings > Tools > States. Locate the entity and read its exact entity ID, state and attributes.
  2. Confirm the reference. Compare the ID with the one used in your template or automation. Check the domain, spelling, underscores and any renamed device or entity.
  3. If the state is unknown, verify existence. A missing ID passed to states() deliberately returns unknown. Look for a renamed, deleted or disabled entity before troubleshooting a physical sensor.
  4. If the state is unavailable, check the source. Confirm that the device has power, that the local network or remote service is reachable, and that credentials and integration setup are valid.
  5. Read the logs. Go to Settings > System > Logs. Look for warnings or errors from the relevant integration, connection failures, authentication messages and references to entities that no longer exist.
  6. Consider startup timing. After a restart, inspect whether the entity has a restored attribute and whether the integration is still loading or reported a setup failure.
  7. Retest the actual automation path. A dashboard may recover while a template still uses a misspelled ID, and a device may be available while a threshold entity remains unavailable. Check every entity involved in the action.

Safe templates for unusable values

Use has_value before displaying or using a reading

Home Assistant’s has_value test is false when an entity is missing or its state is either unknown or unavailable. It is useful when the template only needs to know whether a usable value exists:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
{% if has_value('sensor.outdoor_temperature') %}
  It is {{ states('sensor.outdoor_temperature') }}°C outside.
{% else %}
  The outdoor sensor is unavailable.
{% endif %}

This deliberately groups the two special states. If your message or recovery path must distinguish them, read the state string and compare it explicitly.

Rank #4
Home Assistant Green | Smart Home hub with Advanced Automation | Official Home Assistant Hardware
  • 💡 EASIEST WAY TO GET STARTED WITH HOME ASSISTANT - With Home Assistant already installed, it only requires plugging the included power supply and Ethernet cable to get started.
  • ✅ OFFICIAL - This official Home Assistant hardware is built and supported by Nabu Casa, the team driving the development of Home Assistant.
  • 🏡 DESIGNED FOR THE HOME - The small, fanless, and silent design packs a quad-core processor, 32GB of storage, and 4GB of RAM.
  • 📱 ONE HUB TO CONTROL THE WHOLE HOME - Cut down hub and app clutter and control your whole home from Home Assistant Green.
  • 🤖 AUTOMATE EVERYTHING - Make all the devices in your home work in harmony - have your lights dim when you start watching a movie, or turn off your heat when you’re away from home.
{% set state = states('sensor.outdoor_temperature') %}
{% if state == 'unknown' %}
  No temperature value is known, or the entity ID may be missing.
{% elif state == 'unavailable' %}
  The temperature entity cannot report right now.
{% else %}
  It is {{ state }}°C outside.
{% endif %}

Convert text before arithmetic

states('sensor.temperature') returns text, even when the text contains a number. Convert it before calculations:

{{ states('sensor.temperature') | float }}

When conversion can fail, a documented pattern is | float(0). That prevents a conversion error by substituting zero. It is not merely neutral error handling: later logic really receives zero. Use it only when zero is an appropriate and safe fallback for that sensor.

{{ states('sensor.temperature') | float(0) }}

For a heater, alarm or other safety-sensitive decision, zero can trigger the wrong branch. Prefer an explicit validity check and an unavailable path:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
{% if has_value('sensor.temperature') %}
  {% set temperature = states('sensor.temperature') | float %}
  {% if temperature < 10 %}
    Temperature is below the operating limit.
  {% endif %}
{% else %}
  Do not make a temperature-based decision until the sensor has a value.
{% endif %}
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How automations treat these states

State conditions require an exact match

A state condition compares the entity’s state to the value you specify. To test for either special state, select or enter that exact string:

Best Value
Besisglas Starter Kit for Home Assistant, Zigbee 3.0 Hub, 2 Zigbee Sensors
  • EASIEST WAY TO GET STARTED WITH HOME ASSISTANT: With Home Assistant already installed, it only requires plugging the included power supply and Ethernet cable to get started
  • DESIGNED FOR THE HOME: The small, fanless, and silent design packs a quad-core processor, 32GB of storage, and 4GB of RAM
  • ONE HUB TO CONTROL YOUR WHOLE HOME: Simplify your smart home with HA70. Built with official Home Assistant OS and a professional Zigbee coordinator, it brings local control, powerful automation, and seamless device management into one compact hub
  • AUTOMATE EVERYTHING: Make all the devices in your home work in harmony - have your lights dim when you start watching a movie, or turn off your heat when you're away from home
  • YOUR HOME, YOUR DATA: Your home's data will be kept in the home on your HomeAssistant. You can easily view, share, and export that data anywhere you want
condition:
  - condition: state
    entity_id: sensor.example
    state: "unavailable"

An entity in unavailable does not pass a condition expecting on, off or a number. Likewise, a condition for unknown will not match unavailable.

Numeric-state conditions need usable numbers

A numeric-state condition does not pass while the measured entity is unknown or unavailable. The same applies to an entity used as the threshold: if either the measurement or the threshold has no usable numeric value, the condition cannot be evaluated. Check both sides when a temperature, energy or humidity automation unexpectedly fails.

Unavailable-to-available transitions may skip a trigger

State-change triggers can require a particular prior state. Suppose a trigger requires from: "off" and to: "on". If the device disconnects while off and later reconnects reporting on, the actual transition is unavailable to on, not off to on. The trigger therefore does not fire. Remove or broaden the prior-state requirement only if that behavior is acceptable, and consider handling reconnection separately.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common mistakes and safer fixes

  • Assuming unknown always means a sensor has not reported. Check whether the entity ID exists because states() uses unknown for a missing ID.
  • Assuming unavailable always means the device is offline. Check the service, integration setup, credentials and startup status as well as the device’s network and power.
  • Replacing every invalid value with zero. Use float(0) only when zero has a valid meaning for the decision; otherwise branch on has_value.
  • Reading only a dashboard card. Inspect Settings > Tools > States to see the raw state, exact entity ID and attributes.
  • Fixing the measured entity but not its threshold. Numeric conditions require both values to be available and numeric.
  • Expecting an off-to-on trigger after reconnection. Verify the actual previous state; a reconnect commonly produces unavailable to on.
  • Using dotted template access for optional entities. Use states('entity_id') so a missing entity yields a controlled unknown result that your template can handle.

A practical decision path

When an entity looks wrong, classify it before changing anything:

  1. If the state is a normal value, troubleshoot the value itself or the automation’s comparison.
  2. If the state is unknown, verify that the entity exists, then inspect why no value has been supplied.
  3. If the state is unavailable, check power, connectivity, service availability, integration setup and logs.
  4. If the entity is restored after startup, wait for integration initialization and investigate any setup error rather than treating the restored value as live data.
  5. If a template or automation still behaves incorrectly, test every referenced entity with has_value and inspect the actual transition that occurred.

The key operational rule is simple: unknown says Home Assistant has no state value to use; unavailable says the recognized entity cannot provide one right now. Verify the entity, its integration and its dependencies before choosing a fallback or allowing an automation to act.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

automationsHome AssistantJinja templatessmart homeTroubleshooting

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.