Google Home脚本编辑器中InputValue字段报错求助
Google Home Script Editor 输入结构报错解决方法
你遇到的问题根源是inputValue并非Google Home Script YAML语法里的合法字段,官方定义的脚本结构中不存在这个配置项,因此编辑器会抛出"Field [inputValue] is unexpected in the struct."的错误。
正确的处理方式是删除inputValue整段配置,只保留input部分的定义即可。当你保存或部署脚本时,Google Home界面会自动弹出设备选择器,让你挑选需要关联的卷帘设备,完成选择后,脚本里的$rollerShutters变量会自动绑定你选中的设备,无需手动预设设备名称。
修正后的完整脚本如下:
metadata: name: Roller shutter description: Automation of the roller shutter ############# # INPUT ############# input: rollerShutters: metadata: name: en: rollerShutters description: en: List of all roller shutters selector: type: device multiSelect: true ############# # ACTIONS ############# automations: ############# # On sun rise open ############# - starters: - type: time.schedule at: sunrise actions: - type: device.command.OpenClose openPercent: 100 devices: $rollerShutters ############# # At night close all ############# - starters: - type: time.schedule at: sunset actions: - type: device.command.OpenClose openPercent: 0 devices: $rollerShutters
部署这个修正后的脚本,按照提示完成设备选择,就能正常运行日出打开、日落关闭卷帘的自动化逻辑了。
内容的提问来源于stack exchange,提问作者AlonsoFloo
相关产品推荐
相关产品推荐

