Get Entity State
ha_get_stateRetrieve current state and attributes for one or multiple Home Assistant entities, including lights, switches, and sensors, to check status or monitor device values.
Instructions
Get current status, state, and attributes of one or more entities (lights, switches, sensors, climate, covers, locks, fans, etc.).
Pass a string entity_id for one entity, or a list (max 100, duplicates deduplicated) for several, fetched in parallel. A bulk call returns success=True if at least one state was retrieved; check 'error_count' for failed lookups.
fields= projects the per-entity record keys, NOT the outer bulk
response wrapper: in single-entity mode it filters the returned record;
in bulk mode it filters each record inside states[entity_id] while
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 and a warnings list is emitted
outside the projected record(s) — at the response wrapper level in bulk
mode, at the top-level result (sibling of data/metadata) in
single-entity mode — so fields=["state"] still returns a record with
only state.
EXAMPLES:
Single: ha_get_state("light.kitchen")
Multiple: ha_get_state(["light.kitchen", "light.living_room", "sensor.temperature"])
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 which lights
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. 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. Unknown keys are silently dropped. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||