Merge pull request #103 from MJDSys/fix_battery_information

This commit is contained in:
rbaron 2023-02-02 08:14:47 +01:00 committed by GitHub
commit d292190d31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View file

@ -67,8 +67,8 @@ ZB_ZCL_DECLARE_REL_HUMIDITY_MEASUREMENT_ATTRIB_LIST(
ZB_ZCL_DECLARE_POWER_CONFIG_BATTERY_ATTRIB_LIST_EXT(
batt_attr_list,
&dev_ctx.batt_attrs.voltage,
/*battery_size=*/ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_OTHER,
/*battery_quantity=*/1,
/*battery_size=*/&dev_ctx.batt_attrs.size,
/*battery_quantity=*/&dev_ctx.batt_attrs.quantity,
/*battery_rated_voltage=*/NULL,
/*battery_alarm_mask=*/NULL,
/*battery_voltage_min_threshold=*/NULL,

View file

@ -24,6 +24,9 @@ void prst_zb_attrs_init(struct zb_device_ctx *dev_ctx) {
dev_ctx->basic_attr.hw_version = CONFIG_PRST_ZB_HARDWARE_VERSION;
dev_ctx->batt_attrs.quantity = 1;
dev_ctx->batt_attrs.size = ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_OTHER;
dev_ctx->identify_attr.identify_time =
ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE;
}

View file

@ -19,6 +19,10 @@ typedef struct {
zb_uint8_t voltage;
// Units of 0.5%. 0x00 (0%) - 0xc8 (100%) (optional, reportable).
zb_uint8_t percentage;
// Whole number of battery cells used to power device
zb_uint8_t quantity;
// Enumeration of battery size
enum zb_zcl_power_config_battery_size_e size;
} prst_batt_attrs_t;
// Soil moisture cluster.