问题描述
我正在为连接的设备创建管理界面,并且正在使用https://github.com/ndg63276/smartlife中项目的变体,但是在该项目中,它无法更改所连接灯泡或灯泡的亮度。颜色。我在网上浏览了一下,但找不到太多解决方案。
例如 关闭我使用的灯泡/插座:
async switchDevice(params: { deviceId: string; newState: 1 | 0 }): Promise<void> {
const url = `${this._proxyurl}${this._baseurl}skill`;
const data = {
header: {
name: 'turnOnOff',namespace: 'control',payloadVersion: 1,},payload: {
accessToken: this._accessToken,devId: params.deviceId,value: params.newState,};
try {
const res: SmartLifeDeviceSwitchRes = await this._http.post(url,JSON.stringify(data),{
headers: {
'Content-Type': 'application/json',}).toPromise() as SmartLifeDeviceSwitchRes;
if (!isEqual(res.header.code,'SUCCESS')) {
this._showErrorMessage('switch-device');
}
} catch (error) {
this._showErrorMessage('switch-device');
console.error(error);
}
}
例如,除了“ turnOnOff”以外,还有其他属性吗?还是会超过亮度或颜色的值?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)