← 返回 Skills 市场
joneschi

Home Assistant CLI

作者 JonesChi · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
3976
总下载
12
收藏
18
当前安装
1
版本数
在 OpenClaw 中安装
/install homeassistant-cli
功能描述
Advanced Home Assistant control using the official hass-cli tool. Features auto-completion, event monitoring, history queries, and rich output formatting. Alternative to the curl-based homeassistant skill - choose this if you want a more interactive CLI experience with better discovery and formatting.
使用说明 (SKILL.md)

Home Assistant CLI

Control your Home Assistant smart home devices using the official hass-cli tool — a feature-rich command-line interface with auto-completion, event monitoring, and flexible output formatting.

Why This Skill vs. homeassistant (curl-based)?

Choose homeassistant-cli if you want:

  • Auto-completion for entity IDs and services (bash/zsh/fish)
  • Event monitoring in real-time (hass-cli event watch)
  • History queries (hass-cli state history)
  • Better output formatting (table/YAML/JSON with one flag)
  • Interactive exploration (easier to discover entities and services)
  • Comprehensive documentation with examples and troubleshooting

Choose homeassistant (curl) if you want:

  • ✅ Zero dependencies (curl + jq are pre-installed)
  • ✅ Lightweight and fast
  • ✅ Better for scripting and automation
  • ✅ No Python requirements

Both work great — this skill is for users who interact frequently with Home Assistant and want a richer CLI experience.

Setup

Before using hass-cli, configure authentication:

  1. Generate a long-lived access token in Home Assistant:

    • Navigate to your profile: https://your-homeassistant:8123/profile
    • Scroll to "Long-Lived Access Tokens"
    • Create a new token
  2. Set environment variables (add to shell config for persistence):

    export HASS_SERVER=https://homeassistant.local:8123
    export HASS_TOKEN=\x3Cyour-token>
    
  3. Test connection:

    hass-cli info
    

Common Commands

List Entities

# List all entities
hass-cli state list

# Filter by domain
hass-cli state list light
hass-cli state list switch
hass-cli state list sensor

# Get specific entity state
hass-cli state get light.living_room

Control Devices

# Turn on/off lights
hass-cli service call light.turn_on --arguments entity_id=light.living_room
hass-cli service call light.turn_off --arguments entity_id=light.living_room

# Set brightness (0-255)
hass-cli service call light.turn_on --arguments entity_id=light.bedroom,brightness=128

# Turn on/off switches
hass-cli service call switch.turn_on --arguments entity_id=switch.fan
hass-cli service call switch.turn_off --arguments entity_id=switch.fan

# Toggle any device
hass-cli service call homeassistant.toggle --arguments entity_id=light.kitchen

List and Call Services

# List all services
hass-cli service list

# Filter services
hass-cli service list light
hass-cli service list 'home.*toggle'

# Get service details (YAML output)
hass-cli -o yaml service list homeassistant.toggle

Work with Scenes

# List scenes
hass-cli state list scene

# Activate a scene
hass-cli service call scene.turn_on --arguments entity_id=scene.movie_time

Monitor Events

# Watch all events
hass-cli event watch

# Watch specific event type
hass-cli event watch state_changed
hass-cli event watch automation_triggered

History

# Get state history (last 50 minutes)
hass-cli state history --since 50m light.living_room

# Multiple entities
hass-cli state history --since 1h light.living_room switch.fan

Output Formats

Control output with -o or --output:

# Table (default)
hass-cli state list

# YAML
hass-cli -o yaml state get light.living_room

# JSON
hass-cli -o json state list light

# No headers (for scripting)
hass-cli --no-headers state list

Tips

Examples

See references/examples.md for common automation patterns and use cases.

安全使用建议
This skill appears to be a straightforward wrapper around the official hass-cli tool, but the metadata is missing the fact that you must provide HASS_SERVER and a long-lived HASS_TOKEN. Before installing: (1) verify the pip/homebrew package comes from the official project (check maintainers and repo), (2) be prepared to supply a Home Assistant long-lived access token — treat it like a password and avoid echoing it into terminals or logs, (3) avoid using --insecure in production (it disables SSL verification), (4) prefer storing the token in a secure secret store instead of exporting it in a shared shell config, and (5) consider whether you want an agent with autonomous invocation to run hass-cli commands against your home network. The metadata omission lowers transparency; ask the publisher to add required env vars (HASS_SERVER, HASS_TOKEN) to the skill manifest before trusting it.
功能分析
Type: OpenClaw Skill Name: homeassistant-cli Version: 1.0.0 The skill bundle is a legitimate wrapper for the `hass-cli` tool, providing documentation and examples for Home Assistant control. It instructs the user to configure sensitive `HASS_TOKEN` and `HASS_SERVER` environment variables, which is standard for `hass-cli`. The use of `eval` for shell auto-completion in `references/autocomplete.md` is a common and expected pattern for CLI tools, not indicative of malicious execution. All commands and instructions are focused on interacting with Home Assistant and lack any evidence of data exfiltration, malicious execution, persistence, or prompt injection attempts against the agent.
能力评估
Purpose & Capability
The skill's name, description, and commands align with a Home Assistant CLI wrapper and legitimately need the hass-cli binary and access to a Home Assistant server. The install options (pip/homebrew) are appropriate for a Python CLI tool.
Instruction Scope
SKILL.md instructs the agent/user to set HASS_SERVER and HASS_TOKEN, test connections, and even echo $HASS_TOKEN in troubleshooting — but the skill metadata did not declare any required environment variables. The instructions otherwise stay within Home Assistant control scope and do not ask to read system files outside of typical shell configs.
Install Mechanism
Install spec uses pip and Homebrew formulas for homeassistant-cli, which is expected for this upstream project and is a low-to-moderate risk install path. No download-from-URL or arbitrary extraction is used.
Credentials
Runtime usage clearly requires a long-lived Home Assistant token (HASS_TOKEN) and server URL (HASS_SERVER). Those sensitive environment variables are not listed in requires.env or primary credential fields in the metadata — an omission that reduces transparency and could cause unintentional credential exposure. The troubleshooting guidance suggests echoing the token and using --insecure for certs, both of which can weaken secrecy or security if followed without caution.
Persistence & Privilege
The skill does not request permanent/always-on inclusion (always:false), does not modify other skills, and does not claim access to unrelated config paths or credentials. Autonomy is enabled by default (disable-model-invocation:false) which is standard and not by itself a red flag.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install homeassistant-cli
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /homeassistant-cli 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of the homeassistant-cli skill. - Provides advanced Home Assistant control using the official hass-cli tool. - Features include auto-completion, real-time event monitoring, history queries, and rich output formatting (table/YAML/JSON). - Offers enhanced interactivity and discoverability compared to curl-based alternatives. - Includes setup instructions, common commands, and usage tips for a richer CLI experience.
元数据
Slug homeassistant-cli
版本 1.0.0
许可证
累计安装 19
当前安装数 18
历史版本数 1
常见问题

Home Assistant CLI 是什么?

Advanced Home Assistant control using the official hass-cli tool. Features auto-completion, event monitoring, history queries, and rich output formatting. Alternative to the curl-based homeassistant skill - choose this if you want a more interactive CLI experience with better discovery and formatting. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 3976 次。

如何安装 Home Assistant CLI?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install homeassistant-cli」即可一键安装,无需额外配置。

Home Assistant CLI 是免费的吗?

是的,Home Assistant CLI 完全免费(开源免费),可自由下载、安装和使用。

Home Assistant CLI 支持哪些平台?

Home Assistant CLI 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Home Assistant CLI?

由 JonesChi(@joneschi)开发并维护,当前版本 v1.0.0。

💬 留言讨论