Skip to content

Data History

José Antonio Jiménez Campos edited this page Aug 8, 2023 · 7 revisions

This service allow to save a register in time of a defined characteristic of other service. It can save any numeric value from any characteristic of any service, even from hidden services.

Type Service Type
95 Data History

HAA Home Manager App is needed to read data history. Other third-party HomeKit clients will not work. It will save all data in your device only opening it. There is not needed to enter into each data history service.

A NTP server is required in order to this service works.

This service can be declared as a main service of an accessory, however, it is recommended to setup it into extra services array, but it must be declared in MEPLHAA script after target service.

The following configuration is available:

Section Key Description
Configuration Data "h" Information to configure the service
Polling Time "j" How often the characteristic value is read
Read on Clock Ready "x" Read value when HAA clock is ready
Service Notifications "m" Notifications sent from another service
Initial Lock State "ks" Lock state at boot

Example

{
  "a": [{
    "t": 1,
    "es": [{
      "t": 95,
      "h": [ 1, 0, 5 ]
    }]
  }]
}

In this example, there is an accessory with a switch as a main service, and a historical data as an extra service. That service will store switch (service number 1) value (characteristic 0) each time it is triggered, saving last 500 changes (5 blocks).

Configuration Data

This array is used to define configuration of service.

Key Value
"h" [ Service, Characteristic, Blocks ]
  • Service: Index number of the service that has the characteristic to register. It is the same used by Service Notification action.
  • Characteristic: Index number of characteristic to register. See each service to know them.
  • Blocks: Number of blocks used to store data in DRAM. Each block can store 100 registers, and used about 1KB of DRAM.

Characteristics marked with * will not be saved with each change. However, they must be read using Polling Time or Service Notifications.

When all blocks are full, oldest values will be overwritten with news.

Polling Time

Polling time is defined by the "j" key contained within the service object.

Characteristic value will be saved each defined polling time seconds.

Key Value Description
"j" 0 Polled is disabled (default)
0.1 to 65535 Float specifying the number of seconds between polls

Read on Clock Ready

Take a read when HAA clock is ready with NTP server.

Key Value Description
"x" 0 Disabled (default)
1 Enable

Service Notifications

The list of Service Notifications "m" values supported are:

Key Value Notification
"v" 0 Save current characteristic value (default)

See the general Service Notifications section for details of how to configure these notifications.

Initial Lock State

The Initial Lock State about Service and Physical controls.

Key Value Notification
"ks" 0 Locked
1 Unlocked (default)