【发布时间】:2021-07-01 07:11:50
【问题描述】:
我正在尝试让 Google Smart Home API 在 Gladys Assistant(它是一个开源家庭自动化软件)上运行,但我很难让 Google 集成测试通过。
这是我的 onSync:
onSync
{
"requestId": "9164924531720238290",
"payload": {
"agentUserId": "9aba8230-9e8d-47b7-9d1c-f4dd8725aad3",
"devices": [
{
"id": "mqtt-lamp-temperature",
"type": "action.devices.types.LIGHT",
"traits": [
"action.devices.traits.ColorSetting",
"action.devices.traits.Brightness",
"action.devices.traits.OnOff"
],
"name": {
"name": "Lampe Temperature"
},
"attributes": {
"colorModel": "rgb",
"colorTemperatureRange": {
"temperatureMinK": 2000,
"temperatureMaxK": 9000
}
},
"deviceInfo": {
"model": null
},
"roomHint": "Grand Salon",
"willReportState": true
}
]
}
}
这是我要发送到 reportState 的内容:
reportState
{
online: true,
color: { temperatureK: 3000, spectrumRgb: 8388863 },
on: true
}
这是 onQuery 返回给 Google API 的内容:
onQuery
{
'mqtt-lamp-temperature': {
online: true,
color: { temperatureK: 3000, spectrumRgb: 8388863 },
on: true
}
}
但这就是 Google 在集成测试中看到的:
AssertionError: Expected state to include:
{"color":{"temperatureK":{"xRange":[2600,3200]}}},
actual state: {"color":{"spectrumRGB":8388863},"on":true,"online":true}: expected false to be true
当 SpectrumRgb 属性在这里时,Google 似乎完全忽略了 temperatureK 属性。
为了证实我的理论,我尝试创建一个只有光谱Rgb 的灯和一个只有温度K 的灯,然后它完美地工作。问题是,在这种情况下,一些测试被跳过了,我想我不会得到谷歌的验证。
我的问题是:
为什么这些属性不能一起工作?灯不能由它的温度和它的 RGB 来控制吗?
你在我的实现中发现什么奇怪的地方吗?
非常感谢您的帮助!
【问题讨论】:
标签: actions-on-google google-smart-home