如何解决如何改变灯泡的光强度或颜色
我正在为连接的设备创建管理界面,并且正在使用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 举报,一经查实,本站将立刻删除。