trigger battery health, triggerbatteryhealth, kPMTriggerTriggerBatteryHealth — Trigger when a power source's battery health changes.


trigger battery health structure { type, now, before, filter };
type : string, choice
now : string, choice, optional
before : string, choice, optional
filter : power source filter structure, optional


Trigger when a power source's battery health changes.

The trigger will fire when a power source's battery health changes. This change will occur when one of the power source's detects that its battery health has changed. Typically the health of a battery will decline in quality over time. As the health declines, so the live span of the battery is reduced.

There may be multiple power sources. The trigger can filter which power source's can trigger using the name field as a filter. By providing a previous and now state, the trigger can further filter the power source changes that initiate the trigger.

A trigger without either a before or now state, will trigger whenever the power source state changes. A trigger with one or both the before and now state, will trigger only when those values are matched by the changing power source's state.


type. Type of trigger being described.

type is a string. type must be battery health, kPMTriggerType_BatteryHealth.

now. New health of the power source.

now is a string. now is optional. now must be one of the following six constants:

  • good, kPMTriggerNow_Good.
  • fair, kPMTriggerNow_Fair.
  • poor, kPMTriggerNow_Poor.
  • check, kPMTriggerNow_Check.
  • failure, kPMTriggerNow_Failure.
  • unknown, kPMTriggerNow_Unknown.

before. Previous health of the power source.

before is a string. before is optional. before must be one of the following six constants:

  • good, kPMTriggerBefore_Good.
  • fair, kPMTriggerBefore_Fair.
  • poor, kPMTriggerBefore_Poor.
  • check, kPMTriggerBefore_Check.
  • failure, kPMTriggerBefore_Failure.
  • unknown, kPMTriggerBefore_Unknown.

filter. Power sources to monitor.

filter is a power source filter structure. filter is optional.