
Home Assistant Sensibo 集成用 sensibo.get_device_capabilities 查询设备模式能力精准配置 Climate 设备【免费下载链接】home-assistant.io:blue_book: Home Assistant User documentation项目地址: https://gitcode.com/GitHub_Trending/ho/home-assistant.io本文以 Home Assistant 文档仓库中sensibo.get_device_capabilities动作页为核心完整讲解这一动作的用途、UI 与 YAML 两种配置方式、参数取值、响应数据结构以及它与sensibo.full_state、sensibo.enable_climate_react等动作的协作关系。读完你可以掌握如何在自动化和脚本中先查询能力再下发状态从而避免向 Sensibo 设备写入 API 不接受的大小写敏感取值。为什么需要先查能力再下发状态Sensibo 集成集成文档通过 Sensibo 云 API 轮询设备默认每分钟一次并暴露 climate 等实体。它的几个专用动作对取值有硬性要求sensibo.full_state一次性向设备下发完整状态mode、温度、风扇、摆动、灯光等sensibo.enable_climate_react配置 Climate React当温度、体感温度或湿度越过阈值时自动切换到你定义的高/低状态。这两个动作都要求所传数值与 Sensibo API 完全一致且大小写敏感case-sensitive。不同型号的空调/控制器支持的风扇档位、摆动模式各不相同例如摆动模式取值是fixedMiddleTop、fixedCenter这类驼峰命名而不是fixed_middle_top。如果凭感觉写值指令可能被 API 拒绝或行为不符合预期。sensibo.get_device_capabilities就是为这个问题设计的它返回指定 HVAC 模式下设备实际支持的设置及其允许取值列表你可以直接把返回值复制进其他动作、自动化或脚本中。两点关键性质见动作文档它把结果作为**响应数据response data**返回用于在脚本/自动化中做后续模板处理它是只读查询不会改变设备上的任何设置。在 UI 中配置该动作按照文档给出的步骤在设置 自动化与场景中配置进入Settings Automations scenes自动化与场景打开一个已有的自动化或脚本或选择Create automationCreate new automation新建如果是新建自动化在When触发条件部分添加触发器脚本不需要触发器由其他机制调用时执行在Then do执行动作部分选择Add action在By target按目标下选择你的 Sensibo climate 设备实体在该目标可用的动作中选择Sensibo: Get device mode capabilities选择要查询的HVAC mode选择Save保存。参数说明UI 与 YAML 中的选项一致核心只有一个必填参数参数类型必填说明hvac_modestring是要查询能力所用的 HVAC 模式取值cool、heat、dry、fan、auto注意该参数只有这五个模式不含off因为它查询的是某种工作模式下设备支持哪些设置而off模式没有需要查询的运行参数。目标实体通过通用的target机制指定文档中通过domainclimate引入的 Targets 部分说明只能选择 Sensibo 集成提供的 climate 实体。YAML 配置示例在 YAML 中该动作写作sensibo.get_device_capabilities文档给出的基础示例如下action: | action: sensibo.get_device_capabilities target: entity_id: climate.living_room data: hvac_mode: cool response_variable: capabilities其中response_variable: capabilities把动作返回的能力映射存入名为capabilities的变量供同一脚本/自动化中的后续步骤或模板引用而不仅仅是查看。响应数据结构与大小写敏感问题动作返回一个映射mapping描述设备在所选 HVAC 模式下支持的设置以及每个设置的允许取值列表。根据设备不同可能包括风扇档位fan levels摆动模式swing modes水平摆动模式horizontal swing modes目标温度target temperatures灯光选项light options。文档特别强调返回的取值大小写敏感必须原样复制。这一点从相关动作的示例中可以直观看到。在 sensibo.enable_climate_react 文档 中完整状态full state的字段是驼峰命名的on、targetTemperature、mode、fanLevel、temperatureUnit、swing、horizontalSwing、light取值如fixedBottom、fixedLeft、stoppedaction: | 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而sensibo.full_state见其文档中的字段则采用下划线命名target_temperature、fan_mode、swing_mode、horizontal_swing_mode、light但取值本身仍然大小写敏感如集成文档示例中的swing_mode: fixedMiddleTop、horizontal_swing_mode: fixedCenter见 Sensibo 集成文档 的 Examples 部分automation: alias: Example full state triggers: - trigger: time at: 18:00:00 actions: - action: sensibo.full_state data: mode: heat target_temperature: 23 fan_mode: medium swing_mode: fixedMiddleTop horizontal_swing_mode: fixedCenter light: off target: entity_id: climate.hvac_device这正是get_device_capabilities的价值所在不同设备的fanLevel/swing合法集合不同与其记忆这些值不如先跑一次查询、把允许值列表拉下来再填写。同时记住两条规则来自 full_state 文档的 Good to know只下发你的设备支持的字段所有取值必须与 Sensibo API 期望的完全一致。推荐的实战工作流结合文档仓库中该动作的related actions引用关系sensibo.full_state与sensibo.enable_climate_react均在元数据中把本动作列为相关动作一套典型配置流程是查询在脚本或自动化中调用sensibo.get_device_capabilities指定hvac_mode如cool用response_variable保存结果确认取值查看返回的允许值映射确认目标模式下的风扇档位、摆动模式、温度范围等下发把确认过的取值填入sensibo.full_state一次性完整状态或sensibo.enable_climate_react的高/低状态 map 中验证打开Settings Tools Actions开发者工具的动作页面即文档中 Try it yourself 部分所指入口搜索该动作、填写字段并Perform action无需写 YAML 即可在真实设备上验证效果。同一动作家族中还有几个可配合使用的动作sensibo.assume_state仅更新 Sensibo 侧认为的设备开/关状态不向设备发命令用于物理遥控导致失步时纠正见其文档、sensibo.enable_timer、sensibo.enable_pure_boost。另外从集成文档可见该集成为云轮询Cloud Polling架构、需先在 Sensibo 网站注册 API key 完成配置流且部分实体默认禁用、需手动启用——理解这些背景有助于解释为何能力随设备型号而差异明显。小结sensibo.get_device_capabilities是 Sensibo 集成中只读、返回响应数据、大小写敏感三特征兼具的查询动作它以hvac_modecool/heat/dry/fan/auto为唯一必填参数返回所选模式下设备支持的设置及允许取值。把它放在full_state或enable_climate_react之前执行是保证下发取值与 Sensibo API 完全匹配的最可靠方式。本文所有配置示例均可在仓库对应文档中找到原文动作主文档、full_state、enable_climate_react 与 Sensibo 集成说明。【免费下载链接】home-assistant.io:blue_book: Home Assistant User documentation项目地址: https://gitcode.com/GitHub_Trending/ho/home-assistant.io创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考