You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

HomeAssistant自定义按钮调用remote.send_command服务报错求助

问题描述

在HomeAssistant中,通过开发者工具调用remote.send_command服务可正常开启客厅空调,配置如下:

service: remote.send_command
data:
  device: Livingroom-aircon
  command: "On"
target:
  entity_id: remote.broadlink_rm4_pro

但使用custom:button-card配置自定义按钮时,点击出现报错:

Failed to call service remote/send_command. required key not provided @data['command']
使用原生button组件配置相同服务调用则正常工作,需解决custom:button-card的调用问题,以支持自定义图形、信息与动画效果。

解决方案

custom:button-card的服务调用格式与原生button组件存在差异,需将服务参数放入service_data字段中,而非直接使用data字段。正确配置示例如下:

type: custom:button-card
name: 开启客厅空调
tap_action:
  action: call-service
  service: remote.send_command
  service_data:
    device: Livingroom-aircon
    command: "On"
  target:
    entity_id: remote.broadlink_rm4_pro

关键说明

  • 原生button组件中直接使用data传递服务参数,但custom:button-card要求将这些参数放在service_data下
  • target字段可直接与service、service_data同级放置在tap_action内

内容的提问来源于stack exchange,提问作者Peter Page

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 04:20:22