control: Json action to set zone's target from group

This commit adds an action to fan control json format, supporting
setting target of Zone to a value corresponding to the maximum
value from group member properties. The mapping is according to
the map. If there are more than one group using this action, the
maximum speed derived from the mapping of all groups will be set
to target.

For example:
{
   "name": "target_from_group_max",
   "groups": [
        {
           "name": "zone0_ambient",
           "interface": "xyz.openbmc_project.Sensor.Value",
           "property": { "name": "Value" }
        }
   ],
   "neg_hysteresis": 1,
   "pos_hysteresis": 0,
   "map": [
        { "value": 10.0, "target": 38.0 },
        ...
   ]
}

The above JSON will cause the action to read the property specified
in the group "zone0_ambient" from all members of the group. The
change in the group's members value will be checked against
"neg_hysteresis" and "pos_hysteresis" to decide if it is worth
taking action. "neg_hysteresis" is for the increasing case and
"pos_hysteresis" is for the decreasing case. The maximum property
value of the group will be mapped to the "map" to get the output
"target". The updated "target" value of each group will be stored
in a static map with a key. The maximum value from the static map
will be used to set to the Zone's target.

Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Change-Id: I7b99a6e82ab2faaf40d290ab6f9cb27781e12952
5 files changed