update
This commit is contained in:
21
readme.md
21
readme.md
@@ -1,4 +1,4 @@
|
||||
# 灯光管理
|
||||
## 灯光管理
|
||||
|
||||
该模块提供对Home Assistant中灯光设备的管理功能,包括获取灯光列表、搜索特定灯光设备以及控制灯光的开关状态。
|
||||
|
||||
@@ -25,3 +25,22 @@ if(searchResult.hasMore) {
|
||||
console.log('没有找到匹配的灯光设备。');
|
||||
}
|
||||
```
|
||||
|
||||
## 音箱管理
|
||||
|
||||
该模块提供对Home Assistant中音箱设备的管理功能,执行文本指令等。
|
||||
|
||||
```ts
|
||||
import { TextHA } from '@kevisual/ha-api';
|
||||
|
||||
const tts = new TextHA({
|
||||
host: 'http://your-home-assistant:8123',
|
||||
token: 'your-long-lived-access-token',
|
||||
});
|
||||
// 获取所有音箱设备
|
||||
const entities = await text.getSpeakerEntities();
|
||||
// 执行文本指令
|
||||
const res2 = await text.executeTextDirective('text.xiaomi_lx06_9e08_execute_text_directive', '关闭阳台灯');
|
||||
console.log(res2);
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user