Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Power Source Cluster issue (CON-1608) #1337

Closed
sdrasti opened this issue Mar 20, 2025 · 2 comments
Closed

Power Source Cluster issue (CON-1608) #1337

sdrasti opened this issue Mar 20, 2025 · 2 comments

Comments

@sdrasti
Copy link

sdrasti commented Mar 20, 2025

I have added the power source cluster for a battery operated device.

The PowerSource::Attributes::BatPercentRemaining attribute can't be set, since it is not instantiated when the Power Source Cluster is created.

power_source_device::config_t                          powerSourceConfig;
cluster::power_source::feature::battery::config_t      battery_config;
cluster::power_source::feature::rechargeable::config_t rechargeable_config;

endpoint = power_source_device::create(Node, &powerSourceConfig, ENDPOINT_FLAG_NONE, NULL);

esp_matter::cluster_t *Cluster = esp_matter::cluster::get(endpoint, chip::app::Clusters::PowerSource::Id);
battery_config.bat_charge_level = chip::to_underlying(PowerSource::BatChargeLevelEnum::kWarning);
rechargeable_config.bat_charge_state = chip::to_underlying(PowerSource::BatChargeStateEnum::kIsNotCharging);
cluster::power_source::feature::battery::add(Cluster, &battery_config);
cluster::power_source::feature::rechargeable::add(Cluster, &rechargeable_config);

The Cluster is basically working, since the BatChargeLevel-Warning is shown in a commissioned device.

Have I missed something in the power_source config/feature setup?

@github-actions github-actions bot changed the title Power Source Cluster issue Power Source Cluster issue (CON-1608) Mar 20, 2025
@jadhavrohit924
Copy link
Contributor

@sdrasti As BatPercentRemaining is an optional attribute for the Battery feature, have you enabled the attribute in the application? This is how an optional attribute can be added.

@sdrasti
Copy link
Author

sdrasti commented Mar 20, 2025

@jadhavrohit924 That did the trick. Thank you!

@sdrasti sdrasti closed this as completed Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants