agentleFS
dmealingdmealing/ha-axi/skills/hass-axi/SKILL.md

hass-axi

Skill1 starsChanged 59 days agoMITView on GitHub

Operate a Home Assistant installation through the hass-axi CLI - read and update the entity, area and device registries that only the WebSocket API exposes, and call services with a capability pre-check and an explained refusal. It also finds sensors by what they measure and where they are, and summarises state history, the logbook and recorder statistics - an energy total, an average with min and max - with their data-quality caveats. Use whenever a task touches home automation: renaming an entity or the device behind it, moving things between areas, checking what a device is doing or did, reading how much energy was used, or turning something on.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. dmealing/hass-axi★ 1100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository2 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. About 0 are common, 11 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create the token on the Home Assistant profile page, under Security.

    line 20
  2. Very specific:

    Run hass-axi doctor to confirm both transports work.

    line 21
  3. Very specific:

    Every write is then refused before it is sent, over REST and over the WebSocket alike, with code: READ_ONLY and exit 2.

    line 33
  4. Distinctive:

    Read entity states from the Home Assistant REST API.

    line 56
  5. Very specific:

    run hass-axi statistics get <entity_id> for a total or an average over a window

    line 83
  6. Distinctive:

    Read entity state timelines from the recorder, with time in each state.

    line 87
  7. Very specific:

    run hass-axi statistics get <entity_id> for long-term totals and averages.

    line 97
  8. Distinctive:

    Read the logbook: what changed, when, and what caused it.

    line 101
  9. Distinctive:

    Read recorder statistics: a total for meters, an average with min and max otherwise.

    line 114
  10. Distinctive:

    Read and update the entity registry over the WebSocket API.

    line 163
  11. Very specific:

    update shows what it would change and sends nothing until --write is given

    line 178
  12. Distinctive:

    Read and update the area registry over the WebSocket API.

    line 182
  13. Very specific:

    create and update show what they would do and send nothing until --write is given

    line 195
  14. Distinctive:

    Read the floor registry over the WebSocket API.

    line 201
  15. Distinctive:

    Read the label registry over the WebSocket API.

    line 212
  16. Distinctive:

    Read and update the device registry over the WebSocket API.

    line 222
  17. Distinctive:

    Check Home Assistant answers and accepts the token, and how fast.

    line 276
  18. Very specific:

    run hass-axi doctor to check the WebSocket API and the environment as well

    line 283
  19. Distinctive:

    Check the environment, the REST API and the WebSocket API.

    line 287
  20. Very specific:

    Every command supports --help, which is the authoritative reference for its flags.

    line 333

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

hass-axi

Agent CLI for Home Assistant. Reads and writes the registries REST cannot reach and explains a service call Home Assistant refuses. Prefer this over raw curl for Home Assistant operations.

Configuration

Both values come from the environment. There is no --token flag and no credential file: a token on a command line leaks into shell history and the process table.

export HA_URL=https://homeassistant.example.com   # or HASS_SERVER
export HA_TOKEN=<long-lived access token>          # or HASS_TOKEN

Create the token on the Home Assistant profile page, under Security. Run hass-axi doctor to confirm both transports work; it exits non-zero when they do not.

Read-only sessions

A third variable makes the session incapable of changing anything. HASS_AXI_READ_ONLY is a switch rather than a boolean: any non-empty value enables it, 0 and false included, and unsetting it is how writes are allowed again.

export HASS_AXI_READ_ONLY=1

Every write is then refused before it is sent, over REST and over the WebSocket alike, with code: READ_ONLY and exit 2. The commands stay visible in --help and in the command table, so a plan that needs one can be recognised as impossible rather than mysterious. hass-axi doctor reports the mode, and the no-argument view shows read_only: on when it is set.

Running without a global install

uvx hass-axi state list --domain light
pipx run hass-axi area list

Output

Commands print TOON on stdout and exit non-zero on failure. Add --human for a readable table, or --json for raw JSON. Errors are structured on stdout too, and carry the command that fixes them.

Commands

hass-axi state

Read entity states from the Home Assistant REST API.

hass-axi state list --domain light
hass-axi state list --area 'Example Room' --domain light
hass-axi state list --search lamp --limit 20
hass-axi state list --domain sensor --state unavailable
hass-axi state list --stale 24h --fields entity_id,name,age
hass-axi state get light.example_lamp
hass-axi state get media_player.example_speaker --full
  • state is the runtime view; run hass-axi entity list for registry names and areas
  • --area reads the WebSocket registry, where areas live; it costs one extra round-trip

hass-axi sensor

Find sensors by device class, unit, area or name, with value, unit, area and age.

hass-axi sensor list --device-class power
hass-axi sensor list --area 'Example Room' --unit kWh
hass-axi sensor list --search temperature --fields entity_id,name,value,unit,age
  • age is the time since the integration last reported a value; a sensor on an idle circuit can be old and healthy, so it is a fact about recency and not a fault
  • an area is inherited from the sensor's device unless the entity sets its own
  • run hass-axi statistics get <entity_id> for a total or an average over a window

hass-axi history

Read entity state timelines from the recorder, with time in each state.

hass-axi history get light.example_lamp
hass-axi history get binary_sensor.example_doorway --start 7d
hass-axi history get sensor.example_temperature --start 2026-01-01T00:00:00Z --end 6h
  • the first row is the state the entity was already in when the window opened
  • a bound with no offset is read as UTC
  • run hass-axi statistics get <entity_id> for long-term totals and averages; the recorder purges this timeline after its retention period, statistics it keeps

hass-axi logbook

Read the logbook: what changed, when, and what caused it.

hass-axi logbook get --start 2h
hass-axi logbook get --entity light.example_lamp --start 7d
hass-axi logbook get --search automation --limit 20
  • entries are oldest first; --limit keeps the most recent
  • cause is the automation, script, service or entity Home Assistant recorded as the context of the entry, when it recorded one

hass-axi statistics

Read recorder statistics: a total for meters, an average with min and max otherwise.

hass-axi statistics list --kind sum
hass-axi statistics get sensor.example_legacy_meter --start 7d
hass-axi statistics get sensor.example_temperature --start 24h
  • a sum statistic (an energy or water meter) reports its total over the window; a mean statistic (power, temperature) reports its average with min and max
  • an entity's statistic_id is its entity_id; Home Assistant keeps statistics only for sensors that declare a state_class
  • the default period is hourly up to 3 days, daily up to 60, monthly beyond; the recorder keeps 5-minute buckets for about 10 days
  • the total, mean, min and max cover the window asked for whatever the period: they are read from the hourly rows inside it, because a daily, weekly or monthly bucket starts before --start
  • caveats state what the buckets show -- missing buckets, a meter that went backwards or resets, one bucket that dwarfs the rest -- and the number is never adjusted for them

hass-axi service

List Home Assistant services, read one's fields, and call them.

hass-axi service list
hass-axi service list --domain light
hass-axi service get light.turn_on
hass-axi service call light.turn_on --target-entity light.example_lamp
hass-axi service call light.turn_on --target-entity light.example_lamp --write
hass-axi service call light.turn_on --target-area example_room --data brightness=180 --write
hass-axi service call light.turn_off --target-label example_label --write
hass-axi service call climate.set_temperature --target-entity climate.example_thermostat --data-json '{"temperature": 21}' --write
  • service call sends nothing without --write: it checks the call against the published service, resolves the target, runs the capability pre-check and shows the request -- and fails, as the call would, for a service that does not exist or a target that reaches nothing
  • --data-json takes a whole JSON object; --data takes repeated key=value pairs
  • a refused call is explained from /api/services, which a sent call reads on failure only
  • --target-area, --target-device, --target-floor and --target-label pre-check the published capability, because Home Assistant drops an entity that lacks it without saying so; hass-axi floor list and hass-axi label list show the ids

hass-axi template

Render a Home Assistant Jinja template server-side.

hass-axi template render --template '{{ states("light.example_lamp") }}'
hass-axi template render --template '{{ states.light | count }}'
hass-axi template render --template-file report.j2
echo '{{ now() }}' | hass-axi template render --template-file -
  • templates run on the Home Assistant instance, so they see every entity it knows about

hass-axi entity

Read and update the entity registry over the WebSocket API.

hass-axi entity list --area 'Example Room'
hass-axi entity list --domain light --fields entity_id,name,area,platform
hass-axi entity list --area none --limit 500
hass-axi entity list --device <device_id>
hass-axi entity get light.example_lamp
hass-axi entity update light.example_lamp --name 'Reading Lamp' --area example_room
hass-axi entity update light.example_lamp --name 'Reading Lamp' --write
  • an entity's area is inherited from its device until it is set here explicitly
  • name is the name Home Assistant displays: its device's, plus original_name, unless one is set here
  • entity_ids are not stable identity: filter by --area or --search, not by guessing ids
  • update shows what it would change and sends nothing until --write is given

hass-axi area

Read and update the area registry over the WebSocket API.

hass-axi area list
hass-axi area list --fields area_id,name,floor_id
hass-axi area get example_room
hass-axi area create --name 'Example Room'
hass-axi area create --name 'Example Room' --write
hass-axi area update example_room --name 'Example Study'
hass-axi area update 'Example Room' --icon mdi:sofa --write
  • areas accept an area_id or a name anywhere <id|name> appears
  • create and update show what they would do and send nothing until --write is given
  • --floor has to name a floor that exists; run hass-axi floor list to see them
  • deleting an area is deliberately not exposed here; use hass-axi ws area.delete if you mean it

hass-axi floor

Read the floor registry over the WebSocket API.

hass-axi floor list
  • a floor holds areas and an area holds entities, so --target-floor on service call reaches every entity in every area on the floor
  • areas are placed on a floor with hass-axi area update <id|name> --floor <id|name>

hass-axi label

Read the label registry over the WebSocket API.

hass-axi label list
  • a label can sit on an entity, a device or an area, and --target-label on service call reaches everything that carries it, so a label on a device reaches the device's entities although label list counts it under devices

hass-axi device

Read and update the device registry over the WebSocket API.

hass-axi device list
hass-axi device list --area 'Example Room'
hass-axi device list --search example --fields device_id,name,model
hass-axi device get <device_id>
hass-axi device update 'Example Ceiling' --name 'Hall Ceiling'
hass-axi device update <device_id> --area 'Example Room' --clear-name --write
  • an entity with no area of its own inherits the area of its device
  • an entity with no name of its own is named after its device
  • --name writes name_by_user: name is the integration's own and Home Assistant does not let anything change it
  • devices accept a device_id or the displayed name anywhere <id|name> appears
  • update shows what it would change and sends nothing until --write is given
  • disabling or deleting a device is deliberately not exposed here; use hass-axi ws device.update if you mean it

hass-axi ws

Send a command over the Home Assistant WebSocket API.

hass-axi ws --list
hass-axi ws entity.list
hass-axi ws area.update --param area_id=example_room --param name='Example Study'
hass-axi ws area.update --param area_id=example_room --param name='Example Study' --write
hass-axi ws --raw config/floor_registry/list --write
  • declared names are stable; --raw passes any type straight through to the API
  • --params-json takes a whole JSON object; --param takes repeated key=value pairs
  • a command that writes is previewed and not sent until --write is passed; ws --list says which do, and a --raw type no declaration names counts as one
  • a long result is shortened -- lists to their first items and strings to a preview -- with the full size reported; --full prints all of it

hass-axi api

Make an authenticated request to any Home Assistant REST path.

hass-axi api /config
hass-axi api /states/light.example_lamp
hass-axi api POST /services/light/turn_on --field entity_id=light.example_lamp
hass-axi api POST /services/light/turn_on --field entity_id=light.example_lamp --write
hass-axi api POST /template --body '{"template": "{{ now() }}"}' --write
  • methods: GET, POST, PUT, PATCH, DELETE, HEAD; GET is used when no method is given
  • the registries are not reachable over REST -- use hass-axi ws for those
  • anything but GET and HEAD is previewed and not sent until --write is passed
  • a long response is shortened -- lists to their first items and strings to a preview -- with the full size reported; --full prints all of it

hass-axi ping

Check Home Assistant answers and accepts the token, and how fast.

hass-axi ping
  • one authenticated REST round-trip, timed; exits non-zero when it fails, so it works as a liveness gate
  • run hass-axi doctor to check the WebSocket API and the environment as well

hass-axi doctor

Check the environment, the REST API and the WebSocket API.

hass-axi doctor
  • exits non-zero when any check fails, so it works as a CI or hook gate

hass-axi setup

Install, check or remove the agent integrations for hass-axi.

hass-axi setup hooks
hass-axi setup hooks status
hass-axi setup hooks remove
hass-axi setup skill
hass-axi setup skill --check
  • hooks give ambient context every session; the skill loads on demand instead -- install either
  • hook installation is idempotent and repairs the path after a reinstall or a move
  • setup hooks status reports each hook as installed, stale or missing and writes nothing
  • setup hooks remove takes out only the entries this tool wrote, and leaves Codex's [features] hooks = true on because other tools' Codex hooks depend on it
  • a session-end hook, hass-axi context end, records which hass-axi commands a session ran -- names and counts, never arguments -- so the next session's context in that directory can say so; OpenCode has no session-end event, so its plugin records when a session goes idle

hass-axi context

Print the ambient context a session hook puts in front of an agent.

hass-axi context
  • this is the document hass-axi setup hooks installs a SessionStart hook to print
  • it reads the environment, the command table and the local session record only: no connection, no token, no installation address, and it exits 0 whether or not this machine has Home Assistant
  • for live state -- how many entities there are and what is unavailable -- run hass-axi with no arguments instead
  • context end is the session-end hook: it reads the hook's JSON payload on stdin, counts the hass-axi commands the session ran -- command names only, never arguments -- and context then reports the last session in the same directory

Rules of thumb

  • entity_id is not stable identity. Find entities by area or by search, and read the registry (hass-axi entity list) rather than assuming an id means what it says.
  • States come from REST; names, areas and platforms come from the WebSocket registry. hass-axi state and hass-axi entity are different views of the same installation.
  • An entity with no area of its own inherits its device's area.
  • Every command supports --help, which is the authoritative reference for its flags.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.