From d6d4fdec06db6706d149ec873a1d92c3f6e53d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=9F=E8=BF=9B?= Date: Sun, 23 Sep 2018 21:12:01 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E9=80=82=E9=85=8D=E5=99=A8.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 适配器.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/适配器.md b/适配器.md index d9d1e6c..e06ee4b 100644 --- a/适配器.md +++ b/适配器.md @@ -28,7 +28,7 @@ - [Functions](#functions) -- [How to create instance](#how-to-create-instance) +- [如何创建实例](#如何创建实例) - [How to debug](#how-to-debug) - [admin.html](#adminhtml) - [最佳实践](#best-practice) @@ -786,15 +786,15 @@ adapter.getObject('myObject', function (err, obj) { }); ``` -Functions are always asynchronous. +函数始终是异步的。 + Objects of adapter must be organized in devices, channels and states. See: getForeignObjects, findForeignObject, getForeignObject, getDevices, getChannels, getStatesOf -#### How to write object -To write the objects generally two functions can be used: setObject, setForeignObject. -But there are many help functions to modify objects: +#### 写对象 +要编写对象,通常可以使用两个函数:setObject,setForeignObject。但是有许多帮助函数来修改对象: - extendObject, extendForeignObject, - delObject, delForeignObject, @@ -804,11 +804,12 @@ But there are many help functions to modify objects: - createState, deleteState - addStateToEnum, deleteStateFromEnum +extendObject只是读取对象,与给定对象合并并将对象写回。 extendObject is just reads object, merges with given one and write object back. Difference between xxxObject and xxxForeignObject is that xxxObject automatically extends the object id with "adapter.instance." text. -Functions are always asynchronous. +函数始终是异步的。 ``` adapter.getForeignObject('otherAdapter.X.someState', function (err, obj) { @@ -825,6 +826,10 @@ adapter.getForeignObject('otherAdapter.X.someState', function (err, obj) { ``` #### info.connection +如果适配器建立并监视某些连接(例如,对受控设备),则应创建并维护info.connection变量。 + +如果发生这种情况,连接状态将显示在“admin”的实例列表中,如果需要,将根据连接状态设置状态质量。 + If the adapter establishes and monitors some connection (e.g. to controlled device), it should create and maintenance **info.connection** variable. If it happens, the status of connection will be shown in the instance's list in "admin" and if desired, the quality of states will be set up depends on the connection status. @@ -915,7 +920,9 @@ EVENTS: - stateChange(id, state) (Warning state can be null if deleted) - unload -## How to create instance +## 如何创建实例 +在发布到npm之前:复制到ioBroker / node_modules,转到“admin”并添加实例在npm发布后:转到ioBroker /并写入“npm install iobroker.xxx --production”,转到“admin”并添加实例 + Before published to npm: copy into ioBroker/node_modules, go to "admin" and add instance After published at npm: go to ioBroker/ and write "npm install iobroker.xxx --production", go to "admin" and add instance @@ -946,5 +953,5 @@ After published at npm: go to ioBroker/ and write "npm install iobroker.xxx --pr - function getTableResult(tabId, cols) -## Best practice +## 最佳实践 ... \ No newline at end of file