# 将 Home Assistant 接入 Open Flow

Source: https://openflow.run/zh-cn/integrations/home_assistant/

[全部集成](https://openflow.run/zh-cn/integrations/)

说出房间调整要求，或了解家中设备发生了什么变化。

*   [28 个工具](https://openflow.run/zh-cn/integrations/home_assistant/#integration-actions)
*   API 密钥
*   效率工具

[连接 Home Assistant](https://console.openflow.run/connections/home_assistant)

每月 20,000 次免费应用调用（付费服务另计）

## 可以做什么

读取状态、历史和事件记录，控制支持的设备，并在权限允许时管理可编辑的自动化配置。

### 状态、历史与设备背景

读取实体状态、历史、日志记录，以及设备或区域注册表。

### 服务、事件与脚本

调用设备服务、触发事件、渲染模板，并执行脚本序列。

### 可编辑配置

读取、保存或删除界面可编辑的自动化、脚本和场景配置，并校验配置。

## 使用 Home Assistant 的模板

![GitHub Repository Alert Light 在 Open Flow 中的工作流截图](https://openflow.run/template-previews/github-repository-alert-light/light-cover.webp)

开发者工具

### [GitHub Repository Alert Light](https://openflow.run/zh-cn/templates/github-repository-alert-light/)

Turn a Home Assistant light red whenever GitHub delivers an event from a selected repository.

## 所有工具

28 个工具

### Get Config

获取 Home Assistant 实例配置。

`home_assistant.get_config`

### List States

列出所有当前 Home Assistant 实体状态。

`home_assistant.list_states`

### Get State

获取一个 Home Assistant 实体的当前状态。

`home_assistant.get_state`

### List Services

列出 Home Assistant 服务域及其可用服务。

`home_assistant.list_services`

### Call Service

调用 Home Assistant 服务以控制实体，例如 light.turn\_on 或 switch.turn\_off。

`home_assistant.call_service`

### List Events

列出实例当前已知的 Home Assistant 事件类型。

`home_assistant.list_events`

### Fire Event

触发一个 Home Assistant 事件，可附带事件数据。

`home_assistant.fire_event`

### Render Template

针对已连接实例渲染 Home Assistant 模板。

`home_assistant.render_template`

### Get History

获取一个或多个 Home Assistant 实体在一段时间内的记录状态历史，用于回答值如何变化的问题。

`home_assistant.get_history`

### Get Logbook

获取 Home Assistant 日志：人类可读的事件时间线及其触发原因，用于诊断变化原因。

`home_assistant.get_logbook`

### List Calendars

列出 Home Assistant 暴露的日历实体。

`home_assistant.list_calendars`

### List Calendar Events

列出开始和结束时间之间一个 Home Assistant 日历上的事件。

`home_assistant.list_calendar_events`

### Get Error Log

以纯文本形式获取当前会话的 Home Assistant 错误日志。仅当实例启用文件日志记录时，Home Assistant 才提供此功能，因此在正常实例上可能报告未找到。

`home_assistant.get_error_log`

### Get Registries

通过 WebSocket API 列出 Home Assistant 实体、设备、区域、楼层和标签注册表。

`home_assistant.get_registries`

### Search Related

查找与实体、设备、区域、自动化或配置条目相关的 Home Assistant 项目。

`home_assistant.search_related`

### List Device Automations

列出一个 Home Assistant 设备支持的触发器、条件和操作。

`home_assistant.list_device_automations`

### Execute Script

运行包含服务调用、延迟和条件的 Home Assistant 脚本序列。

`home_assistant.execute_script`

### Validate Config

在存储自动化之前验证 Home Assistant 触发器、条件和操作配置。

`home_assistant.validate_config`

### Get Automation Config

获取一个 Home Assistant 自动化的存储配置。需要管理员访问令牌，且仅涵盖存储在 Home Assistant UI 可编辑配置中的条目；其他 YAML 文件中定义的条目返回未找到。

`home_assistant.get_automation_config`

### Save Automation Config

创建或替换一个 Home Assistant 自动化。向未使用的 ID 发布会创建自动化。需要管理员访问令牌，且仅涵盖存储在 Home Assistant UI 可编辑配置中的条目；其他 YAML 文件中定义的条目返回未找到。

`home_assistant.save_automation_config`

### Delete Automation Config

删除一个 Home Assistant 自动化。需要管理员访问令牌，且仅涵盖存储在 Home Assistant UI 可编辑配置中的条目；其他 YAML 文件中定义的条目返回未找到。

`home_assistant.delete_automation_config`

### Get Script Config

获取一个 Home Assistant 脚本的存储配置。需要管理员访问令牌，且仅涵盖存储在 Home Assistant UI 可编辑配置中的条目；其他 YAML 文件中定义的条目返回未找到。

`home_assistant.get_script_config`

### Save Script Config

创建或替换一个 Home Assistant 脚本。向未使用的键发布会创建脚本。需要管理员访问令牌，且仅涵盖存储在 Home Assistant UI 可编辑配置中的条目；其他 YAML 文件中定义的条目返回未找到。

`home_assistant.save_script_config`

### Delete Script Config

删除一个 Home Assistant 脚本。需要管理员访问令牌，且仅涵盖存储在 Home Assistant UI 可编辑配置中的条目；其他 YAML 文件中定义的条目返回未找到。

`home_assistant.delete_script_config`

### Get Scene Config

获取一个 Home Assistant 场景的存储配置。需要管理员访问令牌，且仅涵盖存储在 Home Assistant UI 可编辑配置中的条目；其他 YAML 文件中定义的条目返回未找到。

`home_assistant.get_scene_config`

### Save Scene Config

创建或替换一个 Home Assistant 场景。向未使用的 ID 发布会创建场景。需要管理员访问令牌，且仅涵盖存储在 Home Assistant UI 可编辑配置中的条目；其他 YAML 文件中定义的条目返回未找到。

`home_assistant.save_scene_config`

### Delete Scene Config

删除一个 Home Assistant 场景。需要管理员访问令牌，且仅涵盖存储在 Home Assistant UI 可编辑配置中的条目；其他 YAML 文件中定义的条目返回未找到。

`home_assistant.delete_scene_config`

### Check Config

要求 Home Assistant 验证其自身配置文件并报告错误和警告。需要管理员访问令牌。

`home_assistant.check_config`

没有符合搜索条件的工具。

## 将 Home Assistant 接入 Open Flow

[连接 Home Assistant](https://console.openflow.run/connections/home_assistant)

每月 20,000 次免费应用调用（付费服务另计）
