Home Assistant 中为 Sensibo 设备启用 Climate React(Climate React)动作完全指南
【免费下载链接】home-assistant.io:blue_book: Home Assistant User documentation项目地址: https://gitcode.com/GitHub_Trending/ho/home-assistant.io
导读
本文围绕 Home Assistant 官方文档库中的sensibo.enable_climate_react动作展开,讲解如何在自动化与脚本中为 Sensibo 空调设备启用并配置 Climate React 功能——当温度、体感温度或湿度跨越你设定的阈值时,设备自动切换到你预先定义的状态。读完本文,你将掌握该动作在 UI 与 YAML 两种配置方式下的完整参数、完整状态(full state)的写法、阈值与触发类型的搭配,以及如何借助sensibo.get_device_capabilities动作获取设备支持的合法取值,避免因大小写或取值不匹配而调用失败。
什么是 Climate React
Climate React 是 Sensibo 设备(Sensibo Sky、Sensibo Air、Sensibo Air Pro 等)内置的智能恒温逻辑。其核心行为是:当传感器检测到的温度(temperature)、体感温度(feels-like temperature)或湿度(humidity)越过你设置的阈值时,设备自动切换到你在动作中定义的状态。
在 Home Assistant 中,这条逻辑通过sensibo.enable_climate_react动作触发。执行该动作后,Home Assistant 会调用 Sensibo 云 API 完成两件事:
- 启用 Climate React(动作本身自带启用效果,无需先单独打开开关);
- 写入高/低两个阈值以及对应的设备状态。
从集成文档 source/_integrations/sensibo.markdown 可以看到,Climate React 相关的数据会以实体形式暴露给 Home Assistant,包括:
- Climate React type(Temperature / Feels like / Humidity)
- Climate React low temperature threshold(低阈值设置)
- Climate React high temperature threshold(高阈值设置)
同时,集成的 Switches 列表中也包含Climate React开关,用于在启用后随时查看或手动关闭该功能(见 source/_integrations/sensibo.markdown)。
重要前提:高/低状态(high/low state)是"完整状态"(full state),必须与 Sensibo API 期望的字段与取值完全一致且区分大小写。因此首次配置时,最稳妥的做法是在 Sensibo 官方 App 中先完成 Climate React 的配置,再通过 Get device mode capabilities 动作获取设备支持的合法取值,最后写入 Home Assistant 的自动化或脚本。
在 UI 中启用 Climate React
如果你更习惯用可视化方式构建自动化,Home Assistant 会在界面中一步步引导你完成配置。
操作步骤
- 进入设置 > 自动化与场景(Automations & scenes)。
- 打开一条已有的自动化或脚本,或选择创建自动化>创建新自动化。
- 如果是新建自动化,先在When(何时)区域添加一个触发器。脚本(scripts)不需要触发器,它们由其他东西调用时才会运行。
- 在Then do(然后执行)区域,选择添加动作(Add action)。
- 选择你要控制的对象:在By target(按目标,见下文"动作的目标")下选择 Sensibo 空调设备。
- 从该目标对应的动作列表中,选择Sensibo: Enable Climate React。
- 设置阈值(thresholds)、状态(states)与触发类型(trigger type)。
- 点击保存。
UI 中的选项
| 选项 | 说明 |
|---|---|
| Threshold high(高阈值) | 当数值高于该值时,应用"高阈值状态"。 |
| State high threshold(高阈值状态) | 当数值高于高阈值时应用的完整状态。 |
| Threshold low(低阈值) | 当数值低于该值时,应用"低阈值状态"。 |
| State low threshold(低阈值状态) | 当数值低于低阈值时应用的完整状态。 |
| Trigger type(触发类型) | 触发依据:温度(temperature)、体感温度(feels-like)或湿度(humidity)。 |
在 YAML 中使用该动作
在 YAML 中,动作名称为sensibo.enable_climate_react。如果你直接编写 YAML,或者想确切知道 Home Assistant 底层做了什么,这一节给出了技术参考:字段名、类型以及哪些字段是必填的。
基础示例
官方文档给出如下基础示例,展示了温度触发场景下的完整配置:
action: sensibo.enable_climate_react target: entity_id: climate.living_room data: high_temperature_threshold: 24 high_temperature_state: on: true targetTemperature: 21 mode: cool fanLevel: high temperatureUnit: C swing: stopped horizontalSwing: stopped light: "on" low_temperature_threshold: 19 low_temperature_state: on: true targetTemperature: 23 mode: heat fanLevel: high temperatureUnit: C swing: stopped horizontalSwing: stopped light: "on" smart_type: temperature这个例子的业务语义是:室温高于 24 ℃ 时切换到制冷(cool,目标 21 ℃,高风速);室温低于 19 ℃ 时切换到制热(heat,目标 23 ℃,高风速)。smart_type: temperature表明触发依据是实际温度。
YAML 参数详解
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
high_temperature_threshold | float | 是 | 当数值高于该值时应用"高阈值状态"。 |
high_temperature_state | map | 是 | 当数值高于高阈值时应用的完整状态。 |
low_temperature_threshold | float | 是 | 当数值低于该值时应用"低阈值状态"。 |
low_temperature_state | map | 是 | 当数值低于低阈值时应用的完整状态。 |
smart_type | string | 是 | 触发依据:temperature、feelslike或humidity。 |
完整状态(full state)的写法
高阈值状态与低阈值状态都是完整状态(full state),即一次描述设备全部可设置项的映射。官方文档给出的完整状态示例为:
on: true fanLevel: high temperatureUnit: C targetTemperature: 23 mode: cool swing: fixedBottom horizontalSwing: fixedLeft light: "on"各字段说明:
| 字段 | 含义 |
|---|---|
on | 设备电源开关状态(true/false)。 |
fanLevel | 风扇档位,如high、medium、low等。 |
temperatureUnit | 温度单位,如C(摄氏度)、F(华氏度)。 |
targetTemperature | 目标温度数值。 |
mode | HVAC 模式,如cool、heat、dry、fan、auto、off。 |
swing | 垂直摆风模式,如stopped、fixedBottom等。 |
horizontalSwing | 水平摆风模式,如stopped、fixedLeft等。 |
light | 设备指示灯状态,"on"/"off"/"dim"。 |
动作的目标(Targets)
该动作必须指定目标(target)。目标就是动作的作用对象,可以指向单个实体、设备、区域、楼层或标签,Home Assistant 会对目标下所有匹配的climate实体执行动作(相关通用说明见 source/_includes/actions/targets.md):
- 实体(Entity):某一个具体的 climate 实体,例如
climate.living_room。 - 设备(Device):属于某台设备的所有 climate 实体。
- 区域(Area):某个房间/区域内的所有 climate 实体。
- 楼层(Floor):某一楼层内的所有 climate 实体。
- 标签(Label):共享某个标签的所有 climate 实体。
你也可以在同一个动作中混合使用多种目标类型,例如同时添加一个具体实体和一个区域,让动作一次性作用于两者。
实战:完整自动化示例
场景一:早晚温差自动调节(UI 之外,直接用 YAML 编写)
将上面的基础示例套进完整的自动化骨架,当室温过高时自动制冷、过低时自动制热:
alias: "Climate React - 温度自适应" triggers: - trigger: time at: "07:00:00" actions: - action: sensibo.enable_climate_react target: entity_id: climate.living_room data: high_temperature_threshold: 24 high_temperature_state: on: true targetTemperature: 21 mode: cool fanLevel: high temperatureUnit: C swing: stopped horizontalSwing: stopped light: "on" low_temperature_threshold: 19 low_temperature_state: on: true targetTemperature: 23 mode: heat fanLevel: high temperatureUnit: C swing: stopped horizontalSwing: stopped light: "on" smart_type: temperature场景二:按体感温度触发
将smart_type改为feelslike,即可让 Climate React 依据体感温度(结合湿度等因素的体感值)而非实际温度来切换状态。同理,改为humidity即可实现"湿度过高自动除湿、湿度过低自动加湿"等场景。其余阈值与状态字段的写法与温度示例完全一致。
场景三:结合设备能力查询动态取值
由于完整状态中的取值区分大小写且必须与 Sensibo API 完全一致,不同型号设备支持的fanLevel、swing、horizontalSwing等取值可能不同。最佳实践是:
- 先用
sensibo.get_device_capabilities动作查询某 HVAC 模式下设备支持的所有设置及合法取值(该动作只查询、不改动设备,返回结果可通过response_variable保存为响应变量):
action: sensibo.get_device_capabilities target: entity_id: climate.living_room data: hvac_mode: cool response_variable: capabilities- 从返回的
capabilities变量中挑选合法取值,原样(保持大小写)填入high_temperature_state/low_temperature_state。
完整的设备能力查询说明见 source/_actions/sensibo.get_device_capabilities.markdown,完整状态动作见 source/_actions/sensibo.full_state.markdown(其中还包含"每天 18:00 设置完整状态"的自动化示例,可作参考)。
相关动作一览
以下动作与sensibo.enable_climate_react配合使用效果最佳:
- Get device mode capabilities:返回所选 HVAC 模式下设备支持的设置及合法取值(区分大小写),是配置 Climate React 状态的前置查询工具。
- Full state:用一条命令把完整状态一次性发送给设备,Climate React 的高/低状态本质上就是两份完整状态。
此外,同域的关联动作还包括:
- Enable Pure Boost:在 Sensibo Pure 空气净化器上启用 Pure Boost。
- Enable timer:为设备启用定时。
- Assume state:在设备被物理遥控器等外部手段控制、Sensibo 与实际状态不同步时,仅向 Sensibo 声明设备开关状态而不向设备发送控制命令。
常见问题与注意事项(Good to know)
- 完整状态必须完整合法:高/低状态都是完整状态,字段与取值必须与 Sensibo API 期望完全一致,且所有值都区分大小写。建议先用 Get device mode capabilities 查询合法值。
- 首次配置从 App 开始:因为取值要求严格,第一次配置时最省事的方式是在 Sensibo 官方 App 中先配置好 Climate React,再到 Home Assistant 中查询并复用同样的状态值。
- 动作自带启用效果:执行
sensibo.enable_climate_react会同时完成"启用"与"配置",无需预先单独打开 Climate React 开关。之后若想关闭,可在集成的 Climate React 开关实体上操作。 - 目标必须为 climate 实体:该动作面向空调设备,目标解析为 climate 实体(如
climate.living_room)。在自动化 UI 中可通过实体、设备、区域、楼层或标签指定。 - 设备支持决定字段可用性:根据 source/_integrations/sensibo.markdown 中列出的支持设备,Climate React 主要面向 Sky、Air、Air Pro 等空调控制设备;不同设备支持的设置项不同,只应提供设备支持的那些字段。
总结
sensibo.enable_climate_react是 Home Assistant 中把 Sensibo 的智能恒温能力接入自动化体系的关键动作。本文完整覆盖了其 UI 配置路径、YAML 参数(high_temperature_threshold、high_temperature_state、low_temperature_threshold、low_temperature_state、smart_type)、完整状态写法、目标指定方式以及配套的sensibo.get_device_capabilities查询流程。只要严格保证状态值与 Sensibo API 一致(区分大小写)、只填写设备支持的字段,即可实现"温度/体感/湿度越界自动切换设备状态"的自动化恒温策略。
【免费下载链接】home-assistant.io:blue_book: Home Assistant User documentation项目地址: https://gitcode.com/GitHub_Trending/ho/home-assistant.io
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考