Automation Store
AutomationStore 负责管理应用程序中的自动化触发器和自动化规则。通过自动化功能可以创建基于上下文的规则,根据节点参数变化、天气状况或日出日落等条件自动触发设备操作。
概述
AutomationStore 支持以下功能:
- 管理和同步自动化列表
- 按事件类型(节点、天气、日照)分类管理自动化
- 管理地理坐标信息
- 启用或禁用自动化
- 与后端服务自动同步
- 响应式状态管理
访问 AutomationStore
可通过 CDF 实例访问 AutomationStore:
const automationStore = espCDF.automationStore;
构造函数
constructor
创建一个新的 AutomationStore 实例。
new AutomationStore(rootStore?: CDF)
参数
rootStore(可选):CDF 根 Store 实例。
属性
| 属性 | 类型 | 描述 |
|---|---|---|
| automationList | ESPAutomation[] (computed) | 包含 AutomationStore 中所有自动化的计算属性数组(整合了节点、天气和日照自动化)。 |
| nodeAutomationList | ESPAutomation[] (computed) | 节点自动化的计算属性数组(由节点参数变化触发)。 |
| weatherAutomationList | ESPAutomation[] (computed) | 天气自动化的计算属性数组(由天气条件触发)。 |
| daylightAutomationList | ESPAutomation[] (computed) | 日照自动化的计算属性数组(由日出/日落触发)。 |
| nodeAutomations | { [key: string]: ESPAutomation } | 以自动化 ID 为键的节点自动化字典。 |
| weatherAutomations | { [key: string]: ESPAutomation } | 以自动化 ID 为键的天气自动化字典。 |
| daylightAutomations | { [key: string]: ESPAutomation } | 以自动化 ID 为键的日照自动化字典。 |
| geoCoordinates | ESPGeoCoordinates | null | 天气和日照自动化所需的地理坐标。 |
| hasNext | boolean |