Home Assistant

v0.1.4
com.foreverworks/home-assistant Checked 2 days ago Published 5 days ago

Read your Home Assistant's states, areas and history, and run its actions, approving locks first.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

call_action Run an action

Run a Home Assistant action (formerly a service call): light.turn_on, climate.set_temperature, media_player.volume_set, script.turn_on. Answers once it has run, with the states that changed. An action in a domain the user approves call by call (lock, alarm_control_panel, cover, valve unless configured otherwise), aimed at an entity of one, or a homeassistant action aimed wider than named entities, is refused here with needs_confirmation: use call_action_confirmed. An action Home Assistant runs only for administrators (every reload, homeassistant.restart and the like) is refused with needs_admi…

ParameterTypeDescription
domain *stringThe action's domain: light, switch, climate, lock, script, homeassistant, ...
service *stringThe action within the domain: turn_on, set_temperature, unlock, ... (list_actions lists them).
dataobjectThe action's fields, as list_actions shows them: {"brightness_pct": 40}, {"temperature": 21.5}. Not the target.
return_responsebooleanAsk for the data the action answers with (a weather forecast, a calendar's events); only for actions list_actions marks with response.
targetobjectWhat the action acts on. Several kinds may be combined; an action that takes no target (homeassistant.reload_all, a script) leaves it out.

call_action_confirmed Run an action, with the user's approval

The same as call_action, for any action, and the user approves every call before it runs: the way to lock or unlock a door, arm or disarm an alarm, open or close a cover or a valve. Only when the user asked for that action. Acts outside the computer: the client asks the user to approve each call.

ParameterTypeDescription
domain *stringThe action's domain: light, switch, climate, lock, script, homeassistant, ...
service *stringThe action within the domain: turn_on, set_temperature, unlock, ... (list_actions lists them).
dataobjectThe action's fields, as list_actions shows them: {"brightness_pct": 40}, {"temperature": 21.5}. Not the target.
return_responsebooleanAsk for the data the action answers with (a weather forecast, a calendar's events); only for actions list_actions marks with response.
targetobjectWhat the action acts on. Several kinds may be combined; an action that takes no target (homeassistant.reload_all, a script) leaves it out.

get_states Get states

The current state of one or more entities, with their attributes (a light's brightness, a thermostat's target, a sensor's unit) and when the state last changed. An id Home Assistant does not know is listed under not_found; when none is known, the call fails with suggestions.

ParameterTypeDescription
entity_ids *arrayThe entity ids, like light.kitchen (list_entities finds them).
attributesbooleanInclude each entity's attributes.

health Health

Whether this server works with its Home Assistant: the version, whether it is RUNNING, its time zone (history and logbook times carry an offset), whether the WebSocket API signs in too, whose token it holds and whether that user is an administrator (if not, the tools that need one are listed), and how many entities each domain has. ok: false comes with the problem. A Home Assistant that does not answer at all (switched off, restarting, no route from here) is not a failure: it is reported as reachable: false, with what the network said. Call it first, and whenever a call fails with unreachable…

history State history

How entities' states changed over a window, from the recorder: for each entity its changes oldest first (the first is the state when the window opened), the newest limit of them. Default the last 24 hours; at most 31 days, and only as far back as the recorder keeps (10 days unless configured otherwise).

ParameterTypeDescription
entity_ids *arrayThe entities, like sensor.living_room_temperature.
attributesbooleanInclude each change's attributes too (much larger).
endstringWhere it ends; default now, with its offset: 2026-03-01T18:00:00+02:00 or 2026-03-01T16:00:00Z. health gives the instance's time zone.
hoursintegerInstead of start: this many hours before end (default 24).
limitintegerAt most this many changes per entity, the newest (1-1000).
startstringWhere the window starts; default the last `hours` before end, with its offset: 2026-03-01T18:00:00+02:00 or 2026-03-01T16:00:00Z. health gives the instance's time zone.

list_actions List actions

The actions (formerly services) Home Assistant offers. Without a domain, every domain with its action names; with one, each action's description, whether it takes a target, whether it answers with data, and its fields (type, options, an example). Domains whose actions the user approves call by call (lock, alarm_control_panel, cover, valve unless configured otherwise) are marked confirm, and actions only an administrator's token may run are marked needs_admin when this token's user is not one.

ParameterTypeDescription
domainstringOnly this domain's actions, with their fields.

list_areas List areas

Every area (or one), with its floor, its devices and the entities in it: an entity's own area, else its device's, as Home Assistant's area pages show them. Disabled devices and entities are left out. Also counts what has no area. Its ids are what call_action takes as area_id and device_id.

ParameterTypeDescription
areastringOnly this area, by its name or id.
entitiesbooleanList each area's entity ids, not only how many there are.

list_entities List entities

Find entities: one row each with entity_id, name, state, unit and area, in entity id order. Filter by domain (light, sensor, climate, ...), by area (its name or id), and by words that must all appear in the id, the name or the area. Use it to find the entity_id other tools take; get_states reads an entity's attributes.

ParameterTypeDescription
areastringOnly entities in this area, by its name or id (list_areas lists them).
domainstringOnly entities of this domain, like light or sensor.
limitintegerAt most this many rows (1-1000).
searchstringWords that must all appear in the entity id, its name or its area, ignoring case.

logbook Logbook

What happened over a window, as Home Assistant's logbook tells it: states that changed, automations and scripts that ran, and what caused each (a user, an action, an automation) where it knows. Oldest first, the newest limit of them. Optionally for one entity.

ParameterTypeDescription
endstringWhere it ends; default now, with its offset: 2026-03-01T18:00:00+02:00 or 2026-03-01T16:00:00Z. health gives the instance's time zone.
entity_idstringOnly this entity's entries.
hoursintegerInstead of start: this many hours before end (default 24).
limitintegerAt most this many entries, the newest (1-1000).
startstringWhere the window starts; default the last `hours` before end, with its offset: 2026-03-01T18:00:00+02:00 or 2026-03-01T16:00:00Z. health gives the instance's time zone.

render_template Render a template

Render a Home Assistant template (Jinja) with its own states and helpers, for what no other tool answers in one call: "{{ states.light | selectattr('state', 'eq', 'on') | map(attribute='entity_id') | list }}", "{{ area_entities('kitchen') }}", "{{ now() }}". Rendering changes nothing. Home Assistant renders templates only for administrators: with another user's token this answers needs_admin without asking Home Assistant (health says which it is).

ParameterTypeDescription
template *stringThe template text.
variablesobjectVariables the template can use by name.