diff --git a/适配器.md b/适配器.md index 04feb52..118893b 100644 --- a/适配器.md +++ b/适配器.md @@ -690,23 +690,38 @@ Pay attention, that result will be returned asynchronous. #### Commands and Statuses #### 命令和状态 +我们应该区分命令和状态。 -We should distinguish between commands and statuses, when we are talking about states. -"Command" has **ack** flag as _false_ and will be sent by user (over vis, javascript-adapter, admin) to control the devices or specific adapter. Normally adapters (e.g. homematic) are subscribed on all own changes and if some state changes with _ack=false_, they will try to execute this command (e.g. light on). +“Command”将 **ack** 标志设置为false并由用户(通过vis,javascript-adapter,admin)发送以控制设备或特定适配器。 +通常,适配器(例如homematic)在所有自己的更改上订阅,如果某些状态在ack = false时更改,则它们将尝试执行此命令(例如,亮起)。 -"Status" has "ack" flag as _true_ and indicate that it is from device or service. E.g. if the weather adapter got new weather forecast, it will be published with _ack=true_ or if **homematic** thermometer measures new temperature, it will be published with _ack=true_ too. Even if the user physically will switch the light on, the new state will be published with ack=true. + +“Status”将“ack”标志设置为true,表示它来自设备或服务。 +例如,如果天气适配器获得新的天气预报,它将以ack = true发布, +又如如果温度计测量新的温度,它也将以ack = true发布。即使用户在物理上打开指示灯,新状态也将以ack = true发布。 _Ack=false_ will be normally overwritten by execution after the response from device. +Ack = false通常会在设备响应后执行。 E.g. if the user in "vis" has pressed the button and sent command _"hm-rpc.0.kitchen.light"=ON_. The **Socketio** adapter will send to the _hm-rpc.0_ instance the new state with _"kitchen.light" = {val: 1, ack: false}_. +例如,如果“vis”中的用户按下按钮并发送命令“hm-rpc.0.kitchen.light”= ON。该Socketio适配器将发送到HM-rpc.0实例的新状态“kitchen.light”= {VAL:1,ACK:假}。 Homematic adapter is subscribed for all states of _hm-rpc.0_ and if the new state will be received with _ack=false_, it sends the new value to the physical switch. +Homematic适配器订阅了hm-rpc.0的所有状态,如果接收新状态ack = false,它会将新值发送到物理交换机。 + Physical switch executes the command and sends to _hm-rpc_ adapter the new own state **ON**. The _hm-rpc.0_ adapter publishes the new status of state _"hm-rpc.0.kitchen.light"={val: 1, ack: true}_ (with time stamps). +物理交换机执行命令并向hm-rpc适配器发送新的自身状态ON。所述HM-rpc.0适配器发布状态的新状态“HM-rpc.0.kitchen.light”= {VAL:1,ACK:真}(具有时间戳)。 + This change will not be executed by _hm-rpc_ adapter, because **ack** is _true_. And this is an acknowledgment from physical device. +hm-rpc适配器不会执行此更改,因为ack为true。这是来自物理设备的确认。 + + #### How to write state +#### 如何写状态 + States can be written as commands or as statuses. For that ```adapter.setState``` and ```adapter.setForeignState``` must be used: ```