Skip to content

Battery

José Antonio Jiménez Campos edited this page Dec 18, 2024 · 19 revisions

A battery service with "low battery" threshold. Battery level and charging status must be set using Free Monitor or Service Notifications.

This service was implemented in firmware version 1.8.0

Type Service Type
70 Battery

Battery Service is incompatible with a main service and it should be declared as extra service.

The following configuration is available:

Section Key Description
Low Battery Threshold "l" Sets low battery threshold value
Actions "0", "1" The actions performed by the service
Wildcard Actions "y[n]" Perform an action when an service reaches a target value
Service Notifications "m" Notifications sent by another service
Initial Lock State "ks" Lock state at boot
Service Characteristics

Example of a switch with a Battery Service taking values from a Free Monitor Service using ADC pin. Low battery threshold is set to 25%:

{
  "a":[
    {
      "t" : 1,
      "es" : [
        {
          "t" : 70,
          "l" : 25
        }
    ]
    }, {
      "t"  : 80,
      "h"  : 0,
      "n"  : 10,
      "j"  : 5,
      "ff" : 0.09775171066,
      "tg" : [ 2, 0 ]
    }
  ]
}

Low Battery Threshold

Key Default Type Description
"l" 20 integer Sets low battery threshold value

When battery level changes, if new value is equal or under this, low battery status will be enabled. And disabled when battery level is over the threshold.

Actions

These actions are only related to LOW battery threshold, and will be triggered when its state changes.

Key Action Description
"0" No LOW battery
"1" LOW battery

Service Notifications

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

Value Notification
0 to 100 Set remaining battery level
-100 to -1 Increase battery level
-200 to -101 Decrease battery level (-100)

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

Wildcard Actions

Wildcard Actions "y[n]" are supported by this service. The supported list is:

Key Action
"y0" Trigger action when service reaches a specific battery level

Refer to Wildcard Actions for more detail.

Initial Lock State

The Initial Lock State about Service and Physical controls.

Key Value Notification
"ks" 0 All locked
3 All unlocked (default)

Service Characteristics

Characteristic Description
0 Battery % value
1 Low battery warning
0 -> Warning OFF
1 -> Warning ON
2 Charging Status
0 -> Not charging
1 -> Charging
2 -> Not chargeable
Clone this wiki locally