Get Entity State
ha_get_stateRetrieve current state and attributes of one or more Home Assistant entities, with support for field projection and bulk queries up to 100 entities.
Instructions
Get current status, state, and attributes of one or more entities (lights, switches, sensors, climate, covers, locks, fans, etc.).
SINGLE ENTITY: Pass a string entity_id. Returns the entity's full state and attributes.
MULTIPLE ENTITIES: Pass a list of entity IDs (max 100). Efficiently retrieves states using parallel requests. Duplicates are automatically deduplicated. Returns success=True if at least one entity state was retrieved. Check 'error_count' for any failed lookups in partial-success scenarios.
FIELDS PROJECTION:
fields= projects the per-entity record keys (see the fields= parameter
description for the full key list), NOT the outer bulk response wrapper.
In single-entity mode it filters keys of the returned record directly. In bulk
mode it filters keys of each record inside states[entity_id]; outer keys
(success, count, states, errors, ...) are always preserved.
attribute_keys= further narrows the attributes sub-dict and is only applied
when "attributes" is in fields= (or fields=None); otherwise it is a no-op.
When attribute_keys= is set but has no effect (because attributes was
excluded by fields=), a warnings list is emitted outside the projected
entity record(s): in bulk mode at the response wrapper level (sibling of
success/count/states); in single-entity mode at the top-level result
(sibling of data/metadata, since the projected record IS data).
The warnings list is never a record key, so fields=["state"] returns a
record with only state regardless of whether the no-effect warning fires.
EXAMPLES:
Single: ha_get_state("light.kitchen")
Multiple: ha_get_state(["light.kitchen", "light.living_room", "sensor.temperature"])
State only: ha_get_state("light.kitchen", fields=["state"])
Slim bulk: ha_get_state(["light.kitchen", "sensor.temperature"], fields=["state", "attributes"], attribute_keys=["brightness"])
get current state value single entity check status bulk multiple states
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fields | No | Return only the specified top-level entity record keys to reduce response size (e.g. ["state", "attributes"]). None = full entity record (default). Available keys: entity_id, state, attributes, last_changed, last_reported, last_updated, context. | |
| entity_id | Yes | Entity ID or list of entity IDs to retrieve state for (e.g., 'light.kitchen' or ['light.kitchen', 'sensor.temperature']) | |
| attribute_keys | No | Return only the specified keys from each entity's attributes dict (e.g. ["brightness", "color_temp_kelvin"] for lights). None = full attributes (default). Unknown keys are silently dropped. Requires "attributes" to be present in fields= (or fields=None). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||