ZigBeeForDomoticZ plugin Wiki

ZiGate PDM on host

Preamble

The purpose is to externalize the ZiGate Permanent Data Memory (PDM) which is usally store on the EEPROM. Instead the PDM storage will be delegated to the Host (the plugin).

The expected benefits are:

Potential traps.

References:

Principles

In order to allow Read and Write on the PDMonhost, a new series of messages are available. Those messages will drive all Read/Write operations.

On the host side, you will have to store the PDM in order to get it available for a cold restart ( ZiGate power off ). Several alternatives are available, for ZGUI the implementation is based on an SQLITE3 Database, on the plugin this will mainly be managed in memory with a python3 dictionnary and then store on disk via a serialization method (json or pickle)

From the host side, you cannot figure out if the ZiGate state is the result of a cold restart (powered off) or hot restart (nothing change from last connection).

Do consider that the communication will go through the serial line (for PiZigate, USB-Zigate), and there is a limitation in terms of packet size. When transfering block of data the max size is 256bytes, and you need for record larger than 256 bytes.

Hot restart

Cold restart

ZiGate APIs for PDM on Host

E_SL_MSG_SAVE_PDM_RECORD = 0x0200

PDM_E_STATUS_OK (success) PDM_E_STATUS_INVLD_PARAM (specified record ID is invalid) PDM_E_STATUS_NOT_SAVED (save to EEPROM failed)

E_SL_MSG_SAVE_PDM_RECORD_RESPONSE = 0x8200

E_SL_MSG_LOAD_PDM_RECORD_REQUEST = 0x0201

E_SL_MSG_LOAD_PDM_RECORD_RESPONSE = 0x8201

E_SL_MSG_DELETE_ALL_PDM_RECORDS_REQUEST = 0x0202

E_SL_MSG_DELETE_PDM_RECORD_REQUEST = 0x0203

PDMCreateBitmap = 0x0204

PDMDeleteBitmapRequest = 0x0205

E_SL_MSG_GET_BITMAP_RECORD_REQUEST = 0x0206

E_SL_MSG_GET_BITMAP_RECORD_RESPONSE = 0x8206

E_SL_MSG_INCREMENT_BITMAP_RECORD_REQUEST = 0x0207

PDM_E_STATUS_OK (success) PDM_E_STATUS_INVLD_PARAM (an invalid parameter value was supplied) PDM_E_STATUS_PDM_FULL (no further EEPROM segments for the bitmap) PDM_E_STATUS_BITMAP_SATURATED_OK (increment made but segment now saturated)

E_SL_MSG_INCREMENT_BITMAP_RECORD_RESPONSE = 0x8207

E_SL_MSG_PDM_EXISTENCE_REQUEST = 0x0208

E_SL_MSG_PDM_EXISTENCE_RESPONSE = 0x8208

E_SL_MSG_PDM_HOST_AVAILABLE = 0x0300

E_SL_MSG_PDM_HOST_AVAILABLE_RESPONSE = 0x8300

data Type Value
status uint8 PDM_E_STATUS_OK

E_SL_MSG_PDM_LOADED = 0x0302